1

I’m using Maven 3.2.3 and Java 6 (1.6.45). I want to incorporate the FindBugs plugin into my site reports. So I added this into my pom …

    <reporting>
            <plugins>
                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-checkstyle-plugin</artifactId>
                            <version>2.13</version>
                            <reportSets>
                                    <reportSet>
                                            <reports>
                                                    <report>checkstyle</report>
                                            </reports>
                                    </reportSet>
                            </reportSets>
                    </plugin>
                    <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>findbugs-maven-plugin</artifactId>
                            <version>3.0.0</version>
                    </plugin>
                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-jxr-plugin</artifactId>
                            <version>2.3</version>
                    </plugin>
            </plugins>
    </reporting>

However, when I run

mvn site:site site:deploy

I get the following exception …

[INFO] Generating "FindBugs" report    --- findbugs-maven-plugin:3.0.0
[INFO] Locale is en
[INFO] Fork Value is true
     [java] Exception in thread "main" java.lang.UnsupportedClassVersionError: edu/umd/cs/findbugs/FindBugs2 : Unsupported major.minor version 51.0
     [java]     at java.lang.ClassLoader.defineClass1(Native Method)
     [java]     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
     [java]     at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
     [java]     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
     [java]     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
     [java]     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] ------------------------------------------------------------------------

Any idea what else I need to include to fix this? Thanks, - Dave

Dave
  • 15,639
  • 133
  • 442
  • 830
  • The release of FindBugs you are using seems to have been compiled with Java7. I believe you will avoid this message by running Maven with a Java7 JDK. See http://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0 – unigeek Jan 20 '15 at 21:03
  • Ah, I'm running Java 6. Do you know what the correct compatible version is for such a JDK? – Dave Jan 20 '15 at 21:24
  • For Java6, the major.minor version number is 50.0. Is that what you mean? Probably configure JAVA_HOME to point to a Java7 release and then make sure your environment picks up that change and I'm thinking this issue is solved. If you have to use Java6, I would think you could get an older FindBugs release compiled with Java6--just a thought. – unigeek Jan 20 '15 at 21:28
  • I'm confined to using Java 6, so my question is, what is the last version of FindBugs that is compatible with Java 6? – Dave Jan 20 '15 at 21:31

1 Answers1

0

If you must use Java6, I suspect you'll need the 2.0.3 release of Findbugs. I admit, however, that I am extrapolating from the answer to this similar question which really pertains to the Eclipse plugin. And, digging a bit more, it does seem to be the case that v2.0.3 will be the last Findbugs release to support Java6--see release notes here.

Community
  • 1
  • 1
unigeek
  • 2,656
  • 27
  • 27