0

I apply plugin: 'maven-publish' in my build.gradle in order to install artifacts into the local ~/.m2 Maven repository by executing gradle publishToMavenLocal.

I have now searched for a while and I found lots of information on how to publishToMavenLocal, but none on how to publish into the local ~/.gradle directory. I tried publishToGradleLocal, but the task does not exist. Also, the plugin code makes me assume that there is support for Gradle repositories, but for Maven repositories, only.

  • If such exists, which is the common way to publish directly into the local ~/.gradle directory?
  • If not, I understand that publishToMavenLocal makes the artifact available for both Maven and Gradle, which is nice. However, Gradle usually caches its dependencies in .gradle, which has - as I assume - advantages over caching in ~/.m2. It's just a guess, but why else would they not directly cache in ~/.m2 in order to make JARs by default always available to Maven and to save disk space? So the plugin developer chose to not go with Gradle standards. I wonder why. Is there a well-documented, non-opinion-based reasen for this?
aboger
  • 2,214
  • 6
  • 33
  • 47
  • why do you need to 'publish' to .gradle ? can you explain your use-case. .m2 by def is maven repo vs .gradle is more local cache for the build tool – PrasadU Jul 07 '20 at 10:24
  • No particular use-case, just out of curiousity – aboger Jul 07 '20 at 11:13

0 Answers0