簡體   English   中英

如何從Maven動物嗅探器插件中找到錯誤的來源?

[英]How to find the source of an error from Maven animal sniffer plugin?

從我的pom.xml配置Maven動物嗅探器插件:

<properties>
    <animal-sniffer-maven-plugin.version>1.9</animal-sniffer-maven-plugin.version>
</properties>
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>animal-sniffer-maven-plugin</artifactId>
    <version>${animal-sniffer-maven-plugin.version}</version>
    <configuration>
        <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java16-sun</artifactId>
            <version>1.0</version>
        </signature>
    </configuration>
    <executions>
        <execution>
            <id>check-java16-sun</id>
            <phase>test</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

(這是從Google Guava的pom.xml借來的)

今天,我開始從嗅探器插件中收到錯誤:

[ERROR] Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.9:check (check-java16-sun) on project Optimus:
Execution check-java16-sun of goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.9:check failed:
An API incompatibility was encountered while executing org.codehaus.mojo:animal-sniffer-maven-plugin:1.9:check:
java.lang.NoSuchMethodError: java.nio.CharBuffer.subSequence(II)Ljava/nio/CharBuffer;

我沒有直接在我的代碼中調用CharBuffer.subSequence(...) 它可能來自一個包含的JAR。 我如何找到有問題的課程?

建議每當你遇到麻煩時,請按如下方式運行:

mvn -X clean install

**-X**選項使您可以調試maven。 我也遇到了類似的問題,發現依賴項目不是使用Java 6版本構建的。 當我使用Java 6構建依賴項目時,它會產生罰款。

因此,由於Java合規性級別而發生此問題。

暫無
暫無

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

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