Grails support for new Maven Central - maven

I was trying to pick up dependencies from the maven central repo and it looks like the URL to download the same has recently moved from repo1.maven.org to search.maven.org with a different format and as such Grails 2.2.2 isn't able to resolve it.
Do we know if this has been updated in the newer grails versions and if not is there a suggested elegant work around for this short of downloading the jars to the lib folder and renaming them?
Thanks

The URL hasn't changed, e.g. see http://repo1.maven.org/maven2/org/springframework/security/oauth/spring-security-oauth2/1.0.5.RELEASE/
What did change (months ago) is that their web-based search moved to search.maven.org. But if the URL changed or if you want another custom repo, you could easily add it to your BuildConfig.groovy using mavenRepo "http://download.java.net/maven/2/" substituting the correct URL
Note that grailsCentral() is a front-end for other repos, in addition to having a few jars there for real. Most of the resources there are passthroughs to Maven Central or other repos. It should be first in your repo list so it's accessed first, and then if something isn't there it can fall back to one of the other defined repos.

Related

How to use "maven-publish" gradle plugin for bintray jfrog repo?

I want to publish my maven artifacts to standard maven repositories. For that the first example I chose is bintray Jfrog. Unfortunately this didn’t go well.
I had to add two hacks.
Remove existing artifacts if pushing same version again
Delete some corrupted versions after maven publish
The entire code can be found at https://github.com/pPanda-beta/cassandra-java-driver-reactive-mapper/blob/4b1395db443facb188ed4aee120c6db7864908b7/cassandra-java-driver-reactive-mapper-reactor-core/build.gradle#L93-L122
The uploaded artifacts are at https://bintray.com/ppanda-beta/maven/cassandra-java-driver-reactive-mapper-reactor-core
Why maven-publish?
The main objective here is to keep maven artifactories as a standard specification not specific to any provider. I want to represent an repo as { url, username, password } . The way of publishing should not change based on the repo provider.
PLEASE DO NOT SUGGEST ANY OTHER PLUGIN THAN 'maven-publish', I DONT WANT TO USE com.jfrog.bintray or com.jfrog.artifactory PLUGINS WHICH ARE VERY SPECIFIC TO BINTRAY JFROG.
What is wrong with current solution?
It is hacky. It is no better than jfrog gradle plugins. The solution is already using custom hacks which are not valid for other maven repos.
Why not switch to Jfrog altogether ?
The future of those artifacts is to reside in a more popular and standard maven repo like : maven central, github maven repo, ...etc. So anyway I'm gonna leave jFrog in near future. Till that time comes, I want to standardise the gradle script to work with any maven repo. This is very similar to docker container registry. Whether it is global docker hub or redhat cr or google cr, we use the same docker clients.

Is it possible to make a maven-repository with a static-website?

Stupide idea but ... is it possible to create a maven repository from a static website?
if I mannualy put pom and jar file on a website with a path similar to the one on any maven repository, then I reference the website as a maven repository from which I try to import dependency, will it work ?
I need it in order to store my snapshot version without publishing them. I don't care of security but I have 0 budget

Is there a way in Gradle to define what patterns of artifacts should, (or should not), be resolved via a repository?

Is there a way in Gradle to explicitly define where certain artifacts should be coming from?
We have a legacy project which is being on-boarded to use a proper artifact repository manager, instead of a network share. However, we have multiple repositories from which artifacts are being downloaded. We'd like to be able to fine-grain where certain artifacts should be coming from, until we can fully on-board to the artifact repository manager in question.
Is something like this possible?
Yes that is possible as of Gradle 5.1
https://docs.gradle.org/5.1/release-notes.html#repository-to-dependency-matching
Repository to dependency matching
It is now possible to match repositories to dependencies, so that Gradle doesn't search for a dependency in a repository if it's never going to be found there.
See the docs for more details: https://docs.gradle.org/5.6.2/userguide/declaring_repositories.html#sec::matching_repositories_to_dependencies

How to get artifact from maven repository without maven?

First, I am not a maven user. I need this library: https://github.com/ansell/JenaSesame but only the source code is available. The readme shows this information:
Repository
http://openjena.org/repo-dev
Group: org.openjena
Artifact: jena-sesame
But when I browse to that location I get a 404. How can I grab that artifact from that repository? I'm willing to install maven if I have to to get it; I just need the compiled library jars.
I have already searched the maven central repository at http://search.maven.org , and it is not there.
Any publicly-accessible repository should be viewable in a browser, and as such you should be able to download any JAR file contained within. The URL you've listed, openjena.org/repo-dev [1], looks more like a development repository. There are plenty of repositories around the world that are internal repositories, so this looks like one that hasn't been set up for public consumption.
It looks like they have binary releases available for download here: http://www.apache.org/dist/jena/ Have you looked there for what you're after?
[1]: Now a spam domain - visit https://jena.apache.org/ instead.

Maven repository inheritance and override

I have a Maven project that was built a few years back, and now I need to make some updates. One of the dependencies to my project has a Maven repository listed in its POM that no longer exists. I get build failures now.
I would have thought the repository listings in my POM or Settings.xml would trump any repositories listed in a dependency's POM; or Maven would try my repositories after failing to connect to the extinct repository. Instead, it just bombs out with a build failure.
Additionally, I already have the required dependencies in my local repository. I would have additionally thought that Maven would just use that.
Is there a way to override the inherited repository listings, or tell Maven to carry-on in the case of a repo problem?
If the artifact that you depend on is a snapshot version then maven will check for a new snapshot every time you build, thats why it is a good practice to lock down your dependencies to a released version.
You can "override" the repository declarations by defining a <mirror> in the settings.xml.
See http://maven.apache.org/settings.html#Mirrors
I usually set up a locally hosted repository manager (preferably nexus) and then define mirrorOf(*) = local-repo-manager/url.
Nexus allows multiple repo's to be grouped with a predefined search order.
Nexus repo's can be locally hosted or caching/proxies to public repo's.
I usually have a locally hosted 3rd party repo at the front of the group, where I can store artifacts that are not published on public repo's.

Resources