maven: war:war 即使内容不变也会重建 war - 为什么?

标签 maven war

当我尝试从 netbeans 构建 ear 项目时,为什么 maven ear 插件会运行 war:war(插件目标)

我的过程:

我右键单击 ear 项目(其中列出了 war 依赖项)并首先清理,然后右键单击它并选择 Build with Dependencies。然后它使用 war:war 再次建立 war ,这需要时间。即使 war 没有改变,但会重新创造它。

它是这样说的:

------------------------------------------------------------------------ Building finweb 1.0-SNAPSHOT ------------------------------------------------------------------------ The POM for org.netbeans.external:jdom-1.0:jar:RELEASE71 is missing, no dependency information available The POM for com.ibm:com.ibm.mq:jar:6.0.2.5 is missing, no dependency information available The POM for com.ibm:com.ibm.mqbind:jar:6.0.2.5 is missing, no dependency information available The POM for net.sf.saxon:saxon:jar:10.0-b19 is missing, no dependency information available

[dependency:copy]

[resources:resources] Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\Beta\fin\finweb\src\main\resources

[compiler:compile] Nothing to compile - all classes are up to date

[resources:testResources] Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\Beta\fin\finweb\src\test\resources

[compiler:testCompile] Nothing to compile - all classes are up to date

[surefire:test] No tests to run. Surefire report directory: C:\Beta\fin\finweb\target\surefire-reports

------------------------------------------------------- T E S T S ------------------------------------------------------- There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[war:war] Packaging webapp Assembling webapp [finweb] in [C:\Beta\fin\finweb\target\finweb-1.0-SNAPSHOT] Processing war project Copying webapp resources [C:\Beta\fin\finweb\src\main\webapp] Webapp assembled in [109467 msecs] Building war: C:\Beta\fin\finweb\target\finweb-1.0-SNAPSHOT.war WEB-INF\web.xml already added, skipping

[install:install] Installing C:\Beta\fin\finweb\target\finweb-1.0-SNAPSHOT.war to C:\Documents and Settings.m2\repository\com\comp\finweb\1.0-SNAPSHOT\finweb-1.0-SNAPSHOT.war Installing C:\Beta\fin\finweb\pom.xml to C:\Documents and Settings\5510041.m2\repository\com\comp\finweb\1.0-SNAPSHOT\finweb-1.0-SNAPSHOT.pom

因此,如果没有什么可编译的,如果它已经编译并且没有任何更改,为什么还要再次构建 war 。这是默认行为吗,看看 compile : compile when it doesn't compile if then does nothing needed 那么为什么 war:war 会这样做,它应该很聪明地做到这一点?

如果我说错了请指正

提前致谢..

赛义德。

最佳答案

这可能被视为解决方法。
以下配置将加快您的构建时间。

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-war-plugin</artifactId>
 <version>2.4</version>
 <configuration>
  <useCache>true</useCache>
  <recompressZippedFiles>false</recompressZippedFiles>
 </configuration>
</plugin>

引用:https://maven.apache.org/plugins/maven-war-plugin/war-mojo.html

我也期待着从 maven 默认构建生命周期中跳过 war:war 阶段的简单方法。

关于maven: war:war 即使内容不变也会重建 war - 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9241304/

相关文章:

java - 有没有办法使用 Maven 将 git 存储库 checkout 到某个文件夹?

maven - 使用 IntelliJ IDEA 运行 mvn 命令

java - 找不到依赖项的合格 bean - Java

java - 使用 JBoss 部署 REST 服务时出现的问题

maven - 在 STS - spring 工具套件中,war 文件未显示添加到 tomcat 中?

java - FindBugs Ant 任务是否需要 JAR?

java - 在没有 maven 的情况下启动 jetty 的可执行 war 文件

maven - 运行 mvn 服务器时出现错误

java - MVN包安装错误javac : invalid target release: 1. 8

linux - 如何配置 vim 以打开 zip 文件?