问题描述
遵循 本指南 > 我运行了命令
Following this Guide I ran the command
mvn assembly:assembly
并获得
Error reading assemblies: No assembly descriptors found.
我已经看过很多问题,但无济于事.
I've looked at numerous questions on this, but to no avail.
在> 此帖子 中,我创建了一个.xml
包含以下内容:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<dependencySets>
<dependencySet>
<scope>runtime</scope>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>**/LICENSE*</exclude>
<exclude>**/README*</exclude>
</excludes>
</unpackOptions>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</fileSet>
<fileSet>
<directory>src/main/resources/META-INF/services</directory>
<outputDirectory>META-INF/services</outputDirectory>
</fileSet>
</fileSets>
</assembly>
并将其包含在pom.xml
中:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>jar-with-dependencies.xml</descriptor>
</descriptors>
</configuration>
</plugin>
但仍然没有运气.
您可能会告诉我,我对此很陌生,如何才能使它运行?
I'm pretty new to this as you can probably tell, how can I get this running?
~~ EDIT ~~
在pom.xml
我更改了
<descriptor>jar-with-dependencies.xml</descriptor>
收件人
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
~~编辑2 ~~
pom.xml
现在包含以下内容:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
~~编辑3 ~~
此pom.xml
现在对我有用:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
推荐答案
要使其正常工作,您需要在src/main/assembly/
中创建文件jar-with-dependencies.xml
并使用以下XML:
For this to work, you need to create the file jar-with-dependencies.xml
in src/main/assembly/
and this XML:
<descriptors>
<descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>
即您需要指定文件的路径,约定是将文件放入src/main/assembly/
.
i.e. you need to specify the path to the file and the convention is to put the files into src/main/assembly/
.
要使用Maven提供的元素,您需要使用descriptorRef
元素(包装在descriptorRefs
中).
To use the ones provided by Maven, you need to use the descriptorRef
element instead (wrapped in a descriptorRefs
).
也不要将描述符放入execution
元素内,或者mvn assembly:assembly
再也找不到它了(因为您已将它专门移到了mvn package
目标上).
Also don't put the descriptor inside of the execution
element or mvn assembly:assembly
can't find it anymore (since you specifically moved it to the mvn package
target).
我本人按照本教程进行操作,有一个重要的点您可能已经错过了:您需要选择正确的原型.在我的情况下,这是5
,但是顺序可以更改.因此,请阅读整个列表,并查找字符串openimaj-quickstart-archetype
,否则事情将会中断.
I followed the tutorial myself and there is an important point which you might have missed: You need to select the correct archetype. In my case, that was 5
but the order can change. So read the whole list and look for the string openimaj-quickstart-archetype
or things will break.
这篇关于Maven错误读取程序集:未找到程序集描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!