Eclipse-运行Maven软件包而忽略Maven-war-plugin

时间:2018-10-25 09:13:15

标签: java eclipse maven

我正在使用最新的Eclipse和Maven,

我有一个带有maven-jar-plugin和maven-war-plugin的项目,如下所示

很明显clean install会创建一个jar和战争,但是我可以运行只创建jar跳过战争创建(不更改pom)的命令吗?

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
            </configuration>
            <executions>
                <execution>
                   <phase>package</phase>
                   <goals>
                     <goal>jar</goal>
                   </goals>
                   <configuration>
                     <includes>
                       <include>**/*</include>
                     </includes>                                     
                   </configuration>
                 </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
           <executions>
             <execution>
               <phase>package</phase>
               <goals>
                 <goal>war</goal>
               </goals>             
            <configuration>
                <classifier>wardeploy</classifier>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <warName>MyName</warName>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
                </execution>
            </executions>

        </plugin>

1 个答案:

答案 0 :(得分:0)

我成功地使用

跳过了战争(仅创建jar)
clean install -Dmaven.war.skip

plugin source中找到它:

  

@Parameter(property =“ maven.war.skip”,defaultValue =“ false”)