一种可能性是使用profile,它基于第二个罐子的存在而被激活。此配置文件可用于使用上面提到的build helper maven plugin目标附加其他工件。这样的事情...
<project>
...
<profiles>
<profile>
<id>second-jar</id>
<activation>
<file>
<exists>${basedir}/location/of/second.jar</exists>
</file>
</activation>
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>second</file>
<type>jar</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
如何检查此可选jar的存在,然后调用'mvn install'的shell脚本/批处理文件? – Raghuram
嗯,我想这将工作,如果我做了一个替代pom.xml文件,但我正在尝试做一些很好,干净和像maven一样。 –