How to force gradle to use/share ~/.m2/repository with Maven system wide? -
by default gradle uses ~/.gradle/cache
cache maven artifacts.
i use maven , set proxy , repository urls in ~/.m2/settings.xml
, don't want duplicate settings gradle.
official solution add:
repositories { mavencentral() mavenlocal() # <== }
to build.gradle
. requires changing project build script , not acceptable.
is possible set setting system wide or outside of project (without editing project own files)?
i routinely want mavenlocal buildscript, need multi-module projects , need disable it, use in ~/.gradle/init.d/mavenlocal.gradle:
allprojects { project -> buildscript { if( !project.hasproperty('skipmavenlocal') ) { repositories { println "adding buildscript mavenlocal()" mavenlocal() } configurations.all { resolutionstrategy.cachechangingmodulesfor 0, 'hours' } } } if( !project.hasproperty('skipmavenlocal') ) { repositories { println "adding mavenlocal()" mavenlocal() } } }
Comments
Post a Comment