gpt4 book ai didi

maven-2 - 如何在全新安装时将多个 jar 文件发布到 maven

转载 作者:行者123 更新时间:2023-12-01 07:03:23 25 4
gpt4 key购买 nike

我已经使用 maven assembly 插件从一个 jar 创建多个 jar 现在问题是我必须将这些 jar 发布到本地 repo,就像其他 maven jar 在构建时由它们自己发布 maven clean install 我将如何能够做到这一点

这是我的 pom 文件

<project>
<parent>
<groupId>parent.common.bundles</groupId>
<version>1.0</version>
<artifactId>child-bundle</artifactId>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>common.dataobject</groupId>
<artifactId>common-dataobject</artifactId>
<packaging>jar</packaging>
<name>common-dataobject</name>
<version>1.0</version>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<directory>src/main/resources/jibx_mapping</directory>
<includes>
<includes>binding.xml</includes>
</includes>
<verbose>false</verbose>
</configuration>
<executions>
<execution>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-business-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>flight-dto</finalName>
<descriptors>
<descriptor>src/main/assembly/car-assembly.xml</descriptor>
</descriptors>
<attach>true</attach>
</configuration>
</execution>
<execution>
<id>make-gui-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>app_gui</finalName>
<descriptors>
<descriptor>src/main/assembly/bike-assembly.xml</descriptor>
</descriptors>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>

这是我的程序集文件
<assembly>
<id>app_business</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory>target</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>

<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>com/dataobjects/**</include>
</includes>
</fileSet>
</fileSets>
</assembly>

最佳答案

Build Helper Maven Plugin有一个 build-helper:attach-artifact 允许附加要安装和部署的其他工件。它通常像这样使用(来自 Usage 页面):

<project>
...
<build>
<plugins>
<plugin>
<!-- add configuration for antrun or another plugin here -->
</plugin>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>some file</file>
<type>extension of your file </type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

关于maven-2 - 如何在全新安装时将多个 jar 文件发布到 maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2789671/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com