Hi Praveen,

Thanks for the reply. I don't want to add a new task to the process, just
something to be executed with the compile phase. I saw the link that you
referred in your reply and it's pretty much what I am doing (the basic
idea). All I am trying to do, for start, is to display some  messages in the
console during compile phase, using ant plugin. 

Also, I saw, in the link you referred, that there were some dependencies
defined inside the ant plugin. I modified my pom file to refer also those
dependencies. Unfortunately the result was the same regardless.

I've tried to invoke the pom file with the following commands:

C:\projects\generatedWarFile>mvn -e compile
C:\projects\generatedWarFile>mvn -e
org.apache.maven.plugins:maven-antrun-plugin:run
C:\projects\generatedWarFile>mvn -e
org.apache.maven.plugins:maven-antrun-plugin:compile

After the last command I got an error that goal "compile" was not found:

+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Required goal not found:
org.apache.maven.plugins:maven-antrun-plugin:compile
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Required goal not found:
org.apache.maven.plugins:maven-antrun-plugin:compile 
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1538)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:386)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:138)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO]
------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Nov 27 10:39:16 EST 2008
[INFO] Final Memory: 1M/2M
[INFO]
------------------------------------------------------------------------


Here is my pom.file modified:

<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>myMavenTest</groupId>
        <artifactId>generatedWarFile</artifactId>
        <packaging>war</packaging>
        <name>generatedWarFile</name>
        <version>1.0</version>
        <description />
        <url></url>
        <dependencies>
                <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.13</version>
                </dependency>
                <dependency>
                        <groupId>antlr</groupId>
                        <artifactId>antlr</artifactId>
                        <version>2.7.2</version>
                </dependency>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>4.0</version>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>ant</groupId>
                        <artifactId>ant</artifactId>
                        <version>1.6.1</version>
                </dependency>
        </dependencies>
        <build>
                <pluginManagement>
                        <plugins>
                                <plugin>
                                        
<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-antrun-plugin</artifactId>
                                        <executions>
                                                <execution>
                                                        <id>compile</id>
                                                        <phase>compile</phase>
                                                        <configuration>
                                                                <tasks>
                                                                        <echo 
message="==============" />
                                                                        <echo 
message="Test" />
                                                                        <echo 
message="==============" />
                                                                </tasks>
                                                        </configuration>
                                                        <goals>
                                                                
<goal>compile</goal>
                                                        </goals>
                                                </execution>
                                        </executions>
                                        <dependencies>
                                                <dependency>
                                                        
<groupId>commons-net</groupId>
                                                        
<artifactId>commons-net</artifactId>
                                                        <version>1.4.1</version>
                                                </dependency>
                                                <dependency>
                                                        <groupId>ant</groupId>
                                                        
<artifactId>ant-commons-net</artifactId>
                                                        <version>1.6.5</version>
                                                </dependency>
                                                <dependency>
                                                        <groupId>ant</groupId>
                                                        
<artifactId>ant-nodeps</artifactId>
                                                        <version>1.6.5</version>
                                                </dependency>
                                        </dependencies>
                                </plugin>
                        </plugins>
                </pluginManagement>
                <resources>
                        <resource>
                                <directory>src/main/resources</directory>
                                <filtering>true</filtering>
                        </resource>
                </resources>
        </build>
        <repositories>
                <repository>
                        <id>internal</id>
                        <name>Local repository</name>
                        
<url>http://my-local-repository:8080/maven2/internal</url>
                </repository>
        </repositories>
</project>


Thank you,
Cristian



Durbha, Praveen (GE Healthcare) wrote:
> 
> Try this..
> 
> http://maven.apache.org/plugins/maven-antrun-plugin/examples/customTasks
> .html 
> 

-- 
View this message in context: 
http://n2.nabble.com/maven-antrun-plugin-tp1583057p1585638.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