为什么在构建此项目时出现 "No assembly descriptors found." 错误?
Why do I get "No assembly descriptors found." error while building this project?
我有一点 project 用 Kotlin 写的。当我 运行 clean compile assembly:single install
时,我收到以下错误消息:
Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single
(default-cli) on project alma-econsim: Error reading assemblies: No assembly
descriptors found. -> [Help 1]
我的 jar-with-dependencies.xml
位于 src/main/assembly and referenced in pom.xml 是这样的:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<executions>
<execution>
<id>assembly</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
但我仍然得到错误。如何更正我的项目以便能够将其打包为具有依赖项的 jar?
首先使用 maven-assembly-plugin 的最新版本,而不是旧版本...此外,您应该通过 mvn clean package
调用它,因为您将 maven-assembly-plugin 绑定到 package
生命周期阶段......如果你尝试做 mvn ... assembly:single
你不是在调用生命周期......除此之外你想使用 jar-with-dependencies
描述符而不是你应该这样做:
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is
org.apache.maven.plugins ...which is assumed by default.
-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
[...]
</project>
除此之外,如果您这样调用 Maven:
mvn clean compile assembly:single install
比你把编译阶段称为双倍,因为只是一个:
mvn clean install
足够了。我可以推荐阅读 build life doc.
我有一点 project 用 Kotlin 写的。当我 运行 clean compile assembly:single install
时,我收到以下错误消息:
Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single
(default-cli) on project alma-econsim: Error reading assemblies: No assembly
descriptors found. -> [Help 1]
我的 jar-with-dependencies.xml
位于 src/main/assembly and referenced in pom.xml 是这样的:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<executions>
<execution>
<id>assembly</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
但我仍然得到错误。如何更正我的项目以便能够将其打包为具有依赖项的 jar?
首先使用 maven-assembly-plugin 的最新版本,而不是旧版本...此外,您应该通过 mvn clean package
调用它,因为您将 maven-assembly-plugin 绑定到 package
生命周期阶段......如果你尝试做 mvn ... assembly:single
你不是在调用生命周期......除此之外你想使用 jar-with-dependencies
描述符而不是你应该这样做:
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is
org.apache.maven.plugins ...which is assumed by default.
-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
[...]
</project>
除此之外,如果您这样调用 Maven:
mvn clean compile assembly:single install
比你把编译阶段称为双倍,因为只是一个:
mvn clean install
足够了。我可以推荐阅读 build life doc.