[GRADLE-1291] Make mavenLocal() as default, add noMavenLocal() Created: 05/Jan/11  Updated: 04/Jan/13  Resolved: 09/Feb/12

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: None

Type: Improvement
Reporter: Hendy Irawan Assignee: Unassigned
Resolution: Won't Fix Votes: 0


GRADLE-1173 in 0.9.1 is a huge improvement.

I'd propose to improve this a bit more.

While some projects might want to leave out mavenCentral(), mavenLocal() is definitely a must in all projects (even non-Maven ones, since it has very little impact on build performance).

Having mavenLocal() added as default repository means users are not puzzled by why their gradle build doesn't use the cached repository (which for most Maven users, already contains almost everything they need).

mavenLocal() will be a optional no-op (since it's a default), but it should not be deprecated since it's good anyway to state the intention explicitly. However to make it possible to remove this default there must be an additional method called noMavenLocal() or removeMavenLocal()

Hoping this proposal accepted. Thanks.

Comment by René Gröschke (Inactive) [ 06/Jan/11 ]

I would like stick to the actual approach, that each repo must be explicitly set. this avoids too much "magic" in a build script

Comment by Daz DeBoer [ 09/Feb/12 ]

Including mavenLocal() in your build script can mean that your build script is not portable. A required dependency that is in your local maven repo may not be present in that of another developer, so what works on your machine may not work on anothers. We would discourage the use of mavenLocal in your build script, unless it is required for consuming artifacts locally published by Maven.

As of Milestone 7, Gradle will automatically use artifacts from the Maven local repository, but only if those artifacts could have been downloaded from one of the a declared repositories. So Gradle will check the remote repo, download the SHA1 file, compare it against the files in the local maven repository, and copy the artifact from their if possible.

We feel that this gives the best possible tradeoff between reproducibility and performance. Some remote network traffic is required to verify the previously downloaded artifact, but the benefit is that your build will work irrespective of what's actually present in .m2/repo.

For this reason, I'm closing this issue as 'wont-fix'. Please let me know if this doesn't make sense to you.

Comment by Hendy Irawan [ 10/Feb/12 ]

Thank you Daz !

Your solution seems to be quite intricate. However it's a great feature!

Thank you.

Generated at Wed Jun 30 11:51:49 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.