有没有办法从另一个maven install命令触发maven install命令?
换句话说,我希望能够在maven项目上执行maven install命令(在eclipse中),我希望这会自动导致另一个maven项目上的安装命令.那可能吗?
“触发”另一个构建的 Maven 方法是定义多模块构建。父 pom 项目可以指定模块,这些模块都将使用标准生命周期构建。因此,mvn install在父级上运行意味着每个模块都是依次构建的。
父级是用pompackagegin 定义的,并且有一个如下的模块声明:
<modules>
<module>module-a</module>
<module>module-b</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
或者,可以将其他工件附加到构建中,以便它们与主要工件一起部署(假设它们已经打包,您可以使用 build -helper-maven-plugin将任意文件附加到您的 pom,这样它将使用指定的分类器进行部署。以下配置将附加指定的文件作为my-artifact-1.0-extra.jar
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>/path/to/extra/file.jar</file>
<type>jar</type><!--or specify your required extension-->
<classifier>extra</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3059 次 |
| 最近记录: |