You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by or...@io7m.com on 2016/08/05 15:19:05 UTC

"mvn clean verify deploy" causes jar plugin to execute twice

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

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by or...@io7m.com.
On 2016-08-05T15:19:05 +0000
org.apache.maven.user@io7m.com wrote:
> 
> 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

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by Stephen Connolly <st...@gmail.com>.
TL;DR don't run `mvn clean verify deploy` run `mvn clean deploy` as
`deploy` is after `verify`

On 5 August 2016 at 18:09, Stephen Connolly <stephen.alan.connolly@gmail.com
> wrote:

> 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
>
> On 5 August 2016 at 16:19, <or...@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
>>
>
>

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by Stephen Connolly <st...@gmail.com>.
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

On 5 August 2016 at 16:19, <or...@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
>

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by Stephen Connolly <st...@gmail.com>.
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

On 5 August 2016 at 17:48, Anders Hammar <an...@hammar.net> wrote:

> 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, <or...@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
>

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by Christopher <ct...@apache.org>.
On Fri, Aug 5, 2016, 13:27 <or...@io7m.com> wrote:

> On 2016-08-05T18:48:25 +0200
> Anders Hammar <an...@hammar.net> wrote:
> >
> > 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
> Stephen Connolly <st...@gmail.com> wrote:
> >
> > 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.

>

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by or...@io7m.com.
On 2016-08-05T18:48:25 +0200
Anders Hammar <an...@hammar.net> wrote:
>
> 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
Stephen Connolly <st...@gmail.com> wrote:
>
> 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

Re: "mvn clean verify deploy" causes jar plugin to execute twice

Posted by Anders Hammar <an...@hammar.net>.
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, <or...@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