I need to create war for my spring framework project using maven(pom.xml) mvn clean install command. My Project SpringMVC folder contains jsp and src folder all folder in src is creating inside the web-inf but i need to create jsp and other folder outside web-inf.
pom.xml build tag code
<build>
<finalName>SpringMVC</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>resource2</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
In war file jsp folder not creating near web-inf. I don't know what else to try.
My Expected Output Folder Structure
SpringMVC.war
|-- META-INF
| |-- MANIFEST.MF
| `-- maven
| `-- com.example.projects
| `-- documentedproject
| |-- pom.properties
| `-- pom.xml
|-- WEB-INF
| |-- classes
| | |-- com
| | | `-- example
| | | `-- projects
| | | `-- SampleAction.class
| | `-- images
| | `-- sampleimage.jpg
| `-- web.xml
|-- external-resource.jpg
|-- image2
| `-- external-resource2.jpg
|-- index.jsp
`-- jsp
`-- websource.jsp
Need to use maven-antrun-plugin for creating directory and copying files.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-locator</id>
<phase>process-sources</phase>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}/${project.version}/jsp" />
<copy todir="${project.build.directory}/${project.version}/jsp">
<fileset dir="${project.build.directory}/${project.build.finalName}/jsp" />
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>