Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.3
-
Fix Version/s: 1.4
-
Component/s: Maven Plugin, Rules
-
Labels:None
-
Environment:JOnAS 4.8.6d, embedded derby DB,
Description
We currently cannot run a maven sonar build on projects with custom checkstyle rules. The build fails because the maven checkstyle plugin does not find the classfiles of our custom checks.
I've done the following things :
0) Configured sonar.properties (set database directory, jndi name)
1) Placed the jar of our custom checks in $SONAR_DIR$\extensions\rules\checkstyle\
2) Built sonar.war with build-war.bat
3) Placed sonar.war in JOnAS webapps/autoload directory
4) configured JOnAS (derby database)
5) run JOnAS 4.8.6d
6) added rules extensions for our custom checkstyle rules
7) set up a rules profile including the extensions I set
8) verified that our rules jar is in the deloyed war
9) once the war is deployed extension files are in $JONAS_DIR$\work\webapps\jonas\single\sonar\WEB-INF\classes\extensions\rules\checkstyle
10) run "mvn -npu -Dsonar.host.url=http://localhost:20000/sonar org.codehaus.sonar:sonar-maven-plugin:1.3:sonar"
The build throws com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to instantiate ...
I saw that the stack trace indicates that the class file the checkstyle maven plugin cannot instanciate is suffixed by "CheckCheck" instead of "Check". I tried to rename all our checks to remove the "Check" suffix, but it changes nothing (the displaed name is correct, but it cannot find the class files)
Then I tried to directly add the jar as a dependency of maven-checkstyle-plugin in the pom.xml of our project as follows :
<build>
<plugins>
<!-- start sonar configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<dependency>
<groupId>ch.ge.cti.qualite.config</groupId>
<artifactId>cti_checkstyle_rules</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
</plugin>
<!-- end sonar configuration -->
</plugins>
</build>
And with this workaround it works (but then I cannot verify the project having built the rules set as it creates a cyclic dependency) !
So IMHO it seems that the sonar maven plugin does not retrieve the extension jars from sonar server. You confirmed me by mail that the plugin is supposed to retrieve this jar.
Once downloaded by the plugin, Where is the jar supposed to be placed ?
If you need any other information, please tell me.
We found the bug. PMD extensions work but not checkstyle ones. We will fix it on the 1.4RC1 planned on next weeks.