[英]Running multiple maven profiles from command line
have two profiles to build a dependent jar for a web application (one for tomcat and the other is for websphere). 有两个配置文件可为Web应用程序构建依赖的jar(一个用于tomcat,另一个用于websphere)。 Here what I'm trying is to run those two profiles in one go to build those jars together.
在这里,我正在尝试一次运行这两个配置文件以一起构建这些jar。
mvn help:active-profiles -o -Dmaven.test.skip=true clean install -PTOMCAT,WEBSPHERE
As a result of these executions we are expecting acme-tomcat-0.0.1-SNAPSHOT.jar and acme-web-0.0.1-SNAPSHOT.jar but along with these a default jar is also being created acme-0.0.1-SNAPSHOT.jar . 这些执行的结果是,我们期望使用acme-tomcat-0.0.1-SNAPSHOT.jar和acme-web-0.0.1-SNAPSHOT.jar,但同时也会创建默认的jar acme-0.0.1-SNAPSHOT .jar 。 It seems this because of the default execution.
看来这是由于默认执行。
How can we avoid this default execution to avoid the generation of default acme-0.0.1-SNAPSHOT.jar . 我们如何避免这种默认执行以避免生成默认的acme-0.0.1-SNAPSHOT.jar 。 We have referred a couple of solutions here in SO to arrive this and also we have made a similar post earlier but which will not help us in this scenario.
我们在SO中提到了一些解决方案来达到此目的,并且我们之前也发表过类似的文章,但这在这种情况下无济于事。 Any pointers would be helpful.
任何指针都会有所帮助。
<profiles>
<profile>
<id>TOMCAT</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>tom-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-tomcat-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jms-api</artifactId>
<version>1.1.0.GA</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>WEBSPHERE</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>web-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-web-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.4.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jms-api</artifactId>
<version>1.1.0.GA</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
Thanks, San 谢谢,圣
Using the pointer from Volodymyr Kozubal , changed the execution id of my TOMCAT profile to: 使用来自Volodymyr Kozubal的指针,将我的TOMCAT配置文件的执行ID更改为:
<execution>
<id>default-jar</id>
.........
</execution>
to override the default execution. 覆盖默认执行。
Thank you all 谢谢你们
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.