繁体   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