我想爲定義特定屬性的模塊具有公共構建配置文件。在我的情況下,我正在運行jar-with-dependencies
插件,並希望它只能在模塊定義main.class
屬性時運行。Maven構建配置文件在子模塊pom中定義屬性時執行
我在我的父POM如下:
<profiles>
<profile>
<id>executable-jar</id>
<activation>
<property>
<name>main.class</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
,除非我運行Maven的命令時,所以它看起來像它不是檢測在其計數模塊的屬性來定義-Dmain.class
它不會建成。這可以觸發嗎?
這解決了它。謝謝 – mangusbrother