publishToMavenLocal
always publishes to either ~/.m2 or the path set for <LocalRepository>
tag in ~/.m2/settings.xml
. However when I set the system property maven.repo.local
it is ignored. Is there a way to override the location of the local maven repository when publishing using gradle publishToMavenLocal
, other than settings.xml (I am looking for either project property or system property or environment variable).
Here is what I tried gradle -Dmaven.repo.local=/home/skgupta/myrepo build pTML
Please help
Gradle does not use the Maven Local Repository for a new dependency.
repositories { mavenLocal() } Gradle uses the same logic as Maven to identify the location of your local Maven cache. If a local repository location is defined in a settings. xml , this location will be used.
Gradle looks into '~/. m2/settings. xml' for information where the local Maven repository is located.
Your -Dmaven.repo.local
approach is working on my Gradle v4.8.1, here is the rundown:
gradle --stop
export M2_HOME=/tmp/other_em_two
export M2_REPO=$M2_HOME/repository
mkdir -p $M2_REPO
tree $M2_REPO
gradle -Dmaven.repo.local=$M2_REPO pTML
tree $M2_REPO
Will show published files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With