我想执行允许根据执行ID
构建WAR文件的命令我的原始WAR文件是使用大量子模块生成的。如果我需要测试和构建仅测试我的模块,我想建立一个更轻的"战争通过排除几个罐子,因为构建需要花费很多时间。相反,我想在给定一些标志/命令的情况下构建一个更轻的WAR。
如下面的代码所示,如果使用命令执行,我打算跳过一些依赖项/ JAR。
我相信你可以运行类似于
的东西mvn deploy <prefix>:<goal>:<execution-id>
如Run a single Maven plugin execution?或Maven maven-exec-plugin multiple execution configurations所示,但到目前为止我没有运气。
以下是我的pom配置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>exclude-few-deps</id>
<goals><goal>war</goal></goals>
<phase>package</phase>
<configuration>
<failOnMissingWebXml>true</failOnMissingWebXml>
<webXml>src/main/resources/web.xml</webXml>
<packagingExcludes>
WEB-INF/lib/student-*.jar,
WEB-INF/lib/library-*.jar
</packagingExcludes>
</configuration>
</execution>
<execution>
<id>default-cli</id>
<goals><goal>war</goal></goals>
<phase>package</phase>
<configuration>
<failOnMissingWebXml>true</failOnMissingWebXml>
<webXml>src/main/resources/web.xml</webXml>
</configuration>
</execution>
</executions>
</plugin>
我不确定应该执行哪个命令来选择id为
的执行mvn war:war:@exclude-few-deps
或
mvn clean package:@exclude-few-deps
我还尝试使用maven配置文件,但似乎我无法使用它。
感谢任何帮助。