[英]Directory not creating other than WEB-INF & META-INF in WAR using Maven pom.xml
I need to create war for my spring framework project using maven(pom.xml) mvn clean install command. 我需要使用maven(pom.xml)mvn clean install命令为我的spring框架项目创建战争。 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.
我的Project SpringMVC文件夹包含jsp和src文件夹,src中的所有文件夹都是在web-inf内创建的,但是我需要在web-inf之外创建jsp和其他文件夹。
pom.xml build tag code 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>
In war file jsp folder not creating near web-inf. 在war文件的jsp文件夹中,未在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
I think you put the jsp's in the wrong directory. 我认为您将jsp放在错误的目录中。
Typicaly the jsp resist in this folder 通常,此文件夹中的jsp抵抗
\ROOT\src\main\webapp
where ROOT is the folder where the pom.xml resist. 其中ROOT是pom.xml阻止的文件夹。
@see also: maven webapp to place jsps in /WEB-INF/jsp @另请参阅: maven webapp将jsps放在/ WEB-INF / jsp中
Need to use maven-antrun-plugin for creating directory and copying files. 需要使用maven-antrun-plugin创建目录和复制文件。
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.