我需要使用maven(pom.xml) mvn干净安装命令为我的spring框架项目创建war。我的项目SpringMVC文件夹包含jsp和src文件夹,src中的所有文件夹都是在web内创建的,但是我需要在web之外创建jsp和其他文件夹。
pom.xml生成标记代码
<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>在war文件中,jsp文件夹中没有创建近web-inf。我不知道还能尝试什么。
我的预期输出文件夹结构
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发布于 2014-03-03 09:46:07
需要使用maven-antrun插件来创建目录和复制文件。
<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>发布于 2014-02-28 08:17:16
我想你把jsp放错了目录。
此文件夹中的jsp抵抗符是典型的。
\ROOT\src\main\webapp根目录是pom.xml抵抗的文件夹。
https://stackoverflow.com/questions/22089104
复制相似问题