请参见https://maven.apache.org/plugins/maven-war-plugin/usage.html https://maven.apache.org/plugins/maven-war-plugin/usage.html
看起来像你的META-INF
文件夹位于src/main/resources
目录。
通常在创建时WAR
你会创建一个目录src/main/webapp
在那里你可以拥有你的WEB-INF
, META-INF
以及其他所需的文件夹。
|-- src
| `-- main
| |-- java
| | `-- com
| | `-- example
| | `-- projects
| | `-- SampleAction.java
| |-- resources
| | `-- images
| `-- webapp
| |-- META-INF
| |-- WEB-INF
一切都从你的webapp
文件夹将被复制到根目录WAR
.
通往你的道路webapp
也可以使用配置战争源目录财产
对于您的场景 - 生成的源
显然您不想将生成的源保留在您的src/*
文件夹并且不想对其进行版本控制。
您可以通过向版本控制元数据添加忽略过滤器来解决此问题;或通过创建符号链接;或使用copy-resources
正如之前的一些答案所说,但不推荐。
您可以通过添加一个来实现这一点webResources
配置来复制生成的源target
文件夹按
请参见http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${project.build.directory}/target/generated-sources</directory>
<targetPath>META-INF</targetPath> <!-- introduced in plugin v 2.1 -->
<includes>
<include>*.class</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>