gpt4 book ai didi

java - 如何在maven中创建多模块项目的汇编

转载 作者:行者123 更新时间:2023-11-30 07:58:38 25 4
gpt4 key购买 nike

我有多模块 Maven 项目。模块的一部分是库,一部分是可执行文件。我已经创建了汇编模块并将其附加到模块列表的末尾。汇编模块配置如下所示:

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<!-- <version>1.1.3</version> -->
<configuration>
<descriptor>src/assembly/bin.xml</descriptor>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<dependencies>
<!-- all dependencies -->
</dependencies>

我还创建了组装文件 src/assemble/bin.xml:

<id>bin</id>
<formats>
<format>dir</format>
<format>tar.gz</format>
<format>tar.bz2</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
<include>properties*/</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/jars</directory>
<outputDirectory>jars</outputDirectory>
</fileSet>
</fileSets>
<moduleSets>
<moduleSet>
<binaries>
<unpack>false</unpack>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<scope>compile</scope>
<outputDirectory>jars</outputDirectory>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>

不幸的是,然后我使用 mvn 包运行汇编。我收到此错误:

无法在项目 assemble 上执行目标 org.apache.maven.plugins:maven-assemble-plugin:2.2-beta-5:single (make- assembly): 无法创建程序集: 创建程序集归档文件箱时出错:您必须至少设置一个文件。

最佳答案

刚刚解决了这个问题。

事实证明我的 maven-assemble-plugin 缺少版本号:

<version>2.5.5</version>

bin.xml 也缺少依赖项:

<useAllReactorProjects>true</useAllReactorProjects> 

<includes>
<include>org.rdswitchbaord.importers:import_ands</include>
<!-- etc -->
</includes>

之后,一切明星都会神奇地发挥作用。

关于java - 如何在maven中创建多模块项目的汇编,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32260584/

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