gpt4 book ai didi

java - Maven 构建中读取程序集时出错

转载 作者:行者123 更新时间:2023-11-30 03:05:23 30 4
gpt4 key购买 nike

这是我的 pom.xml 文件和构建时遇到的错误

错误:

Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project load-xml-to-s3: Error reading assemblies: No assembly descriptors found.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tte.s3.load</groupId>
<artifactId>load-xml-to-s3</artifactId>
<version>1.0</version>
<name>load-xml-to-s3</name>
<build>
<plugins>
<!-- TOBE USED LATER - DO NOT DELETE. - KC <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId> <version>1.5.3</version> <executions> <execution>
<phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution>
</executions> <configuration> <file>target/classes/somefile.txt</file> <replacements>
<replacement> <token>SOME TOKEN</token> <value>SOME VALUE</value> </replacement>
</replacements> </configuration> </plugin> -->

<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<mainClass>com.tte.s3.load.driver.Driver</mainClass>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>

<executions>
<execution>
<id>make-assembly</id>
<phase>assembly</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>

<descriptors>
<descriptor>distribution.xml</descriptor>
</descriptors>

</configuration>
</execution>

</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

最佳答案

descriptors maven-assembly-plugin 的属性需要从项目的基目录开始的路径。例如,如果文件位于 src/assembly/distribution.xml 内,这是您应该指定的路径。

您绑定(bind)插件的阶段也存在问题。相 assembly 不存在,您应该使用 <phase>package</phase>相反。

作为侧节点,您使用的是旧版本的插件 (2.2-beta-5)。考虑使用最新版本,即 2.6 .

示例配置:

<plugin>
<!-- no need to specify the groupId, it defaults to "org.apache.maven.plugins" -->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version> <!-- explicit version is safer for build consistency than implicit -->
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase> <!-- bind the execution to the "package" phase -->
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/distribution.xml</descriptor> <!-- use the path to the file starting from base directory -->
</descriptors>
</configuration>
</execution>
</executions>
</plugin>

使用 mvn clean install 运行 Maven将在打包阶段正确调用插件。

关于java - Maven 构建中读取程序集时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34921868/

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