Sonar-maven-plugin crash due to invalid checkstyle.xml (match target processing command [xX] [mM] [lL] "is not allowed)

I am using Maven 3.2.1 and SonarQube 4.5 along with Checkstyle 5.6. Performance

mvn sonar:sonar

      

works fine for some projects, but others fail with "Unable to execute Checkstyle: Unable to read ... checkstyle.xml - Unable to parse configuration stream - Processing command target [xX] [mM] [lL]" not allowed. Here output:

### ~\.mavenrc
### Set JAVA_HOME for maven to /opt/Oracle_Java/jdk1.7.0_67
### Set MAVEN_OPTS to -Xmx512m -XX:MaxPermSize=512m

[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder    org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building cc4-common 4.14.10-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:2.4:sonar (default-cli) @ cc4-common ---
[INFO] SonarQube version: 4.5
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /srv/build/jenkins/jobs/cc4-trunk/workspace/trunk/cc4-   common/target/sonar
INFO: SonarQube Server 4.5
[INFO] [13:09:54.973] Load global referentials...
[INFO] [13:09:55.122] Load global referentials done: 151 ms
[INFO] [13:09:55.134] User cache: /var/lib/jenkins/.sonar/cache
[INFO] [13:09:55.145] Install plugins
[INFO] [13:09:55.268] Install JDBC driver
[INFO] [13:09:55.278] Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?   useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
[INFO] [13:09:57.034] Initializing Hibernate
[INFO] [13:09:58.837] Load project referentials...
[INFO] [13:09:59.766] Load project referentials done: 929 ms
[INFO] [13:09:59.766] Load project settings
[INFO] [13:10:00.806] Loading technical debt model...
[INFO] [13:10:00.838] Loading technical debt model done: 32 ms
[INFO] [13:10:00.843] Apply project exclusions
[INFO] [13:10:01.201] -------------  Scan cc4-common
[INFO] [13:10:01.206] Load module settings
[INFO] [13:10:02.293] Loading rules...
[INFO] [13:10:02.888] Loading rules done: 595 ms
[INFO] [13:10:02.907] Configure Maven plugins
[INFO] [13:10:03.161] Compare to previous analysis (2014-10-06)
[INFO] [13:10:03.217] Compare over 30 days (2014-09-13, analysis of 2014-09-13    02:44:12.0)
[INFO] [13:10:03.237] Compare to previous version (2014-07-16)
[INFO] [13:10:03.238] No quality gate is configured.
[INFO] [13:10:03.366] Initializer FindbugsMavenInitializer...
[INFO] [13:10:03.367] Initializer FindbugsMavenInitializer done: 1 ms
[INFO] [13:10:03.367] Base dir: /srv/build/jenkins/jobs/cc4-trunk/workspace/trunk/cc4-   common
[INFO] [13:10:03.367] Working dir: /srv/build/jenkins/jobs/cc4-trunk/workspace/trunk/cc4-common/target/sonar
[INFO] [13:10:03.368] Source paths: pom.xml, src/main/java
[INFO] [13:10:03.368] Test paths: src/test/java
[INFO] [13:10:03.368] Binary dirs: target/classes
[INFO] [13:10:03.368] Source encoding: UTF-8, default locale: en_US
[INFO] [13:10:03.368] Index files
[INFO] [13:10:03.378] Excluded sources: 
[INFO] [13:10:03.378]   **/package-info.java
[INFO] [13:10:04.074] 431 files indexed
[INFO] [13:10:08.941] Quality profile for java: SE-Tools 3.2 (with Findbugs)
[INFO] [13:10:09.281] Sensor JavaSquidSensor...
[INFO] [13:10:09.429] Java Main Files AST scan...
[INFO] [13:10:09.434] 273 source files to be analyzed
[ERROR] [13:10:09.873] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:09.891] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:09.934] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:10.134] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:10.267] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:10.296] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:10.778] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.121] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.452] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.491] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:11.515] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:11.574] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.576] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:11.632] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.658] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.690] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:11.699] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:12.654] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:12.668] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:12.687] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:12.712] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:13.052] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.089] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.140] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.182] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.307] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.349] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.375] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.393] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:13.466] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:15.425] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:15.475] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:15.501] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:15.516] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:15.533] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:15.538] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:15.577] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:15.591] Class not found: org.apache.commons.logging.Log
[ERROR] [13:10:15.604] Class not found: org.slf4j.impl.StaticLoggerBinder
[ERROR] [13:10:15.613] Class not found: org.apache.commons.logging.Log
[INFO] [13:10:15.615] 273/273 source files analyzed
[INFO] [13:10:15.666] Java Main Files AST scan done: 6237 ms
[INFO] [13:10:15.672] Java bytecode scan...
[INFO] [13:10:16.374] Java bytecode scan done: 702 ms
[INFO] [13:10:16.375] Java Test Files AST scan...
[INFO] [13:10:16.375] 158 source files to be analyzed
[INFO] [13:10:17.124] 158/158 source files analyzed
[INFO] [13:10:17.124] Java Test Files AST scan done: 749 ms
[INFO] [13:10:17.182] Package design analysis...
[INFO] [13:10:17.414] Package design analysis done: 232 ms
[INFO] [13:10:18.041] Sensor JavaSquidSensor done: 8759 ms
[INFO] [13:10:18.045] Sensor QProfileSensor...
[INFO] [13:10:18.049] Sensor QProfileSensor done: 4 ms
[INFO] [13:10:18.049] Sensor FindbugsSensor...
[INFO] [13:10:18.061] Execute Findbugs 3.0.0...
[INFO] [13:10:19.885] Findbugs output report: /srv/build/jenkins/jobs/cc4-trunk/workspace/trunk/cc4-common/target/sonar/findbugs-result.xml
[INFO] [13:10:41.963] Execute Findbugs 3.0.0 done: 23902 ms
[INFO] [13:10:42.008] Sensor FindbugsSensor done: 23959 ms
[INFO] [13:10:42.008] Sensor CheckstyleSensor...
[INFO] [13:10:42.017] Execute Checkstyle 5.6...
[INFO] [13:10:42.042] Checkstyle configuration: /srv/build/jenkins/jobs/cc4-trunk/workspace/trunk/cc4-common/target/sonar/checkstyle.xml
[ERROR] Can not execute Checkstyle
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.949 s
[INFO] Finished at: 2014-10-13T13:10:42+01:00
[INFO] Final Memory: 22M/286M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project cc4-common: Can not execute Checkstyle: unable to read /srv/build/jenkins/jobs/cc4-trunk/workspace/trunk/cc4-common/target/sonar/checkstyle.xml - unable to parse configuration stream - The processing instruction target matching "[xX][mM][lL]" is not allowed.:1:223 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

      

In fact, the generated checkstyle.xml is wrong because it contains "<\? Xml" and "<\ module" twice:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- Generated by Sonar --><module name="Checker"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<!--
    This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
    Checkstyle-Configuration: CheckStyle configuration from the Maven parent
    Description: none
-->
<module name="Checker">
  <property name="severity" value="warning"/>
  <module name="TreeWalker">
...

      

For analysis, I have uploaded this file: - checkstyle.xml: https://dl.dropboxusercontent.com/u/54665247/checkstyle.xml

Doing my google research I didn't find anything. Can anyone help me with this?

+3


source to share


1 answer


I solved my problem. It looks like the old, migrated data caused the problem: I have been using Sonar for several years, starting with version 3.1. From time to time I have upgraded to the current version, thereby migrating my existing myarl database. The last update was from 3,7,4 to 4,5. It seems that the XML header of the originally imported checkstyle.xml (link http://www.puppycrawl.com/dtds/configuration_1_3.dtd ) was added but not replaced by the current XML header (referring to http://www.puppycrawl.com /dtds/configuration_1_2.dtd ) resulting in two XML headers and thus invalid XML.



I solved my problem by deleting the affected project in SonarQube. The cost of this action is that I have lost all my historical data over the past few years.

0


source







All Articles