Discussion:
"mvn clean verify deploy" causes jar plugin to execute twice
o***@io7m.com
2016-08-05 15:19:05 UTC
Permalink
Hello.

I've run into a bizarre problem when trying to deploy a project.

If I run "mvn clean verify", the project builds without issue. If I run
"mvn clean verify deploy", the project fails to build (on the very last
module, naturally).

The error is:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.0:jar (default-jar) on project io7m-jsx-tests: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them. -> [Help 1]

I am not attaching supplemental artifacts in that module, and am also not
replacing any.

The project in question is here:

https://github.com/io7m/jsx/tree/develop

The failure occurs when deploying the io7m-jsx-tests module:

http://ataxia.io7m.com/2016/08/05/build.txt

Note that there are no sources in src/main as this is a module containing
the unit tests for all other modules. However, this has not been a problem
to date and have used this arrangement without issue in some 40 or so
projects. Today, it suddenly appears to be a problem.

Is this a bug? Is there anything I can do to fix it?

M
o***@io7m.com
2016-08-05 15:26:08 UTC
Permalink
On 2016-08-05T15:19:05 +0000
Post by o***@io7m.com
Note that there are no sources in src/main as this is a module containing
the unit tests for all other modules. However, this has not been a problem
to date and have used this arrangement without issue in some 40 or so
projects. Today, it suddenly appears to be a problem.
Adding a single empty/useless class to src/main/java in the offending
module works around the issue. This seems like a bug to me...

M
Anders Hammar
2016-08-05 16:48:25 UTC
Permalink
Executing
mvn verify deploy
will execute the build lifecycle twice. No need to do that. Just execute
mvn deploy
as the deploy phase comes after the verify phase.
Clean phase is of different lifecycle though. So in your case:
mvn clean deploy

However, there might be a bug nevertheless as your execution shouldn't
typically generate an exception.

/Anders (mobile)

On Aug 5, 2016 18:19, <***@io7m.com> wrote:

Hello.

I've run into a bizarre problem when trying to deploy a project.

If I run "mvn clean verify", the project builds without issue. If I run
"mvn clean verify deploy", the project fails to build (on the very last
module, naturally).

The error is:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-jar-plugin:3.0.0:jar
(default-jar) on project io7m-jsx-tests: You have to use a classifier to
attach supplemental artifacts to the project instead of replacing them. ->
[Help 1]

I am not attaching supplemental artifacts in that module, and am also not
replacing any.

The project in question is here:

https://github.com/io7m/jsx/tree/develop

The failure occurs when deploying the io7m-jsx-tests module:

http://ataxia.io7m.com/2016/08/05/build.txt

Note that there are no sources in src/main as this is a module containing
the unit tests for all other modules. However, this has not been a problem
to date and have used this arrangement without issue in some 40 or so
projects. Today, it suddenly appears to be a problem.

Is this a bug? Is there anything I can do to fix it?

M
Stephen Connolly
2016-08-05 17:10:41 UTC
Permalink
The issue is that the artifact is being attached to the build and then
attached again, and some versions of maven complain if you try to attach
multiple artifacts at the same coords
Post by Anders Hammar
Executing
mvn verify deploy
will execute the build lifecycle twice. No need to do that. Just execute
mvn deploy
as the deploy phase comes after the verify phase.
mvn clean deploy
However, there might be a bug nevertheless as your execution shouldn't
typically generate an exception.
/Anders (mobile)
Hello.
I've run into a bizarre problem when trying to deploy a project.
If I run "mvn clean verify", the project builds without issue. If I run
"mvn clean verify deploy", the project fails to build (on the very last
module, naturally).
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-jar-plugin:3.0.0:jar
(default-jar) on project io7m-jsx-tests: You have to use a classifier to
attach supplemental artifacts to the project instead of replacing them. ->
[Help 1]
I am not attaching supplemental artifacts in that module, and am also not
replacing any.
https://github.com/io7m/jsx/tree/develop
http://ataxia.io7m.com/2016/08/05/build.txt
Note that there are no sources in src/main as this is a module containing
the unit tests for all other modules. However, this has not been a problem
to date and have used this arrangement without issue in some 40 or so
projects. Today, it suddenly appears to be a problem.
Is this a bug? Is there anything I can do to fix it?
M
o***@io7m.com
2016-08-05 17:26:50 UTC
Permalink
On 2016-08-05T18:48:25 +0200
Post by Anders Hammar
Executing
mvn verify deploy
will execute the build lifecycle twice. No need to do that. Just execute
mvn deploy
as the deploy phase comes after the verify phase.
On 2016-08-05T18:09:46 +0100
Post by Anders Hammar
TL;DR don't run `mvn clean verify deploy` run `mvn clean deploy` as
`deploy` is after `verify`
Thanks, both of you!

After some five years of using Maven daily, I had no idea that it
didn't eliminate redundant lifecycle calls in that manner... Always
something new.

M
Christopher
2016-08-06 16:42:14 UTC
Permalink
Post by o***@io7m.com
On 2016-08-05T18:48:25 +0200
Post by Anders Hammar
Executing
mvn verify deploy
will execute the build lifecycle twice. No need to do that. Just execute
mvn deploy
as the deploy phase comes after the verify phase.
On 2016-08-05T18:09:46 +0100
Post by Anders Hammar
TL;DR don't run `mvn clean verify deploy` run `mvn clean deploy` as
`deploy` is after `verify`
Thanks, both of you!
After some five years of using Maven daily, I had no idea that it
didn't eliminate redundant lifecycle calls in that manner... Always
something new.
M
It's not necessarily redundant. Sometimes there's good reason to execute
things twice. :)

I recommend all maven users periodically re-read
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Most important information for understanding maven is on that single page
IMO. Don't think it gives an explicit example of this kind of double
execution, but it gives enough information to be able to infer that
behavior.
Stephen Connolly
2016-08-05 17:09:06 UTC
Permalink
So you have asked maven to, in sequence:

1. Run the clean lifecycle up to the phase `clean`
2. Run the default lifecycle up to the phase `verify`
3. Run the default lifecycle *again* up to the phase `deploy`

That will run everything between `initialize` and `verify` twice...

If that's what you want then that's what you'll get
Post by o***@io7m.com
Hello.
I've run into a bizarre problem when trying to deploy a project.
If I run "mvn clean verify", the project builds without issue. If I run
"mvn clean verify deploy", the project fails to build (on the very last
module, naturally).
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.0:jar
(default-jar) on project io7m-jsx-tests: You have to use a classifier to
attach supplemental artifacts to the project instead of replacing them. ->
[Help 1]
I am not attaching supplemental artifacts in that module, and am also not
replacing any.
https://github.com/io7m/jsx/tree/develop
http://ataxia.io7m.com/2016/08/05/build.txt
Note that there are no sources in src/main as this is a module containing
the unit tests for all other modules. However, this has not been a problem
to date and have used this arrangement without issue in some 40 or so
projects. Today, it suddenly appears to be a problem.
Is this a bug? Is there anything I can do to fix it?
M
Stephen Connolly
2016-08-05 17:09:46 UTC
Permalink
TL;DR don't run `mvn clean verify deploy` run `mvn clean deploy` as
`deploy` is after `verify`
Post by Stephen Connolly
1. Run the clean lifecycle up to the phase `clean`
2. Run the default lifecycle up to the phase `verify`
3. Run the default lifecycle *again* up to the phase `deploy`
That will run everything between `initialize` and `verify` twice...
If that's what you want then that's what you'll get
Post by o***@io7m.com
Hello.
I've run into a bizarre problem when trying to deploy a project.
If I run "mvn clean verify", the project builds without issue. If I run
"mvn clean verify deploy", the project fails to build (on the very last
module, naturally).
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.0.0:jar
(default-jar) on project io7m-jsx-tests: You have to use a classifier to
attach supplemental artifacts to the project instead of replacing them. ->
[Help 1]
I am not attaching supplemental artifacts in that module, and am also not
replacing any.
https://github.com/io7m/jsx/tree/develop
http://ataxia.io7m.com/2016/08/05/build.txt
Note that there are no sources in src/main as this is a module containing
the unit tests for all other modules. However, this has not been a problem
to date and have used this arrangement without issue in some 40 or so
projects. Today, it suddenly appears to be a problem.
Is this a bug? Is there anything I can do to fix it?
M
Loading...