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:

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";>
4.0.0
shai.test
a1
1.0-SNAPSHOT
a1
pom

common
feeder
processor



bases
openbaces
6.5-m11-2329-457
provided


junit
junit
4.4
test


org.springframework
spring-test
2.5.3
test



package


src/test/java

**/*.xml





org.apache.maven.plugins
maven-compiler-plugin

1.5
1.5



org.apache.maven.plugins
maven-assembly-plugin
2.2-beta-2


org.apache.maven.plugins
maven-openbases-plugin
6.5-m11-2329-457





This is the pom of the processor sub-module:

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";>
4.0.0
shai.test
processor
jar
1.0-SNAPSHOT
processor
http://maven.apache.org

shai.test
a1
1.0-SNAPSHOT


PU
1



shai.test
common
1.0-SNAPSHOT
compile



a1-processor


maven-assembly-plugin

false
false
   
true

   
src/main/assembly/assembly.xml




assembly
package

single









This is the pom of the plugin:

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";>
4.0.0
org.apache.maven.plugins
maven-opensbases-plugin
maven-plugin
6.5-m11-2329-457
maven-openbases-plugin
http://maven.apache.org

6.5-m11-2329-457



org.apache.maven
maven-plugin-api
2.0


bases
openbases
6.5-m11-2329-457
compile


org.apache.maven
maven-project
2.0





src/main/resources
true

**/*.launch
**/*.xml
**/*.java






maven-plugin-plugin

os



org.apache.maven.plugins
maven-compiler-plugin

1.4
1.4

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:

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";>
4.0.0
shai.test
a1
1.0-SNAPSHOT
a1
pom

common
feeder
processor



bases
openbaces
6.5-m11-2329-457
provided


junit
junit
4.4
test


org.springframework
spring-test
2.5.3
test



package


src/test/java

**/*.xml





org.apache.maven.plugins
maven-compiler-plugin

1.5
1.5



org.apache.maven.plugins
maven-assembly-plugin
2.2-beta-2


org.apache.maven.plugins
maven-openbases-plugin
6.5-m11-2329-457





This is the pom of the processor sub-module:

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";>
4.0.0
shai.test
processor
jar
1.0-SNAPSHOT
processor
http://maven.apache.org

shai.test
a1
1.0-SNAPSHOT


PU
1



shai.test
common
1.0-SNAPSHOT
compile



a1-processor


maven-assembly-plugin

false
false
   
true

   
src/main/assembly/assembly.xml




assembly
package

single









This is the pom of the plugin:

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";>
4.0.0
org.apache.maven.plugins
maven-opensbases-plugin
maven-plugin
6.5-m11-2329-457
maven-openbases-plugin
http://maven.apache.org

6.5-m11-2329-457



org.apache.maven
maven-plugin-api
2.0


bases
openbases
6.5-m11-2329-457
compile


org.apache.maven
maven-project
2.0





src/main/resources
true

**/*.launch
**/*.xml
**/*.java






maven-plugin-plugin

os



org.apache.maven.plugins
maven-compiler-plugin

1.4
1.4






This is the Mojo's code:

/**
 * Goal that writes to the log.
 *
 * @goal run
 * 
 * @description Runs ...
 */
public class RunMojo extends AbstractMojo {

 public void execute() throws MojoExecutionException,
MojoFailureException {
 getLog().info("Hello!");
 }

}
-- 
View this message in context: 
http://www.nabble.com/Forcing-

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-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 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 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-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="". 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 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="". 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-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="". 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-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]
>
>