Have mavenLocal() check M2_HOME/conf/settings.xml

Would be useful if mavenLocal() method checked M2_HOME/conf/settings.xml for a local Maven cache location before constructing it from user.home.

As per this thread - http://forums.gradle.org/gradle/topics/have_dependencies_resolved_from_remote_maven_repo_installed_into_local_maven_repo.

I would be happy to submit some code if you are welcoming contributors.

cheers

Contributions are always welcome. You can look at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenCacheLocator to get started.

You might also find http://gradle.org/contribute has some useful pointers. Thanks!

Shouldn’t it be the other way around? That is, a ‘settings.xml’ in ‘user.home’ should override whatever is inside ‘M2_HOME/conf/settings.xml’?

Yes. See this thread for some discussion on maven settings.xml. http://stackoverflow.com/questions/1261215/which-maven-settings-xml-files. And see this for Gradle http://gradle.org/docs/current/userguide/userguide_single.html#properties

The current gradle release(1.0) does consider the local repository definition in M2_HOME/conf/settings.xml. But the settings.xml in user.home is favoured over the the global settings.xml.

The expected behavior is that the two files get merged, and entries in the per-user file override entries in the global one. Aren’t we doing this already?

We pass global and user defined settings.xml to the maven-ant task atm and use their logic to calculate the resulting settings. so i think, yes we do.

I would mark this topic as fixed, as we take the M2_REPO/conf/settings.xml into account when locating the local repository.

The current way to determine the local maven repository is: 1. if no settings.xml can be found use USER_HOME/.m2/repository 2. if settings.xml in USER_HOME/.m2/settings.xml declares a localRepository use this defined repository location 3. if settings.xml in M2_HOME/conf/settings.xml declares a localRepository use this defined repository

Not sure how to mark this as fixed/implemented but its great news.

Very glad to see Gradle reach release 1.0.

Hi all,

I used maven-publish, maven-publish-auth plugins to accomplish this without parsing the settings by hand

How can Gradle Use Repository Settings From Maven’s Settings.xml to publish artifacts

Hope it is of use.

Peter