RE: Forcing the execution of a phase before a goal

2008-05-06 Thread Brian E. Fox
Adding @aggregator to you mojo annotations should do what you want.

-Original Message-
From: carioca [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 05, 2008 9:49 AM
To: users@maven.apache.org
Subject: RE: Forcing the execution of a phase before a goal


Hi Brian,

Thank you for the help.

Attached below are the POMs of my project.

Just to clarify, this is what I am trying to do. 

I run my Mojo the following way:

mvn os:run

In that point I am in the directory of the master project (POM
packaging).
(The project dosn't need to be packaged before that.)

My Mojo needs to have all it's dependencies it the classpath.
In order to do so, I am trying to invoke the compile phase before my
Mojo is
executed by adding the annotation:
@execute phase=test-compile

What I expect is that the multi-module project will be compiled and my
Mojo
will be invoked right after it.
This is simillar to invoking 'mvn compile os:run' (which does work).

The problem is that because this is a POM project no goals are binded to
it
and I get the message:
No goals needed for project - skipping

So the compilation doesn't happen and the classpath is not populated
with
the dependencies.




This is the pom of the master project:

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;
modelVersion4.0.0/modelVersion
groupIdshai.test/groupId
artifactIda1/artifactId
version1.0-SNAPSHOT/version
namea1/name
packagingpom/packaging
modules
modulecommon/module
modulefeeder/module
moduleprocessor/module
/modules
dependencies
dependency
groupIdbases/groupId
artifactIdopenbaces/artifactId
version6.5-m11-2329-457/version
scopeprovided/scope
/dependency
dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
version4.4/version
scopetest/scope
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-test/artifactId
version2.5.3/version
scopetest/scope
/dependency
/dependencies
build
defaultGoalpackage/defaultGoal
testResources
testResource
directorysrc/test/java/directory
includes
include**/*.xml/include
/includes
/testResource
/testResources
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-assembly-plugin/artifactId
version2.2-beta-2/version
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-openbases-plugin/artifactId
version6.5-m11-2329-457/version
/plugin
/plugins
/build
/project

This is the pom of the processor sub-module:

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;
modelVersion4.0.0/modelVersion
groupIdshai.test/groupId
artifactIdprocessor/artifactId
packagingjar/packaging
version1.0-SNAPSHOT/version
nameprocessor/name
urlhttp://maven.apache.org/url
parent
groupIdshai.test/groupId
artifactIda1/artifactId
version1.0-SNAPSHOT/version
/parent
properties
gsTypePU/gsType
order1/order
/properties
dependencies
dependency
groupIdshai.test/groupId
artifactIdcommon/artifactId
version1.0-SNAPSHOT/version
scopecompile/scope
/dependency
/dependencies
build
finalNamea1-processor/finalName
plugins
plugin
artifactIdmaven-assembly-plugin/artifactId
configuration
appendAssemblyIdfalse/appendAssemblyId
attachfalse/attach
   
ignoreDirFormatExtensionstrue/ignoreDirFormatExtensions
descriptors
   
descriptorsrc/main/assembly/assembly.xml/descriptor
/descriptors
/configuration
executions
execution
idassembly/id
phasepackage/phase
goals
goalsingle/goal
/goals
  

RE: Forcing the execution of a phase before a goal

2008-05-05 Thread carioca

Hi Brian,

Thank you for the help.

Attached below are the POMs of my project.

Just to clarify, this is what I am trying to do. 

I run my Mojo the following way:

mvn os:run

In that point I am in the directory of the master project (POM packaging).
(The project dosn't need to be packaged before that.)

My Mojo needs to have all it's dependencies it the classpath.
In order to do so, I am trying to invoke the compile phase before my Mojo is
executed by adding the annotation:
@execute phase=test-compile

What I expect is that the multi-module project will be compiled and my Mojo
will be invoked right after it.
This is simillar to invoking 'mvn compile os:run' (which does work).

The problem is that because this is a POM project no goals are binded to it
and I get the message:
No goals needed for project - skipping

So the compilation doesn't happen and the classpath is not populated with
the dependencies.




This is the pom of the master project:

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;
modelVersion4.0.0/modelVersion
groupIdshai.test/groupId
artifactIda1/artifactId
version1.0-SNAPSHOT/version
namea1/name
packagingpom/packaging
modules
modulecommon/module
modulefeeder/module
moduleprocessor/module
/modules
dependencies
dependency
groupIdbases/groupId
artifactIdopenbaces/artifactId
version6.5-m11-2329-457/version
scopeprovided/scope
/dependency
dependency
groupIdjunit/groupId
artifactIdjunit/artifactId
version4.4/version
scopetest/scope
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-test/artifactId
version2.5.3/version
scopetest/scope
/dependency
/dependencies
build
defaultGoalpackage/defaultGoal
testResources
testResource
directorysrc/test/java/directory
includes
include**/*.xml/include
/includes
/testResource
/testResources
plugins
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source1.5/source
target1.5/target
/configuration
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-assembly-plugin/artifactId
version2.2-beta-2/version
/plugin
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-openbases-plugin/artifactId
version6.5-m11-2329-457/version
/plugin
/plugins
/build
/project

This is the pom of the processor sub-module:

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd;
modelVersion4.0.0/modelVersion
groupIdshai.test/groupId
artifactIdprocessor/artifactId
packagingjar/packaging
version1.0-SNAPSHOT/version
nameprocessor/name
urlhttp://maven.apache.org/url
parent
groupIdshai.test/groupId
artifactIda1/artifactId
version1.0-SNAPSHOT/version
/parent
properties
gsTypePU/gsType
order1/order
/properties
dependencies
dependency
groupIdshai.test/groupId
artifactIdcommon/artifactId
version1.0-SNAPSHOT/version
scopecompile/scope
/dependency
/dependencies
build
finalNamea1-processor/finalName
plugins
plugin
artifactIdmaven-assembly-plugin/artifactId
configuration
appendAssemblyIdfalse/appendAssemblyId
attachfalse/attach
   
ignoreDirFormatExtensionstrue/ignoreDirFormatExtensions
descriptors
   
descriptorsrc/main/assembly/assembly.xml/descriptor
/descriptors
/configuration
executions
execution
idassembly/id
phasepackage/phase
goals
goalsingle/goal
/goals
/execution
/executions
/plugin
/plugins
/build
/project


This is the pom of the plugin:

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 

Re: Forcing the execution of a phase before a goal

2008-05-04 Thread carioca

Hi,

I am still looking for a solution to this problem. Can anyone help?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp16005279s177p17046880.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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



Re: Forcing the execution of a phase before a goal

2008-05-04 Thread carioca

Hi,

I am still looking for a solution to this problem. Can anyone help?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp16005279s177p17047261.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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



Re: Forcing the execution of a phase before a goal

2008-05-04 Thread Tim Kettler

Hi carioca,

A maven build consists of a lifecycle. A lifecycle is defined by an 
ordered list of phases (like compile, test, install ...) each phase 
execution includes the execution of all other phases before it. And 
finally there are goals that are bound to a specific phase of the 
lifecycle. See here [1] or here [2] for a more comprehensive description.


So what you can do is bind the goal in question to the phase just after 
the phase that should be executed before the goal.


Hope that helps

-Tim

[1] 
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

[2]
http://www.sonatype.com/book/reference/simple-project.html#section-simple-core

carioca schrieb:

Hi,

I am still looking for a solution to this problem. Can anyone help?

Thanks.



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



RE: Forcing the execution of a phase before a goal

2008-05-04 Thread Brian E. Fox
Can you include your poms to take a look at? I went back to see your
original message and it looks like you're on the right track, but
without seeing the whole picture it's hard to say why it's not working.

-Original Message-
From: carioca [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 04, 2008 10:51 AM
To: users@maven.apache.org
Subject: Re: Forcing the execution of a phase before a goal


Hi,

I am still looking for a solution to this problem. Can anyone help?

Thanks.
-- 
View this message in context:
http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp1
6005279s177p17047261.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
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]



RE: Forcing the execution of a phase before a goal

2008-03-17 Thread carioca

Yes, that's what I mean.

I expected the pom project to iterate through the modules and compile them,
and then invoke my Mojo.

I get the required results when I run:
mvn compile my-goal

It compiles the modules and then invoke the Mojo, but this is not the way I
want to do it.

Shai


Brian E Fox wrote:
 
 Compile won't actually do anything in a pom project, but usually you
 have a pom project at the top of some tree and maven iterates though the
 modules listed in said pom project and invokes the build on those. Is
 that what you mean?
 
 -Original Message-
 From: carioca [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, March 16, 2008 5:19 AM
 To: users@maven.apache.org
 Subject: Re: Forcing the execution of a phase before a goal
 
 
 Hi Stephen,
 
 Thank you for the reply.
 
 The only annotation that seems to do what you claim
 @requires-phase=compile
 does is @execute phase=compile. I am using this annotation and it
 seems
 to invoke the build lifecycle, but when running this in the master
 project I
 get the message:
 
 No goals needed for project - skipping
 
 In my opinion the lifecycle is started but no goals are configured for
 projects of type pom.
 I wonder what this means, because invoking mvn compile does compile
 the
 project.
 
 Does anyone have an idea?
 
 Shai
 -- 
 View this message in context:
 http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp1
 6005279s177p16077011.html
 Sent from the Maven - Users mailing list archive at Nabble.com.
 
 
 -
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp16005279s177p16090084.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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



Re: Forcing the execution of a phase before a goal

2008-03-16 Thread carioca

Hi Stephen,

Thank you for the reply.

The only annotation that seems to do what you claim @requires-phase=compile
does is @execute phase=compile. I am using this annotation and it seems
to invoke the build lifecycle, but when running this in the master project I
get the message:

No goals needed for project - skipping

In my opinion the lifecycle is started but no goals are configured for
projects of type pom.
I wonder what this means, because invoking mvn compile does compile the
project.

Does anyone have an idea?

Shai
-- 
View this message in context: 
http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp16005279s177p16077011.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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



RE: Forcing the execution of a phase before a goal

2008-03-16 Thread Brian E. Fox
Compile won't actually do anything in a pom project, but usually you
have a pom project at the top of some tree and maven iterates though the
modules listed in said pom project and invokes the build on those. Is
that what you mean?

-Original Message-
From: carioca [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 16, 2008 5:19 AM
To: users@maven.apache.org
Subject: Re: Forcing the execution of a phase before a goal


Hi Stephen,

Thank you for the reply.

The only annotation that seems to do what you claim
@requires-phase=compile
does is @execute phase=compile. I am using this annotation and it
seems
to invoke the build lifecycle, but when running this in the master
project I
get the message:

No goals needed for project - skipping

In my opinion the lifecycle is started but no goals are configured for
projects of type pom.
I wonder what this means, because invoking mvn compile does compile
the
project.

Does anyone have an idea?

Shai
-- 
View this message in context:
http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp1
6005279s177p16077011.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
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]



Re: Forcing the execution of a phase before a goal

2008-03-12 Thread Stephen Connolly
I think you need an annotation something like @requires-phase=compile

I just cannot remember the exact annotation you require.

Also don't do this in conjunction with @aggregator!

-Stephen

On Wed, Mar 12, 2008 at 3:52 PM, carioca [EMAIL PROTECTED] wrote:


 Hi,

 In my plugin I have a goal that is invoked manually:

 mvn os:my-goal

 The goal is invoked from the master project directory of a multi module
 project.
 I would like to force the compile phase before my goal is invoked.
 It should be like invoking the following command line:

 mvn compile os:my-goal // this works

 In order to do that I added the following annotation to the goal's Mojo:

 /**
  * @goal my-goal
  * @execute phase=test-compile
  */

 This suppose to force the execution of the lifecycle untill the
 test-compile
 phase before the Mojo is executed.
 It works when running the goal from a sub module with packaging=jar; It
 doesn't work when invoking the goal from the master project directory
 (packaging=pom).

 Instead I get the following message:

 No goals needed for project - skipping

 and my goal is invoked immediatelly.

 I guess I'm doing something wrong.
 Can anyone help?

 Thanks,
 Shai
 --
 View this message in context:
 http://www.nabble.com/Forcing-the-execution-of-a-phase-before-a-goal-tp16005279s177p16005279.html
 Sent from the Maven - Users mailing list archive at Nabble.com.


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