Don't consider Maven as a scripting engine Maven works based on conventions, and plugins use them to avoid configuration and scripting
Don't try to override conventions as you do in compiler, war plugin. Follow them and discover how the plugins can naturaly run in your build without anything to configure. Move your java source folder at "src/main/java" Move your web application descriptor at src/main/webapp/WEB-INF remove all your configuration stuff, especially your antrun attempt to script the build just run "mvn install" you will get a packaged WAR you can deploy on tomcat, you can also configure your local tomcat instance to use the exploded war at target/youratifact-version Good luck with Maven (I just suggest you to take few minutes and read a good introduction to maven to better understand its principles) Nicolas 2011/2/23 Fuke, Amol <[email protected]> > Hi All, > > > > I have ant build file and now need to convert it into mvn pom file. My > problem is how do I get my code compiled using pom.xml. > > > > I have below pom xml; > > *** > > <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>com.nielsen.outbound</groupId> > > <artifactId>outbound</artifactId> > > <packaging>war</packaging> > > <version>1.0-SNAPSHOT</version> > > <name>outbound</name> > > <url>http://maven.apache.org</url> > > <dependencies> > > <dependency> > > <groupId>junit</groupId> > > <artifactId>junit</artifactId> > > <version>3.8.1</version> > > <scope>test</scope> > > </dependency> > > </dependencies> > > <build> > > <plugins> > > <plugin> > > <groupId>org.apache.maven.plugins</groupId> > > <artifactId>maven-compiler-plugin</artifactId> > > <configuration> > > > <source>src/com/nielsen/outbound/*.java</source> > > <target>target/classes</target> > > </configuration> > > </plugin> > > <plugin> > > <groupId>org.apache.maven.plugins</groupId> > > <artifactId>maven-war-plugin</artifactId> > > <configuration> > > <webXml>conf/web.xml</webXml> > > > <webappDirectory>target/work/outbound.war</webappDirectory> > > </configuration> > > </plugin> > > <plugin> > > <groupId>org.apache.maven.plugins</groupId> > > <artifactId>maven-antrun-plugin</artifactId> > > <executions> > > <execution> > > <phase>compile</phase> > > <configuration> > > <tasks> > > <echo>Deleting > deployment..</echo> > > <delete > includeEmptyDirs="true" > > > dir="C:/Tomcat6/webapps/outbound" /> > > <mkdir > dir="C:/Tomcat6/webapps/outbound" /> > > </tasks> > > </configuration> > > <goals> > > <goal>run</goal> > > </goals> > > </execution> > > <execution> > > <phase>compile</phase> > > <id>copy-resources2classes</id> > > <configuration> > > <tasks> > > <echo>Copying resources > to WEB-INF/classes..</echo> > > <copy todir="src" > > > <fileset > dir="target/classes" > > > <include > name="**/*.properties" /> > > <include > name="**/*.*" /> > > </fileset> > > </copy> > > </tasks> > > </configuration> > > <goals> > > <goal>run</goal> > > </goals> > > </execution> > > </executions> > > </plugin> > > </plugins> > > </build> > > </project> > > ** > > > > Can you please help me ? > > > > Thanks, > > Amol Fuke > > > >
