简体   繁体   中英

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

From my pom.xml to configure Maven animal sniffer plugin:

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

(This was borrowed from Google Guava's pom.xml )

Today, I started getting an error from the sniffer plug-in:

[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;

I am not calling CharBuffer.subSequence(...) directly in my code. It is likely coming from an included JAR. How do I find the offending class?

It is recommended that whenever you have some trouble with Maven run it as follows:

mvn -X clean install

**-X** option enables you to debug the maven. I've also faced the similar issue and found that dependent project is not build using Java 6 version. When i build the dependent project using Java 6 then it work fines.

So this issue occurred due to Java compliance level.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM