2010-01-17

How to change the Maven directory structure for compatibility with MyEclipse web projects

In order to change the default Maven directory structure to the typical structure of MyEclipse web projects change the Maven configuration file (pom.xml) like follows:


<build>
<sourcedirectory>${basedir}/src</sourcedirectory>
<outputdirectory>${basedir}/WebRoot/WEB-INF/classes</outputdirectory>
<resources>
<resource>
<directory>${basedir}/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactid>maven-war-plugin</artifactid>
<configuration>
<webappdirectory>${basedir}/WebRoot</webappdirectory>
<warsourcedirectory>${basedir}/WebRoot</warsourcedirectory>
</configuration>
</plugin>


This does not take into account special resources directories, but they can easily be added by the resources element.

No comments:

Post a Comment