jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Sonar
  • SONAR-283

Sonar maven plugin does not retrieve custom checktyle rules from sonar server

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker 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.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    build.log
    20/Jun/08 1:59 AM
    6 kB
    Michel Pawlak

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Simon Brandhof added a comment - 20/Jun/08 3:04 AM

We found the bug. PMD extensions work but not checkstyle ones. We will fix it on the 1.4RC1 planned on next weeks.

Show
Simon Brandhof added a comment - 20/Jun/08 3:04 AM We found the bug. PMD extensions work but not checkstyle ones. We will fix it on the 1.4RC1 planned on next weeks.
Hide
Permalink
Simon Brandhof added a comment - 20/Jun/08 3:11 AM

The 1.3 workaround is to edit the file /war/sonar-web/app/controllers/remote_services_controller.rb. Replace the line 55

(File.exists?(maven_repo_path) and File.directory?(maven_repo_path)) ? " true" : "false"

by

(File.exists?(maven_repo_path) and File.directory?(maven_repo_path)) ? "true" : "false"

(just remove the whitespace inside " true")

Don't forget to rebuild the WAR if you do not use the standalone mode.

Show
Simon Brandhof added a comment - 20/Jun/08 3:11 AM The 1.3 workaround is to edit the file /war/sonar-web/app/controllers/remote_services_controller.rb. Replace the line 55
(File.exists?(maven_repo_path) and File.directory?(maven_repo_path)) ? " true" : "false"
by
(File.exists?(maven_repo_path) and File.directory?(maven_repo_path)) ? "true" : "false"
(just remove the whitespace inside " true") Don't forget to rebuild the WAR if you do not use the standalone mode.
Hide
Permalink
Michel Pawlak added a comment - 20/Jun/08 3:51 AM

Great ! I'll try it asap .

Thank you for your fast reply.

Michel

Show
Michel Pawlak added a comment - 20/Jun/08 3:51 AM Great ! I'll try it asap . Thank you for your fast reply. Michel
Hide
Permalink
Michel Pawlak added a comment - 20/Jun/08 4:49 AM

It works now. Thank you

Show
Michel Pawlak added a comment - 20/Jun/08 4:49 AM It works now. Thank you
Hide
Permalink
Simon Brandhof added a comment - 20/Jun/08 4:53 AM

I reopen the issue because we have to fix it on 1.4 ;o)

Show
Simon Brandhof added a comment - 20/Jun/08 4:53 AM I reopen the issue because we have to fix it on 1.4 ;o)

People

  • Assignee:
    Julien Lancelot
    Reporter:
    Michel Pawlak
Vote (0)
Watch (0)

Dates

  • Created:
    20/Jun/08 1:59 AM
    Updated:
    10/Jan/12 3:13 PM
    Resolved:
    25/Jun/08 3:00 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.