开发者

Can Maven (jar/war) packaging be avoided if there are no source file changes?

开发者 https://www.devze.com 2023-04-01 16:36 出处:网络
I would like to be able to intelligently decide whether a web application has changed开发者_Go百科 and needs to be redeployed, but can\'t determine an effective way of doing so with Maven2.

I would like to be able to intelligently decide whether a web application has changed开发者_Go百科 and needs to be redeployed, but can't determine an effective way of doing so with Maven2.

For a given Java web application Maven won't recompile unchanged source files, but it will always repackage the .war artifact, thereby updating its timestamp. With an updated timestamp, I have to assume the artifact represents an updated snapshot version.

Is it possible to have Maven avoid repackaging where no source files have changed and a previously packaged .war file is still present in the target folder? At the very least, is it possible to have Maven avoid overwriting the previously packaged .war file if no changes were found?


You can try the setting of the maven-war-plugin which is by default set to true (force). But be carefull and read the warnings about the force flag in the docs.

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
  <archive>
    <forced>false</forced>
  </archive>
</configuration>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号