Only generate one war during package

2019-07-21 17:07发布

问题:

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