[GRADLE-2254] Maven Plugin uploads certain artifacts twice Created: 26/Apr/12 Updated: 04/Jan/13 Resolved: 27/Apr/12 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 1.1-rc-1 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Description |
Hi There, I'm observing a werid behavior in the Maven Plugin. It seems as if it's uploading certain artifacts multiple times. So either I'm doing something wrong (which might very well be ) or this might be a bug. I have a basic jar project, of which I want to deploy 4 artifacts:
I want the sources jars to just use classifiers. The test jars should get their own artifactIds. Here are the relevant parts of my build.gradle: task sourcesJar(type: Jar) { from sourceSets.main.allSource classifier = 'sources' }task testJar(type: Jar) { baseName = project.name + '-tests' from sourceSets.test.output }task testSourcesJar(type: Jar) { baseName = project.name + '-tests' classifier = 'sources' from sourceSets.test.allSource }artifacts { archives sourcesJar, testJar, testSourcesJar }uploadArchives { repositories.mavenDeployer { def mainPom = addFilter('main') {artifact, file -> !artifact.name.endsWith("-tests") }def testsPom = addFilter('tests') {artifact, file -> artifact.name.endsWith("-tests") }def poms = [ mainPom, testsPom ] poms.each { it.version = project.version }repository(url: "http://myrepo") { When I run uploadArchives with --info, I get the following output: > :mylib:uploadArchives The HTTP 400 is our repo's way of indicating the artifact alreacy exists and cannot be overwritten in a release repository. This behavior seems corrent as it looks like gradle is trying to upload the same artifact (mylib-tests-4.0.0-sources.jar) twice. I have added this code to get the list of artifacts: configurations.archives.artifacts.each { println "ARTIFACT: ${it}" } And I got the output: ARTIFACT: ArchivePublishArtifact mylib:jar:jar: Which looks correct to me... Any clue what might be wrong here? Many thanks in advance, |
Comments |
Comment by Gradle Forums [ 26/Apr/12 ] |
Hello Mike, |
Comment by René Gröschke (Inactive) [ 26/Apr/12 ] |
The problem here is, that our AbstractMavenResolver reuses one DeployTask in its commitPublishTransaction() method. The problem of reusing a DeployTask is, that the attachedArtifacts cannot be resetted after executing the deploytask. |