[GRADLE-2762] maven-publish plugin should not install unique snapshots to maven local repository Created: 02/May/13  Updated: 09/Oct/13  Resolved: 09/Sep/13

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.9-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 5

Attachments: Zip Archive maven-shade-plugin.zip    

 Description   

From this posting: [1]http://forums.gradle.org/gradle/topic...

The PublishToMavenLocal task uses the default CustomDeployTask created by AntTaskBackedMavenPublisher which sets uniqueVersion = true. This is incorrect for publishing to mavenLocal:

As per: [2]https://cwiki.apache.org/MAVEN/maven-...

Non-unique Snapshot Deployments
The setting false for a distribution repository has no effect in version 3.x, snapshot artifacts will always be deployed using a timestamped version.

The uniqueVersion settings only has no effect for a 'distribution repository' which I don't believe applies to mavenLocal().
----------------------------------------------------------------------------------------
[1] http://forums.gradle.org/gradle/topics/maven_uniqueversion_for_publishing
[2] https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-NonuniqueSnapshotDeployments



 Comments   
Comment by John Engelman [ 02/May/13 ]

I tested this with Maven 3 against the Maven Shade Plugin source:

$ mvn --version
Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)
Maven home: /usr/share/maven
Java version: 1.6.0_43, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.8.2", arch: "x86_64", family: "mac"
$ mvn install
....
[INFO] Installing /Users/jengelman/workspace/personal/maven-shade-plugin/target/maven-shade-plugin-2.0-SNAPSHOT.jar to /Users/jengelman/.m2/repository/org/apache/maven/plugins/maven-shade-plugin/2.0-SNAPSHOT/maven-shade-plugin-2.0-SNAPSHOT.jar
[INFO] Installing /Users/jengelman/workspace/personal/maven-shade-plugin/pom.xml to /Users/jengelman/.m2/repository/org/apache/maven/plugins/maven-shade-plugin/2.0-SNAPSHOT/maven-shade-plugin-2.0-SNAPSHOT.pom
....

To be truthful though, I've never really worked with Maven, so I'm not positive I set the project up correctly. All I changed was the version in the

<version>

tag.

I have attached the project to this issue if someone else wants to test it.

Also to note that there is no

<distributionManagement>

block is this pom.xml. If I read things correctly, I believe this is the block that most closely corresponds to the

publishing {} 

block in Gradle. So in Maven's case, MavenLocal is not considered a "distribution repo"

Comment by Luke Daley [ 16/May/13 ]

Another related forum issue: http://forums.gradle.org/gradle/topics/cannot_depend_on_a_project_published_with_maven_publish

Comment by Luke Daley [ 16/May/13 ]

@Adam: I think we should consider up'ing the priority of this for 1.7 as it means that the maven-publish plugin can't be used for a maven local workflow.

Comment by John Engelman [ 06/Jun/13 ]

Any word on if this will be getting fixed for 1.7? It's going to become a major hinderance shortly for us.

Comment by Luke Daley [ 20/Jun/13 ]

Our plan to fix this properly is to migrate to the new maven publishing plugin. It does not have this problem.

See this thread for a workaround to this issue with the old maven plugin: http://forums.gradle.org/gradle/topics/override_location_of_the_local_maven_repo

Comment by John Engelman [ 20/Jun/13 ]

Luke -
The original bug was discovered using the new 'maven-publish' plugin. The PublishToMavenLocal is using all the same Publish classes and settings as the PublishToMavenRepository tasks. Publishing to maven local shouldn't be treated as a distribution repository. I believe in the end, the PublishToMavenLocal task should be using the org.apache.maven.artifact.ant.InstallTask instead of org.apache.maven.artifact.ant.DeployTask.

Comment by Luke Daley [ 21/Jun/13 ]

Sorry John, I commented on the wrong ticket.

Comment by Gunnar Morling [ 01/Aug/13 ]

I came across the same issue recently and created this forum post (I only came across this JIRA issue afterwards). +1 for fixing this as it makes migration scenarios where (existing) Maven projects depend on (already converted) Gradle projects very hard.

Comment by Steve Ebersole [ 01/Aug/13 ]

+1 from me too. Sadly most of us still need to deal with people using Maven...

Comment by Steve Ebersole [ 09/Oct/13 ]

I did not get notified when this issue was resolved (I am a watcher). Do y'all disable notifications from this Jira?

Generated at Wed Jun 30 12:30:48 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.