Reputation: 845
I'm trying to integrate custom PMD tasks in Sonar, which I currently managed to work along with Sonar PMD plugin.
My current issue is to run sonar ant task with the command line.
In my eclipse workspace, I add additional classpath entries in Eclipse for Ant to run and it works just fine. But when i run it in the command line, no matter how I pass the jars for ant, it just doesn't seem to be using it in the ClassLoader.
This is a big issue for my project, once I can't put the task to run in my continuous integration server.
I'm currently passing the jar's that contains all the classes need using the property sonar.libraries.
The error I'm getting is:
build.xml:121: java.lang.NoClassDefFoundError: net/sourceforge/pmd/AbstractJavaRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
Upvotes: 1
Views: 1832
Reputation: 26843
"sonar.libraries" references only dependencies of your application, not dependencies of Sonar execution context.
If you want to develop custom PMD tasks that will be used by Sonar, please have a look at this example plugin: https://github.com/SonarSource/sonar-examples/tree/master/plugins/sonar-pmd-extension-plugin
Upvotes: 3