Hello, I am trying to convert an ant script into a maven build and I am having trouble building my webapps folder.
My directory structure: src --main ------java ------resources ------webapp target --classes --jars webapps --default ----WEB-INF --------lib The ant script used to perform the following operations: 1. Compile all java code in src/main/java and output the result to target/classes. 2. Create a jar containing all classes in target/classes and placed that jar into the target/jars folder. 3. Checked out dependency jars from the maven repository into target/jars. 4. Copied src/main/webapp into webapps/default. 5. Copied target/jars into webapps/default/WEB-INF/lib I have written a maven script which does everything except steps 3, 4, and 5: 1. Same as ant step #1. 2. Same as ant step #2, but the jar is deposited into the root of the target directory and not the jars subfolder. 3. Maven script finishes. I am very confused about how to get maven to copy its output from the target folder into the webapps folders. Does anyone know of an equivalent for the ant copy task? If not, is there a better way to accomplish this in maven? So far, I have tried the following: - Added an <outputdirectory> tag nested inside <build> and specifying the webapps/default directory. This placed the Java class files in webapps, but it did not copy the src/main/webapp folder or use the JAR file of compiled classes. - Using the resource tag added files to the JAR, but did not allow me to perform my copy operations. - Using the maven-antrun-plugin did not work and maven simply ignored my ant statements. - I tried using the Magon wagon-file plugin, but I could not find much documentation about how to use it. I also couldn't see how to use relative paths with the plugin. Does anyone have any other suggestions? Thanks! For reference, here is my pom.xml file: <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.myCompany</groupId> <artifactId>application</artifactId> <packaging>jar</packaging> <name>application</name> <version>1.0</version> <build> <!-- Failed attempt to use the outputdirectory tag: <outputDirectory>webapps/default</outputDirectory> Result: placed contents in webapps/default instead of target; did not exclude .class files; did not copy src/main/webapp to webapps/default/ Is it possible to have multiple outputDirectory tags for each resource? --> <defaultGoal>package</defaultGoal> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <!-- Failed attempt to use ant --> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>build</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <copy todir="webapps/default" preservelastmodified="true"> <fileset dir="src/main/webapp"/> </copy> <copy todir="webapps/default/WEB-INF/lib" preservelastmodified="true"> <fileset dir="target/jars"/> </copy> </tasks> </configuration> </execution> </executions> </plugin> </plugins> <!-- Failed attempt to use resources tag --> <!-- Placed all contents in the JAR file and did not populate dependency JARs --> <!-- <resources> <resource> <directory>src/main/webapp</directory> <includes><include>**/*.*</include></includes> </resource> <resource> <directory>target/jars</directory> <includes><include>**/*.*</include></includes> </resource> </resources> --> </build> </project> <!-- Note: Dependencies were omitted to save space. --> -- View this message in context: http://www.nabble.com/Copy-Task-in-Maven-2-tp19209588p19209588.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]
