You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason Mihalick (JIRA)" <ji...@apache.org> on 2015/12/01 16:28:11 UTC

[jira] [Commented] (MSHADE-195) createSourcesJar with source:jar-no-fork causes sources.jar to be deployed twice, causing the build to fail

    [ https://issues.apache.org/jira/browse/MSHADE-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15033863#comment-15033863 ] 

Jason Mihalick commented on MSHADE-195:
---------------------------------------

We have been having the same problem with the maven release plugin in a project that does not use shade.  Here is some example output from the maven release:perform which shows the double upload of the sources jar.  We don't have any special configuration in our project for releasing.  We are just using the default release plugin configuration.


{noformat}
build	01-Dec-2015 08:27:30	[INFO] --- maven-release-plugin:2.5.2:perform (default-cli) @ tep-core ---
build	01-Dec-2015 08:27:30	[INFO] Checking out the project to perform the release ...

...

build	01-Dec-2015 08:28:32	[INFO] [INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ tep-core ---
build	01-Dec-2015 08:28:32	[INFO] [INFO] Building jar: /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.8.jar
build	01-Dec-2015 08:28:32	[INFO] [INFO] 
build	01-Dec-2015 08:28:32	[INFO] [INFO] >>> maven-source-plugin:2.1.2:jar (attach-sources) > generate-sources @ tep-core >>>
build	01-Dec-2015 08:28:32	[INFO] [INFO] 
build	01-Dec-2015 08:28:32	[INFO] [INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-java-version) @ tep-core ---
build	01-Dec-2015 08:28:32	[INFO] [INFO] 
build	01-Dec-2015 08:28:32	[INFO] [INFO] <<< maven-source-plugin:2.1.2:jar (attach-sources) < generate-sources @ tep-core <<<
build	01-Dec-2015 08:28:32	[INFO] [INFO] 
build	01-Dec-2015 08:28:32	[INFO] [INFO] --- maven-source-plugin:2.1.2:jar (attach-sources) @ tep-core ---
build	01-Dec-2015 08:28:33	[INFO] [INFO] Building jar: /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.8-sources.jar
build	01-Dec-2015 08:28:33	[INFO] [INFO] 
build	01-Dec-2015 08:28:33	[INFO] [INFO] --- maven-source-plugin:2.1.2:jar-no-fork (default) @ tep-core ---
build	01-Dec-2015 08:28:34	[INFO] [INFO] 
build	01-Dec-2015 08:28:34	[INFO] [INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ tep-core ---

...

build	01-Dec-2015 08:28:43	[INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ tep-core ---
build	01-Dec-2015 08:28:43	[INFO] [INFO] Installing /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.8.jar to /appl/.m2/repository/org/zzz/tep-core/3.0.8/tep-core-3.0.8.jar
build	01-Dec-2015 08:28:43	[INFO] [INFO] Installing /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/pom.xml to /appl/.m2/repository/org/zzz/tep-core/3.0.8/tep-core-3.0.8.pom
build	01-Dec-2015 08:28:43	[INFO] [INFO] Installing /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.8-sources.jar to /appl/.m2/repository/org/zzz/tep-core/3.0.8/tep-core-3.0.8-sources.jar
build	01-Dec-2015 08:28:43	[INFO] [INFO] Installing /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.8-sources.jar to /appl/.m2/repository/org/zzz/tep-core/3.0.8/tep-core-3.0.8-sources.jar
build	01-Dec-2015 08:28:43	[INFO] [INFO] Installing /appl/bamboo-home/xml-data/build-dir/393217/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.8-javadoc.jar to /appl/.m2/repository/org/zzz/tep-core/3.0.8/tep-core-3.0.8-javadoc.jar
build	01-Dec-2015 08:28:43	[INFO] [INFO] 
build	01-Dec-2015 08:28:43	[INFO] [INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ tep-core ---
build	01-Dec-2015 08:28:44	[INFO] [INFO] Uploading: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8.jar
build	01-Dec-2015 08:28:45	[INFO] [INFO] Uploaded: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8.jar (369 KB at 357.4 KB/sec)
build	01-Dec-2015 08:28:45	[INFO] [INFO] Uploading: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8.pom
build	01-Dec-2015 08:28:45	[INFO] [INFO] Uploaded: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8.pom (12 KB at 26.5 KB/sec)
build	01-Dec-2015 08:28:45	[INFO] [INFO] Downloading: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml
build	01-Dec-2015 08:28:45	[INFO] [INFO] Downloaded: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml (2 KB at 4.8 KB/sec)
build	01-Dec-2015 08:28:45	[INFO] [INFO] Uploading: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml
build	01-Dec-2015 08:28:46	[INFO] [INFO] Uploaded: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml (2 KB at 2.2 KB/sec)
build	01-Dec-2015 08:28:46	[INFO] [INFO] Uploading: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8-sources.jar
build	01-Dec-2015 08:28:47	[INFO] [INFO] Uploaded: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8-sources.jar (112 KB at 166.8 KB/sec)
build	01-Dec-2015 08:28:47	[INFO] [INFO] Uploading: https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.8/tep-core-3.0.8-sources.jar
build	01-Dec-2015 08:28:47	[INFO] [INFO] ------------------------------------------------------------------------
build	01-Dec-2015 08:28:47	[INFO] [INFO] BUILD FAILURE
build	01-Dec-2015 08:28:47	[INFO] [INFO] ------------------------------------------------------------------------
build	01-Dec-2015 08:28:47	[INFO] [INFO] Total time: 01:05 min
build	01-Dec-2015 08:28:47	[INFO] [INFO] Finished at: 2015-12-01T08:28:47-05:00
build	01-Dec-2015 08:28:48	[INFO] [INFO] Final Memory: 33M/659M
build	01-Dec-2015 08:28:48	[INFO] [INFO] ------------------------------------------------------------------------
{noformat}

Notice the double install of the sources jar by the install plugin at 08:28:43 and the double upload attempt of the sources jar at 08:28:46 and 08:28:47.  The double upload attempt of the sources jar causes a build failure because our Nexus repository does not allow overwriting of released artifacts as it should.  This problem does NOT occur using Maven 3.0.4 or 3.1.0. We have reproduced it under Maven versions 3.2.5 and 3.3.9.


> createSourcesJar with source:jar-no-fork causes sources.jar to be deployed twice, causing the build to fail
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: MSHADE-195
>                 URL: https://issues.apache.org/jira/browse/MSHADE-195
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3, 2.4
>            Reporter: Esko Luontola
>             Fix For: waiting-for-feedback, 2.4.3
>
>         Attachments: MSHADE-195-example.zip
>
>
> The workaround described in https://issues.apache.org/jira/browse/MSHADE-120 (i.e. running maven-source-plugin's jar-no-fork goal before shading) causes the problem that Maven will install and deploy the same sources.jar file twice:
> {noformat}
> [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ pricing-client ---
> [INFO] Installing xxx/pricing-client/target/pricing-client-0-SNAPSHOT.jar to xxx/pricing-client/0-SNAPSHOT/pricing-client-0-SNAPSHOT.jar
> [INFO] Installing xxx/pricing-client/target/dependency-reduced-pom.xml to xxx/pricing-client/0-SNAPSHOT/pricing-client-0-SNAPSHOT.pom
> [INFO] Installing xxx/pricing-client/target/pricing-client-0-SNAPSHOT-sources.jar to xxx/pricing-client/0-SNAPSHOT/pricing-client-0-SNAPSHOT-sources.jar
> [INFO] Installing xxx/pricing-client/target/pricing-client-0-SNAPSHOT-sources.jar to xxx/pricing-client/0-SNAPSHOT/pricing-client-0-SNAPSHOT-sources.jar
> {noformat}
> With maven-install-plugin this doesn't matter that much, but with maven-deploy-plugin it *fails the build*, because it tries to upload the sources.jar twice to the Maven repository and _Nexus doesn't allow that_:
> {noformat}
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project project: Failed to deploy artifacts: Could not transfer artifact xxx.availability:availability-client:jar:sources:1.0.24 from/to xxx-releases (http://xxx/nexus/content/repositories/releases): Failed to transfer file: http://xxx/nexus/content/repositories/releases/xxxx/availability/availability-client/1.0.24/availability-client-1.0.24-sources.jar. Return code is: 400, ReasonPhrase: Bad Request.
> {noformat}
> I'm suspecting this to be something like the maven-source-plugin and maven-shade-plugin both attaching the same sources.jar to the build, when only one of them should do it. This problem only happens with the sources jar and not the main artifact, so a trick similar to replacing the main artifact is needed also for the sources jar.
> h4. Workaround
> Configure maven-source-plugin with {{<attach>false</attach>}}. Then the shade plugin will find the sources and include them in the shaded sources jar, but the sources jar won't be attached to the build twice.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)