[ 
https://issues.apache.org/jira/browse/MSHADE-195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Esko Luontola updated MSHADE-195:
---------------------------------
    Description: 
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.

  was:
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.


> 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
>
> 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)

Reply via email to