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

Christian Schulte edited comment on MNG-5969 at 2/1/16 10:48 PM:
-----------------------------------------------------------------

I agree that this is how Maven should behave and I committed the corresponding 
changes in 
[020e35816f184c10c3f87f103336fed4516f7af6|https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commitdiff;h=020e35816f184c10c3f87f103336fed4516f7af6].
 I then noticed there are a lot of historic issues regarding the behaviour of 
that method and reverted everything to what I think consensus had been reached. 
See all the issues I added to the Javadoc of method 
'MavenProject.addAttachedArtifact' in 
[5f048234ff44dbf70fcad9f17834c64866f452e1|https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commitdiff;h=5f048234ff44dbf70fcad9f17834c64866f452e1].
 Is it correct that you want Maven to behave as was done in the first commit? 
Please see the Javadoc of the methods in interface 'MavenProjectHelper'. "Add 
or replace an artifact to the current project." That's how the 'attach 
artifact' use case is defined. Is your use case really "attach artifact" or is 
it "add an attached artifact"? Changing the way the "attach artifact" use case 
is defined needs discussion with the people who introduced that API that way. 
Adding a new use case "add attached artifact" with different semantic would be 
no problem.


was (Author: schulte77):
I agree that this is how Maven should behave and I committed the corresponding 
changes in 
[020e35816f184c10c3f87f103336fed4516f7af6|https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commitdiff;h=020e35816f184c10c3f87f103336fed4516f7af6].
 I then noticed there are a lot of historic issues regarding the behaviour of 
that method and reverted everything to what I think consensus had been reached. 
See all the issues I added to the Javadoc of method 
'MavenProject.addAttachedArtifact' in 
[5f048234ff44dbf70fcad9f17834c64866f452e1|https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commitdiff;h=5f048234ff44dbf70fcad9f17834c64866f452e1].
 Is it correct that you want Maven to behave as was done in the first commit?

> Multiple times attaching the same artifact should fail the build
> ----------------------------------------------------------------
>
>                 Key: MNG-5969
>                 URL: https://issues.apache.org/jira/browse/MNG-5969
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.1, 3.2.1, 3.2.2, 3.2.3, 3.2.5, 3.4.0
>            Reporter: Karl Heinz Marbaise
>            Priority: Minor
>
> If i take a look at [MNG-5939|MNG-5939] and use the example project and test 
> it with the current version of Maven on master 
> (f467d9142fa6c928bdae25253350915728fef286) i will get the following:
> {noformat}
> [INFO] --- maven-source-plugin:2.4:jar (attach-sources) @ bar ---
> [INFO] Building jar: 
> /Users/kama/Downloads/foo.bar/target/bar-0.0.1-sources.jar
> [INFO]
> [INFO] --- maven-source-plugin:2.4:jar-no-fork (attach-sources) @ bar ---
> [INFO] Building jar: 
> /Users/kama/Downloads/foo.bar/target/bar-0.0.1-sources.jar
> [INFO] Replaced artifact foo:bar:java-source:sources:0.0.1.
> [INFO]
> {noformat}
> First the previous behaviour (Maven 3.0.5) was to emit a {{WARNING}} which is 
> not the case anymore. At the moment it only creates a simple output:
> {noformat}
> [INFO] Replaced artifact foo:bar:java-source:sources:0.0.1.
> {noformat}
> which is not enough. 
> Furthermore I'm the opinion that in this case the build should be broken, 
> cause this build is wrongly configured (twice executions of 
> maven-source-plugin without changing the classifier it could also be several 
> executions of other plugins).
> Maven 3.1.1, 3.2.1, 3.2.2,  will ignore it completely without any message nor 
> a warning etc.
> Maven 3.2.3, 3.2.5 will produce no warning but will attach the artifacts 
> twice times {{-sources}} which would fail a release like this:
> {noformat}
> [INFO] Installing /Users/kama/Downloads/foo.bar/target/bar-0.0.1-sources.jar 
> to /Users/kama/.m2/repository/foo/bar/0.0.1/bar-0.0.1-sources.jar
> [INFO] Installing /Users/kama/Downloads/foo.bar/target/bar-0.0.1-sources.jar 
> to /Users/kama/.m2/repository/foo/bar/0.0.1/bar-0.0.1-sources.jar
> {noformat}



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

Reply via email to