【问题标题】:Why am I getting this Maven error?为什么我会收到这个 Maven 错误?
【发布时间】:2016-06-05 22:34:25
【问题描述】:

我已经尝试解决这个问题已经有一个小时了,但我没有得到任何结果。

当我尝试使用 Maven 编译我的项目时,我收到了这个错误:

[错误] 无法在项目 GankALane 上执行目标 org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli):无法解析 mojo org.apache 的配置。 maven.plugins:maven-assembly-plugin:2.2-beta-5:single 用于参数存档:在 org.apache.maven.archiver.MavenArchiveConfiguration 中找不到“descriptorRefs”的设置器、加法器或字段

我正在使用以下命令进行编译: mvn clean compile assembly:single

这是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.me</groupId>
    <artifactId>GankALane</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>beam-releases</id>
            <url>https://maven.beam.pro/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>beam-snapshots</id>
            <url>https://maven.beam.pro/content/repositories/snapshots/</url>
        </repository>

    </repositories>

    <dependencies>
        <dependency>
            <groupId>pro.beam</groupId>
            <artifactId>api</artifactId>
            <version>1.10.5-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>pro.beam</groupId>
            <artifactId>interactive</artifactId>
            <version>1.5.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.me.GankALane.Main</mainClass>
                        </manifest>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

感谢您的关注,希望我能找到解决方案!

【问题讨论】:

  • 虽然还在v3.3.9 Super POMmaven-assembly-plugin:2.2-beta-5已经6岁多了。我不知道这是否能解决您的问题,但我会使用最新的v2.6
  • 刚试过,没区别
  • 您将maven-assembly-pluginsingle 目标绑定到package 阶段。那你为什么要执行mvn clean compile assembly:single而不是mvn clean package呢?
  • 我在问题上输入了错误的命令,让我解决这个问题,我的坏@GeroldBroser

标签: java maven maven-assembly-plugin


【解决方案1】:

你的 POM 是错误的:

<configuration>
    <archive>
        ...  
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
    </archive>
</configuration>

消息给出提示:

参数存档:找不到“descriptorRefs”的设置器、加法器或字段...

Apache Maven Assembly Plugin > Usage:

<configuration>
    <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
</configuration>

开头还链接到Apache Maven Archiver:那里没有&lt;archive&gt;/&lt;descriptorRefs&gt;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多