Limit number of artifacts installed into .m2


(tulsoba) #1

We use the maven plugin to install our artifacts into a local .m2 repository. For some reason gradle (using 1.4) is starting to use a timestamp instead of the SNAPSHOT qualifier when installing the artifacts to the local .m2 repo. Eg:

MyWebApp-1.0-20130318.121355-22.pom
 MyWebApp-1.0-20130318.121355-22.war

instead of:

MyWebApp-1.0-SNAPSHOT.pom
 MyWebApp-1.0-SNAPSHOT.war

As a result one of our jenkins build nodes now have a .m2 repository containing 58 GB of data (only counting our own projects). What has caused this change in behavior and how do we fix it.


(René Groeschke) #2

I can’t reproduce the behaviour you’re describing. Can you provide some more details about you’re environment? Which gradle version are you using? Did you add any customizations to the install task? Do you have custom settings in your settings.xml?

cheers, René


(tulsoba) #3

Hm seems to be a problem with the uploadArchives task.

I use gradle 1.4. I am building on windows/linux/ubuntu. I don’t have any settings.xml file (only used when building with maven I assume). No modification of the install task. I build with

gradle clean install uploadArchives

where:

project.uploadArchives {
      repositories {
        mavenDeployer {
          repository(url: http://path-to-artifactory/libs-snapshot-local) {
            authentication(userName: 'admin', password: 'password')
          }
        }
      }
    }

If I remove uploadArchives if does not install multiple archives into .m2. Is this a bug in the uploadArchives task?


(René Groeschke) #4

Hello, It’s a known issue, that the uploadArchives task also writes to the m2 repository. I havn’t found the according jira ticket yet.


(tulsoba) #5

Is there any workaround besides deleting each local .m2 on all slave each night? This is pretty much a breaking bug in our case since we rely 100% on integration with artifactory.

If you find the bug/jira ticket please post it.


(tulsoba) #6

I could not find it here (did a search for uploadArchives):

http://issues.gradle.org/secure/QuickSearch.jspa

so I have created a new bug:

http://issues.gradle.org/browse/GRADLE-2711


#7

Any chance you can check if this is a regression from earlier behaviour, and in which version it broke? That information can be useful to other users, and may help track down a fix. Thanks.


#8

If it works for you, the new ‘maven-publish’ plugin does not automatically install to ‘.m2’ when publishing. Although it is an incubating feature, it has good test coverage and works very well for many use cases.