gpt4 book ai didi

java - 如何覆盖 maven-war-plugin 源目录

转载 作者:搜寻专家 更新时间:2023-11-01 03:24:13 26 4
gpt4 key购买 nike

我有一个旧的 Web 应用程序项目。然后我添加了pom.xml,并添加了maven-war-plugin。在旧项目中,源代码位于 “Java Resources/src” 目录中。

在我的 maven-war 插件中,我尝试像这样覆盖默认源目录,但没有用。

在编译过程中我看到:`

[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ webproj ---
[INFO] No sources to compile
[INFO]

`

我的pom.xml:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
<webappDirectory>WebContent</webappDirectory>
<source>${project.basedir}\src</source>
<target>${maven.compiler.target}</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>

最佳答案

如果您打算迁移到 Maven,我建议您遵循 Maven Standard Directory Layout .因此,您应该将源文件移动到 src/main/java,将 .properties 文件等静态资源移动到 src/main/resources,将 webapp 资源(例如 CSS 和 JavaScript)移动文件到 src/main/webapp

关于java - 如何覆盖 maven-war-plugin 源目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19426530/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com