【问题标题】:Maven Error reading assemblies: No assembly descriptors foundMaven 读取程序集时出错:未找到程序集描述符
【发布时间】:2015-05-30 17:00:34
【问题描述】:

按照this Guide我运行了命令

mvn assembly:assembly

得到了Build Failure

Error reading assemblies: No assembly descriptors found.

我已经查看了很多关于此的问题,但无济于事。

this post,我创建了一个.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>

但还是没有运气。

您可能会说,我对此很陌生,我怎样才能让它运行?

~~编辑~~

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>

【问题讨论】:

标签: plugins maven-2 assemblies maven-assembly-plugin


【解决方案1】:

为此,您需要在src/main/assembly/ 中创建文件jar-with-dependencies.xml 和此XML:

<descriptors>
    <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
</descriptors>

即您需要指定文件的路径,约定是将文件放入src/main/assembly/

要使用 Maven 提供的元素,您需要改用 descriptorRef 元素(包装在 descriptorRefs 中)。

也不要将描述符放在execution 元素内,否则mvn assembly:assembly 找不到它(因为您专门将其移至mvn package 目标)。

[编辑] 我自己按照教程进行了操作,但您可能错过了重要的一点:您需要选择正确的原型。就我而言,那是5,但顺序可以更改。因此,请阅读整个列表并查找字符串 openimaj-quickstart-archetype 否则会损坏。

【讨论】:

  • 我找不到src/assembly/
  • @MLMLTL 你需要创建这个文件夹。
  • @MLMLTL:我再次检查了我的一个项目;查看我的编辑。如果您创建了自定义 XML 文件,则需要使用 descriptor 和文件路径(相对于 ${basedir})。
  • 再一次,还是没有运气——PS &lt;/descriptor 需要&gt;
  • 您为什么使用插件的测试版?最新版本是2.5.3。试试看
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-05
  • 2011-01-28
  • 1970-01-01
  • 2018-07-04
  • 2016-07-17
  • 1970-01-01
  • 2010-12-19
相关资源
最近更新 更多