I had old web application project. Then I added pom.xml
, and add maven-war-plugin
. In the old project sources were in "Java Resources/src"
directory.
In my maven-war plugin I trying overriding default source directorie like this, but not working.
during compilation i see: `
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ webproj ---
[INFO] No sources to compile
[INFO]
`
my pom.xml
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
<webappDirectory>WebContent</webappDirectory>
<source>${project.basedir}\src</source>
<target>${maven.compiler.target}</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
If you are planning to migrate to Maven, I suggest that you follow the Maven Standard Directory Layout. Consequently, you should move your source files to src/main/java
, static resources like .properties files to the src/main/resources
, and webapp resources like CSS and JavaScript files to src/main/webapp
.