Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) - using sonarqube-ant-task-2.5.jar
- what are you trying to achieve - trying to get the sonar report for my corporate sonar dashboard
- what have you tried so far to achieve this - getting ‘java.lang.UnsupportedClassVersionError: Bad version number in .class file’ error for sonar target
Hi Sonar Qube Team,
I am trying to get the sonar report for my Ant project. Below are the specification which I did in my build.xml file.
Sonar Analysis started**
java version : {java.version}</echo> <echo>ant java version : {ant.java.version}
**************** sonar analysis End******************For all **** I have provided the correct desired values. My project is successfully completed the ‘clean’ and ‘compile’ targets but when it is running the ‘sonar’ target. It is giving me error at Line No -
PFB the stack trace -
[echo] java version : 1.5.0_85
[echo] ant java version : 1.5
sonar:
BUILD FAILED
/proj/com/src/build/build.xml:147: java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:626)
at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1128)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1299)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1355)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:594)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:239)
at org.apache.tools.ant.taskdefs.Antlib.execute(Antlib.java:176)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:443)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:292)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)