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

Rob Vesse commented on MSOURCES-143:
------------------------------------

Put together a minimal reproducer and did some analysis at 
https://github.com/rvesse/source-plugin-breaks-releases

For my particular case it's the interaction between this new duplicate 
invocation check and the implicit release profile that the 
{{maven-release-plugin}} activates by default (at least for their 2.x 
versions).  You can get Maven to show you the pom with the excess invocation by 
activating the implicit release profile via the {{performRelease}} property as 
the release plugin does i.e. {{mvn help:effective-pom -DperformRelease=true}}

I was using the {{jar}} goal of the {{maven-source-plugin}} in my own 
{{pom.xml}} and the implicit release profile adds an additional {{jar-no-fork}} 
goal hence failing the duplicate invocation check.

One workaround I found was to disable usage of the implicit release profile, 
this can most easily done by upgrading to a 3.x release of the 
{{maven-release-plugin}} as they now disable usage of that by default.  Or if 
you need to continue using a 2.x version of the release plugin you can add 
{{<useReleaseProfile>false</useReleaseProfile>}} to the plugin configuration.

> Can't create a source and test jar in Commons using commons-parent
> ------------------------------------------------------------------
>
>                 Key: MSOURCES-143
>                 URL: https://issues.apache.org/jira/browse/MSOURCES-143
>             Project: Maven Source Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.0
>            Reporter: Gary D. Gregory
>            Priority: Major
>
> Steps to reproduce:
> # git clone https://gitbox.apache.org/repos/asf/commons-parent.git
> # cd commons-parent
> # git checkout 8d886ce8382f7a79f06d51a3afc386b8a37d0473
> # mvn clean install
> # cd ..
> # git clone https://gitbox.apache.org/repos/asf/commons-cli.git
> # cd commons-cli
> # git checkout 08f8c5034a8492be6db65b2086341c292489ee53
> # mvn clean package
> [INFO] --- source:3.3.0:jar-no-fork (create-source-jar) @ commons-cli ---
> [ERROR] We have duplicated artifacts attached.
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  15.233 s
> [INFO] Finished at: 2023-08-15T15:39:45-04:00
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-source-plugin:3.3.0:jar-no-fork 
> (create-source-jar) on project commons-cli: Presumably you have configured 
> maven-source-plugn to execute twice times in your build. You have to 
> configure a classifier for at least on of them. -> [Help 1]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to