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

Jason Mihalick commented on MNG-5939:
-------------------------------------

We are having the same problem. I have posted a workaround on MSHADE-195 via 
*[this 
comment|https://issues.apache.org/jira/browse/MSHADE-195?focusedCommentId=15034132&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15034132]*

Here is what I commented there:
{quote}
The following work-around is now getting us past this problem. (Thanks [~tsz] 
for the initial suggestion that a workaround was possible via 
maven-source-plugin configuration.)

In my pom.xml, I added this to my pluginManagement section:

{code:xml}
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version>  <!-- your version may be different -->
        <executions>
          <execution>
            <id>default</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
{code}

The resulting effective pom (mvn help:effective-pom) then has this in the 
build/plugin section:

{code:xml}
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version> 
        <executions>
          <execution>
            <phase>none</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
{code}

which still results in the sources jar being produced, but attached only once 
instead of twice:

{noformat}
build   01-Dec-2015 12:09:55    [INFO] [INFO] >>> maven-source-plugin:2.1.2:jar 
(attach-sources) > generate-sources @ tep-core >>>
build   01-Dec-2015 12:09:55    [INFO] [INFO] 
build   01-Dec-2015 12:09:55    [INFO] [INFO] --- 
maven-enforcer-plugin:1.4:enforce (enforce-java-version) @ tep-core ---
build   01-Dec-2015 12:09:55    [INFO] [INFO] 
build   01-Dec-2015 12:09:55    [INFO] [INFO] <<< maven-source-plugin:2.1.2:jar 
(attach-sources) < generate-sources @ tep-core <<<
build   01-Dec-2015 12:09:55    [INFO] [INFO] 
build   01-Dec-2015 12:09:55    [INFO] [INFO] --- maven-source-plugin:2.1.2:jar 
(attach-sources) @ tep-core ---
build   01-Dec-2015 12:09:56    [INFO] [INFO] Building jar: 
/appl/bamboo-home/xml-data/build-dir/131073/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.10-sources.jar
build   01-Dec-2015 12:09:56    [INFO] [INFO] 
build   01-Dec-2015 12:09:56    [INFO] [INFO] --- 
maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ tep-core ---

...

build   01-Dec-2015 12:10:17    [INFO] [INFO] --- 
maven-install-plugin:2.4:install (default-install) @ tep-core ---
build   01-Dec-2015 12:10:17    [INFO] [INFO] Installing 
/appl/bamboo-home/xml-data/build-dir/131073/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.10.jar
 to /appl/.m2/repository/org/zzz/tep-core/3.0.10/tep-core-3.0.10.jar
build   01-Dec-2015 12:10:17    [INFO] [INFO] Installing 
/appl/bamboo-home/xml-data/build-dir/131073/PUBS-TEP-PRE/target/checkout/pom.xml
 to /appl/.m2/repository/org/zzz/tep-core/3.0.10/tep-core-3.0.10.pom
build   01-Dec-2015 12:10:17    [INFO] [INFO] Installing 
/appl/bamboo-home/xml-data/build-dir/131073/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.10-sources.jar
 to /appl/.m2/repository/org/zzz/tep-core/3.0.10/tep-core-3.0.10-sources.jar
build   01-Dec-2015 12:10:17    [INFO] [INFO] Installing 
/appl/bamboo-home/xml-data/build-dir/131073/PUBS-TEP-PRE/target/checkout/target/tep-core-3.0.10-javadoc.jar
 to /appl/.m2/repository/org/zzz/tep-core/3.0.10/tep-core-3.0.10-javadoc.jar

...

build   01-Dec-2015 12:10:17    [INFO] [INFO] --- 
maven-deploy-plugin:2.7:deploy (default-deploy) @ tep-core ---
build   01-Dec-2015 12:10:17    [INFO] [INFO] Uploading: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10.jar
build   01-Dec-2015 12:10:17    [INFO] [INFO] Uploaded: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10.jar
 (369 KB at 280.8 KB/sec)
build   01-Dec-2015 12:10:17    [INFO] [INFO] Uploading: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10.pom
build   01-Dec-2015 12:10:18    [INFO] [INFO] Uploaded: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10.pom
 (13 KB at 18.9 KB/sec)
build   01-Dec-2015 12:10:18    [INFO] [INFO] Downloading: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml
build   01-Dec-2015 12:10:18    [INFO] [INFO] Downloaded: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml
 (2 KB at 6.8 KB/sec)
build   01-Dec-2015 12:10:18    [INFO] [INFO] Uploading: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml
build   01-Dec-2015 12:10:19    [INFO] [INFO] Uploaded: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/maven-metadata.xml
 (2 KB at 2.3 KB/sec)
build   01-Dec-2015 12:10:19    [INFO] [INFO] Uploading: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10-sources.jar
build   01-Dec-2015 12:10:19    [INFO] [INFO] Uploaded: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10-sources.jar
 (112 KB at 171.9 KB/sec)
build   01-Dec-2015 12:10:19    [INFO] [INFO] Uploading: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10-javadoc.jar
build   01-Dec-2015 12:10:20    [INFO] [INFO] Uploaded: 
https://developer.zzz.org/maven/content/repositories/pubs-cols-release/org/zzz/tep-core/3.0.10/tep-core-3.0.10-javadoc.jar
 (369 KB at 501.7 KB/sec)
build   01-Dec-2015 12:10:20    [INFO] [INFO] 
------------------------------------------------------------------------
build   01-Dec-2015 12:10:20    [INFO] [INFO] BUILD SUCCESS
build   01-Dec-2015 12:10:20    [INFO] [INFO] 
------------------------------------------------------------------------
build   01-Dec-2015 12:10:20    [INFO] [INFO] Total time: 01:23 min
build   01-Dec-2015 12:10:20    [INFO] [INFO] Finished at: 
2015-12-01T12:10:20-05:00
build   01-Dec-2015 12:10:20    [INFO] [INFO] Final Memory: 25M/455M
build   01-Dec-2015 12:10:20    [INFO] [INFO] 
------------------------------------------------------------------------

{noformat}
{quote}

> Problem doing release when sources are generate as well
> -------------------------------------------------------
>
>                 Key: MNG-5939
>                 URL: https://issues.apache.org/jira/browse/MNG-5939
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.3.3, 3.3.9
>         Environment: Ubuntu 12.04.5 LTS
> Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 
> 2014-02-14T18:37:52+01:00)
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 
> 2015-11-10T17:41:47+01:00)
> Java version: 1.7.0_76, vendor: Oracle Corporation
>            Reporter: chibbe
>         Attachments: foo.bar.zip
>
>
> If I specified that sources should be generated with jar-no-fork goal 
> https://maven.apache.org/plugins/maven-source-plugin/jar-no-fork-mojo.html .
> When doing a release with maven-release-plugin it will build the source again 
> when useReleaseProfile is true (use the release profile that adds sources and 
> javadocs to the released artifact 
> http://maven.apache.org/maven-release/maven-release-plugin/perform-mojo.html#useReleaseProfile).
> The outcome is that it will run with both jar and jar-no-fork and generate 
> and deploy 2 -sources.jar artifacts, with same version. That makes the 
> release build fails.
>  
> The same behavior could be reproduced when running both jar and jar-no-fork 
> goal between maven 3.2.1. and maven 3.3.9.
> ----
> Please find the logs for maven 3.2.1 and 3.3.9 in the foo.bar.zip
> With maven 3.3.9 it uploads it 2 times :
> Uploaded: 
> http://127.0.0.1:8081/nexus/content/repositories/releases/foo/bar/0.0.1/bar-0.0.1-sources.jar
>  (722 B at 15.3 KB/sec)
> Uploading: 
> http://127.0.0.1:8081/nexus/content/repositories/releases/foo/bar/0.0.1/bar-0.0.1-sources.jar
> 722/722 B



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

Reply via email to