I am learning maven , though worked on ant in past.
I have am just trying to figure out what happens when command mvn install or mvn compile
is executed. I am mainly
interested how project is built like location of resources to pick for build and where to put them once built
My project source structure is
src > main > java > java files
src > main > resources > reources like spring config atc
src > main > webapp > static files like js,css etc
src > main > webapp > WEB-INF > web.xml and jsp files
Once i give mvn package or mvn clean i see below exploded directory(my focus is on this) with name myProject alongwith other files lile war, classes etc. Explode structure for myProject is
1) All files from (src > main > webapp) including WEB-INF gets copied under myProject
2) All files from (src > main > resources) gets copied under myProject > WEB-INF/Classes
3) All files from (src > main > java) gets copied under myProject > WEB-INF/Classes
As per my understanding when we give any of mvn install or mvn compile or mvn package all compile phases gets executed. But My question is how Maven know where to put the source file under exploded directory. Is it a standard maven follows?
Here is snippet for reference from pom.xml i am using
<artifactId>myProject</artifactId>
<packaging>war</packaging>
<name>myProject</name>
.....
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<overlays>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jslint</goal>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<aggregations>
</aggregations>
</configuration>
</plugin>
</plugins>
</build>