Hi Jim,
On 04/07/18 02:27, Jim Sellers wrote:
Hi Karl.

1) when I comment out the maven-source-plugin and run "mvn clean install" I
don't see any -sources.jar files in my local repo.

Of course not cause the source plugin is only part of the release profile ..
You have to activate the profile via -P ...on command to see the result with simply `mvn clean install`...

Kind regards
Karl Heinz Marbaise


2) I tried it just with the execution part commented out, and I don't see
any -sources jars again. I had expected to from your above comment.

3) I noticed that the super pom changed from using a goal of "jar" to
"jar-no-fork"
http://maven.apache.org/ref/3.5.3/maven-model-builder/super-pom.html
http://maven.apache.org/ref/3.5.4/maven-model-builder/super-pom.html
I think that this is from an issue you originally reported
https://issues.apache.org/jira/browse/MNG-5940

Yes correct ...


4) If I change my original config to have "jar-no-fork", then I get the
original behaviour with both 3.5.3 and 3.5.4 (I think, only tested locally
without nexus) >
5) What's the suggested way to attach sources? If it's jar-no-fork then I
think that the cookbook is out of date.
https://maven.apache.org/plugin-developers/cookbook/attach-source-javadoc-artifacts.html

Tomorrow I'll test point #4 and if you say #5 if the best way, I'll make
the change to our corporate pom. It will take a long time to have all the
projects and prod branches updated. :-/

I really appreciate your help and time with this.
Jim



On Tue, Jul 3, 2018 at 3:06 PM Karl Heinz Marbaise <[email protected]>
wrote:

Hi,

The issue looks a bit like:

https://issues.apache.org/jira/browse/MNG-5359

On 03/07/18 21:04, Karl Heinz Marbaise wrote:
Hi Jim,

first thanks for the example project which helps a lot to find the real
problem...


So the issue is related to two things. First you have defined your own a
release profile which is ok so far...

The problem is related to the definition of the maven-sources-plugin
like this:

   <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

which in result means the maven-source-plugin will be executed
twice...which looks like this:



[INFO] --- maven-source-plugin:3.0.1:jar-no-fork (attach-sources) @
hello-world-not-using-corp-parent-war ---
[INFO] Building jar:

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar


[INFO]
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) >
generate-sources @ hello-world-not-using-corp-parent-war >>>
[INFO]
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) <
generate-sources @ hello-world-not-using-corp-parent-war <<<
[INFO]
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @
hello-world-not-using-corp-parent-war ---
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) @
hello-world-not-using-corp-parent-war ---
[INFO] Skipping javadoc generation
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @
hello-world-not-using-corp-parent-war ---
[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.war

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.war


[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/pom.xml

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.pom


[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar


[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar




If you do a "mvn clean install" it will not cause a problem cause the
created sources.jar will be overwritten...but if you do a mvn clean
deploy nexus will prevent the upload of the second sources jar ....which
result in the error you have described....

So the solution:

The maven-source-plugin is already defined in the super pom of maven and
if you simply omit the definition this will work:

[INFO] --- maven-war-plugin:2.2:war (default-war) @
hello-world-not-using-corp-parent-war ---
[INFO] Packaging webapp
[INFO] Assembling webapp [hello-world-not-using-corp-parent-war] in

[/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT]


[INFO] Processing war project
[INFO] Copying webapp resources

[/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/src/main/webapp]


[INFO] Webapp assembled in [24 msecs]
[INFO] Building war:

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.war


[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar-no-fork (attach-sources) @
hello-world-not-using-corp-parent-war ---
[INFO] Building jar:

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar


[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) @
hello-world-not-using-corp-parent-war ---
[INFO] Skipping javadoc generation
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @
hello-world-not-using-corp-parent-war ---
[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.war

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.war


[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/pom.xml

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT.pom


[INFO] Installing

/Users/kama/ws-git-maven-bugs/MNG-duplicate-files/hello-world-not-using-corp-parent/hello-world-not-using-corp-parent-war/target/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar

to

/Users/kama/.m2/repository/com/github/sellersj/no/corp/parent/hello-world-not-using-corp-parent-war/0.0.5-SNAPSHOT/hello-world-not-using-corp-parent-war-0.0.5-SNAPSHOT-sources.jar


[INFO]


Than a deploy should also work without any issue...

If you like to pin the version of the plugin you can simply do that by
defining it like this:

          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.0.1</version>
          </plugin>

without the execution block...which should not influence it but does
which needs a more deep analysis...and looks like a bug...


Kind regards
Karl Heinz Marbaise




On 03/07/18 18:33, Jim Sellers wrote:
Hi Karl.

I've created a minimal project. The git and nexus / repo info would
have to be set in a settings.xml file, and the nexus repo would have
to not allow overwriting releases.
https://github.com/sellersj/hello-world-not-using-corp-parent

This works for maven 3.5.3 but not 3.5.4

If you need a log, I'll have to scrub it and that will take me more
time.

Thanks so much for your help.
Jim

On Sat, Jun 30, 2018 at 6:11 AM Jim Sellers <[email protected]
<mailto:[email protected]>> wrote:

     I’ll create one next week.

     Thanks for your help.

     Jim
     On Sat, Jun 30, 2018 at 2:43 AM Karl Heinz Marbaise
     <[email protected] <mailto:[email protected]>> wrote:

         Hi Jim,

         On 29/06/18 21:15, Jim Sellers wrote:
          > Hi all.
          >
          > We have nexus reject over writing releases.
          >
          > After upgrading maven from 3.5.3 to 3.5.4, the release plan
         tries to upload
          > the -sources jars twice, failing the build.
          >
          > This is for a multi module project.
          > pom
          > \- ear
          > \- war
          >
          > Example error message
          > [ERROR] Failed to execute goal
          > org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
         (default-deploy)
          > on project TestProjectWAR: Failed to deploy artifacts: Could
         not transfer
          > artifact ca.gc.ic.test:TestProjectWAR:jar:sources:1.6.0
from/to
          > internal-nexus (
          >


https://my-nexus.example.com/maven-proxy/content/repositories/internal-released):


          > Failed to transfer file:
          >


https://my-nexus.example.com/maven-proxy/content/repositories/internal-released/com/example/TestProjectWAR/1.6.0/TestProjectWAR-1.6.0-sources.jar.


          > Return code is: 400, ReasonPhrase: Bad Request. -> [Help 1]
          >
          > Revering maven to 3.5.3 fixes it. Anyone else seeing this
         behaviour?

         Do you have a sample project which reproduces the issue (github
/
         bitbucket / gitlab) and very important the whole pom
         files....also a log
         file would be helpful...

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to