I have been trying to convert a web project that produces a war file to maven. my existing project structure is as follows -
MyWebProject | -- WEB-INF/src - contains a bunch of packages like com.myweb.client, com.myweb.server etc -- WEB-INF/test - contains 1 package com.myweb.tests -- web-scripts - contains bunch of scripts (just a folder; not on classpath) -- misc-files1 - contains misc files sets 1 -- misc-files2 - similar to above
presently a war file is being created using ant script with the resulting war file structure as follows
myweb.war - Meta-INF (only contains MANIFEST.MF) - WEB-INF - classes - com.myweb.client - com.myweb.server etc. - web-scripts - misc-files1 - misc-files2
i created a basic maven project using simple-artifact and added my packages. i am using maven assembly plugin to generate the war file and using filesets to filter. but my resultant war file is no where close to what i get with ant. here is a shortened version of my assembly.xml file
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>assembler</id>
<formats>
<format>war</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet/>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/main/java</directory>
<outputDirectory>WEB-INF</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet>
<directory>es</directory>
<outputDirectory>resources1</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet>
<directory>resources2</directory>
<outputDirectory>resources2</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
<fileSet>
<fileSet>
<directory>test</directory>
<outputDirectory>WEB-INF</outputDirectory>
<includes>
<include>**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
To create a custom war, is assembly plugin the right approach. I can always include my ant script in pom using maven-antrun-plugin, but i want to avoid using ant if possible. any suggestions.