jira-importer commented on issue #544:
URL: 
https://github.com/apache/maven-deploy-plugin/issues/544#issuecomment-2771550494

   **[Karl Heinz 
Marbaise](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=khmarbaise)**
 commented
   
   So after taking a look into your pom file I questioning myself the following:
   
   You have defined a profile `twice-source-jar-goal` which defines two 
executions of the `maven-source-plugin` which will result in creating two jar 
files (internally) ok so far so good..The question is why do you execute 
`maven-source-plugin` twice without changing it's configuration for example 
adding a classifier. You can also see that in your attached log files where 
`maven-source-plugin` is executed twice. (Apart from the question why you have 
configured `maven-source-plugin` twice in your build which is different point).
   
   Nevertheless  tested with Maven 3.2.5 produces the same result which means 
the plugin will be executed twice times as described above. In the end the 
deploy of a SNAPSHOT will push two snapshot packages into repository manager: 
(slightly changed the configuration to use `jar-no-fork` goal instead of `jar`, 
but with the original configuration it will do that same)
   
   ```
   [INFO] 
   [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ sample ---
   [INFO] Building jar: 
/Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/target/sample-0.0.1-SNAPSHOT.jar
   [INFO] 
   [INFO] --- maven-source-plugin:3.0.1:jar-no-fork (source1) @ sample ---
   [INFO] Building jar: 
/Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/target/sample-0.0.1-SNAPSHOT-sources.jar
   [INFO] 
   [INFO] --- maven-source-plugin:3.0.1:jar-no-fork (source2) @ sample ---
   [INFO] Building jar: 
/Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/target/sample-0.0.1-SNAPSHOT-sources.jar
   [INFO] 
   ```
   
   Furthermore you can see that the `maven-install-plugin`:
   
   ```
   [INFO] --- maven-install-plugin:2.4:install (default-install) @ sample ---
   [INFO] Installing 
/Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/target/sample-0.0.1-SNAPSHOT.jar
 to 
/Users/khmarbaise/.m2/repository/sample/sample/0.0.1-SNAPSHOT/sample-0.0.1-SNAPSHOT.jar
   [INFO] Installing /Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/pom.xml to 
/Users/khmarbaise/.m2/repository/sample/sample/0.0.1-SNAPSHOT/sample-0.0.1-SNAPSHOT.pom
   [INFO] Installing 
/Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/target/sample-0.0.1-SNAPSHOT-sources.jar
 to 
/Users/khmarbaise/.m2/repository/sample/sample/0.0.1-SNAPSHOT/sample-0.0.1-SNAPSHOT-sources.jar
   [INFO] Installing 
/Users/khmarbaise/ws-git-maven-bugs/MDEPLOY-254/target/sample-0.0.1-SNAPSHOT-sources.jar
 to 
/Users/khmarbaise/.m2/repository/sample/sample/0.0.1-SNAPSHOT/sample-0.0.1-SNAPSHOT-sources.jar
   [INFO] 
   ```
   
   installs the same file twice times which results in overwriting the file. 
This is related to MNG-5969 which already describes that scenario. If you run 
`mvn deploy` those two added source package will be deployed which exactly will 
result in a failure during the release cause your repository manager denies 
overwriting of already existing released artifacts.
   
   A short term solution (workaround) would be to change your build and 
configure your executions for the `maven-source-plugin` by using different 
classifiers (Apart form the question why you have two executions in your build 
at all?).
   
   The `maven-shade-plugin` (it creates also a `sources` packages which 
collides with the one previously created). The part with `maven-shade-plugin` 
looks strange. I'm not sure at the moment if this is a bug in 
`maven-shade-plugin` ??
   
   A short term solution (workaround) would be to use either 
`maven-source-plugin` only to create a source package or use 
`maven-shade-plugin` only but not both.
   
   There are four solutions possible which I can think of:
   1. Handle it in Maven core via MNG-5969 and break the build if something 
like this happens. Will only work with newer Maven versions.
   2. Try to identify such scenario in `maven-source-plugin` as well as in 
`maven-shade-plugin` and break the build.
   3. Try to identify such scenario in `maven-install-plugin` and break the 
build
   4. Try to identify such scenario in `maven-deploy-plugin` and break the build
      Maybe we need to do all of them...to make it more stable and more clear 
for users.
      Unfortunately that will help only if users use the most recent versions 
of at least of one of the plugins otherwise your build will break as described 
in this issue.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to