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";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>shai.test</groupId>
    <artifactId>a1</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>a1</name>
    <packaging>pom</packaging>
    <modules>
        <module>common</module>
        <module>feeder</module>
        <module>processor</module>
    </modules>
    <dependencies>
        <dependency>
            <groupId>bases</groupId>
            <artifactId>openbaces</artifactId>
            <version>6.5-m11-2329-457</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>2.5.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <defaultGoal>package</defaultGoal>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-openbases-plugin</artifactId>
                <version>6.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";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>shai.test</groupId>
    <artifactId>processor</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>processor</name>
    <url>http://maven.apache.org</url>
    <parent>
        <groupId>shai.test</groupId>
        <artifactId>a1</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <properties>
        <gsType>PU</gsType>
        <order>1</order>
    </properties>
    <dependencies>
        <dependency>
            <groupId>shai.test</groupId>
            <artifactId>common</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>a1-processor</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <attach>false</attach>
                   
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
                    <descriptors>
                       
<descriptor>src/main/assembly/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</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";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-opensbases-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>6.5-m11-2329-457</version>
    <name>maven-openbases-plugin</name>
    <url>http://maven.apache.org</url>
    <properties>
        <gsVersion>6.5-m11-2329-457</gsVersion>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>bases</groupId>
            <artifactId>openbases</artifactId>
            <version>6.5-m11-2329-457</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-project</artifactId>
            <version>2.0</version>
        </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.launch</include>
                    <include>**/*.xml</include>
                    <include>**/*.java</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <!-- Enable the prefix 'os' for the plugin -->
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <goalPrefix>os</goalPrefix>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.4</source>
                    <target>1.4</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

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-the-execution-of-a-phase-before-a-goal-tp16005279s177p17061820.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]

Reply via email to