簡體   English   中英

未能執行目標 org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar)

[英]Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar)

maven-jar-plugin 失敗並出現以下錯誤:

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar) on project myProject: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.

我正在使用 java 11。我將 maven-jar-plugin 從 2.4 升級到 3.1.0。

它僅在 mvn clean install deploy 上失敗。 (沒有部署它運行正常)。

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <phase>test-compile</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

有任何想法嗎?

這個插件不喜歡創建空的 jars。 試試

<skipIfEmpty>true</skipIfEmpty>

設置靈活性,特別是在大型多模塊項目中,當這個插件被繼承到許多模塊中時。

在你的 pom 中使用這一行:

<packaging>jar</packaging>

這對 java 8 有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM