Any plugin that declares @execute [phase] will cause the build to fork.
The dependency plugin does not, but one of your other plugins must. I
know that javadoc did, assembly does (depending on which goal),
enforcer:enforce-once does. Take a look at the various plugins you have
bound and see which one is forking the build. If it's in a parent pom,
it will fork the entire multi-module build.

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Steinar Bang
Sent: Wednesday, January 09, 2008 8:31 AM
To: users@maven.apache.org
Subject: Why do maven lifecycles fork?

Platform: maven-2.0.8, maven-dependency-plugin 2.0-alpha-4,
          maven-antrun-plugin 1.1, maven-jar-plugin 2.1

Why does maven lifecycles fork?  Ie. what makes them fork?

I have a setup where I use dependency:copy to pull in some files from
the maven repository, and put them under target/classes/.  I've put them
in <phase>generate-sources</phase>.

Then I've created an antrun:run task in <phase>process-sources</phase>
that moves some files to a new name.

What happens is that the dependency:copy is run twice, and sometimes
thrice in a "mvn install" (thrice if its run as part of a
multi-project).  I have no idea what makes it do that.

After the first copying it does an [antrun:run] to fix the file names,
and then a [jar:jar] with presumably the correct content.

Before the second execution of dependency:copy it says:
[WARNING] Removing: jar from forked lifecycle, to prevent recursive
invocation.

But it still does a [jar:jar] after the copying has been done again, and
creates a jar with both the copied in artifacts with their old name, and
their new names (since there is no [antrun:run] here, fixing the file
names before doing the jar, and the renamed artifacts from the previous
antrun:run are still present).

Before the third execution it says
[WARNING] Removing: jar from forked lifecycle, to prevent recursive
invocation.
[WARNING] Removing: test-jar from forked lifecycle, to prevent recursive
invocation.
and at the end of the copying it does another [jar:jar] but no
[antrun:run]

I have no idea what forks the lifecycles, and just a vague idea what it
means.  I have no idea why [jar:jar] is run, even though it says it's
not going to run it (actually it doesn't look like it's actually run
until after the last dependency:copy, but since the fixes have been
overwritten once or twice, that doesn't really matter).

I've tried putting the antrun:run in compile, process-test-sources, and
test, and still only one of the lifecycles use it.

I've put it in package, but then it's run after the jar:jar in the final
phase, which is too late (the jar has already been built).

I guess I could unzip the jar in the packaging phase, fix the contents
of the jar, and jar it up again in the antrun:run, but that really
sounds like a hack...?

Any other ideas are welcome...

Thanx!


- Steinar


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to