4

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?

1 Answer 1

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.