Only generate one war during package

让人想犯罪 __ 提交于 2019-12-24 05:05:18

问题


By default JHipster generate 2 wars during the package phase (your_project_version.war & your_project_version.war.original). The first one is the executable jar and the second is the war you can use in a servlet container.

Is there a way to only generate the 'original' war. The executable is not required for my project and I would like to deploy the war to Nexus.


回答1:


jhipster generated project will make use of spring-boot, and in particular of the spring-boot-maven-plugin, which by default binds the repackage goal to the package lifecycle phase. If you want to disable the repackaging, it should be enough to edit your pomfile, so that no execution is present for the repackage goal (by setting the bound phase to none):

<plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   <executions>
      <execution>
        <goals>
          <goal>repackage</goal>
        </goals>
        <phase>none</phase>
      </execution>
    </executions>
</plugin>

If you need so, you will then be able to run the goal directly, as:

mvn package spring-boot:repackage



回答2:


In SpringBoot 2, removing executions did not work for me. I needed to set goal to package :

 <executions>
   <execution>
     <goals>
       <goal>package</goal>
     </goals>
     <phase>none</phase>
  </execution>
</executions>


来源:https://stackoverflow.com/questions/30325549/only-generate-one-war-during-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!