I have Jenkins to build my Java deployable and then push code into SonarQube for code scanning,
I am able to see the Bug report on SonarQube as well,
But I want a downloadable report in a PDF format or anything that can be shared after the scan.
I added the following properties in my project's pom.xml-
<properties>
<sonar.analysis.mode>preview</sonar.analysis.mode> <sonar.issuesReport.html.enable>true</sonar.issuesReport.html.enable>
</properties>
On my local Jenkins I have the following commands -
echo ** Executing SQ Analysis **
mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Demo -Dsonar.sources=src/main/java -Dsonar.login=[someKey] -Dsonar.ProjectName=Demo -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true
I am getting the following error while trying to build -
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # Linear-ingestion ---
[INFO] Installing /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT.jar to /home/user/.m2/repository/com/cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.jar
[INFO] Installing /home/user/.jenkins/workspace/Linear/pom.xml to /home/user/.m2/repository/com/cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.pom
[INFO] Installing /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar to /home/user/.m2/repository/com/cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.531 s
[INFO] Finished at: 2018-07-04T13:41:08+05:30
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /home/user/.jenkins/workspace/Linear/pom.xml to com.cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.pom
[JENKINS] Archiving /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT.jar to com.cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT.jar
[JENKINS] Archiving /home/user/.jenkins/workspace/Linear/target/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar to com.cloudlytics/Linear-ingestion/1.0-SNAPSHOT/Linear-ingestion-1.0-SNAPSHOT-jar-with-dependencies.jar
[Linear] $ /bin/sh -xe /home/user/office/R&D/apache-tomcat-8.5.31/temp/jenkins3011322823073246601.sh
channel stopped
+ echo RemoteSystemsTempFiles bin log4j.properties pom.xml src target Executing SQ Analysis RemoteSystemsTempFiles bin log4j.properties pom.xml src target
RemoteSystemsTempFiles bin log4j.properties pom.xml src target Executing SQ Analysis RemoteSystemsTempFiles bin log4j.properties pom.xml src target
+ mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Linear -Dsonar.sources=src/main/java -Dsonar.login=f51956611fa53b292bb19e25752cb22b5afe893e -Dsonar.ProjectName=Linear sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.cloudlytics:Linear-ingestion:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-core:jar -> version ${springframework.version} vs ${spring.version} # line 52, column 15
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-context:jar -> version ${springframework.version} vs ${org.springframework-version} # line 67, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------< com.cloudlytics:Linear-ingestion >------------------
[INFO] Building Linear-ingestion 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.4.1.1168:sonar (default-cli) # Linear-ingestion ---
[INFO] User cache: /home/user/.sonar/cache
[INFO] SonarQube version: 6.7.4
[INFO] Default locale: "en_IN", source code encoding: "UTF-8"
[INFO] Issues mode
[WARNING] The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.
[INFO] Load global settings
[INFO] Load global settings (done) | time=454ms
[INFO] Server id: AWRKrQutLb-E1SWiQK4O
[INFO] User cache: /home/user/.sonar/cache
[INFO] Exclude plugins: devcockpit, ldap, authgithub, authbitbucket, pdfreport, authaad, googleanalytics, governance
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=141ms
[INFO] Scanning only changed files
[INFO] Process project properties
[INFO] Load project repositories
[WARNING] Project doesn't exist on the server. All issues will be marked as 'new'.
[INFO] Load project repositories (done) | time=72ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=2536ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1558ms
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=80ms
[INFO] Project key: Linear
[INFO] ------------- Scan Linear-ingestion
[INFO] Load server rules
[INFO] Load server rules (done) | time=804ms
[INFO] Base dir: /home/user/.jenkins/workspace/Linear
[INFO] Working dir: /home/user/.jenkins/workspace/Linear/target/sonar
[INFO] Source paths: src/main/java
[INFO] Source encoding: UTF-8, default locale: en_IN
[INFO] Index files
[INFO] 68 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 7
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=14ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=2ms
[INFO] Java Main Files AST scan
[INFO] 68 source files to be analyzed
[INFO] 45/68 files analyzed, current file: /home/user/.jenkins/workspace/Linear/src/main/java/com/blazeclan/sqs_polling_manager/xml/parser/dao/LogicallyDeleteDAO.java
[INFO] 68/68 source files have been analyzed
[INFO] Java Main Files AST scan (done) | time=12267ms
[INFO] Java Test Files AST scan
[INFO] 0 source files to be analyzed
[INFO] 0/0 source files have been analyzed
[INFO] Java Test Files AST scan (done) | time=3ms
[INFO] Sensor JavaSquidSensor [java] (done) | time=12972ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [/home/user/.jenkins/workspace/Linear/target/surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=3ms
[INFO] Sensor JaCoCoSensor [java]
[INFO] Sensor JaCoCoSensor [java] (done) | time=0ms
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
[INFO] Sensor Analyzer for "php.ini" files [php]
[INFO] Sensor Analyzer for "php.ini" files [php] (done) | time=11ms
[INFO] Performing issue tracking
[INFO] 79/79 components tracked
[INFO] ANALYSIS SUCCESSFUL
[INFO] Task total time: 22.039 s
[INFO]
[INFO] ------------------< com.cloudlytics:Linear-ingestion >------------------
[INFO] Building Linear-ingestion 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.370 s
[INFO] Finished at: 2018-07-04T13:41:51+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "sonar-runner". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/LifecyclePhaseNotFoundException
Build step 'Execute shell' marked build as failure
Finished: FAILURE
You want to execute unexistent sonar-runner goal:
mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Demo -Dsonar.sources=src/main/java -Dsonar.login=[someKey] -Dsonar.ProjectName=Demo sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true
You have to remove it:
mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=Demo -Dsonar.sources=src/main/java -Dsonar.login=[someKey] -Dsonar.ProjectName=Demo -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true
I would recommended to remove more parameters:
sonar.projectKey - maven plugin is responsible for generating this parameter
sonar.ProjectName - doesn't exist (correct name is sonar.projectName), maven plugin will use vaule of name or artifactId nodes from your pom.xml file
sonar.sources=src/main/java - maven plugin is responsible for generating value of this parameter
sonar.analysis.mode=preview - deprecated and shouldn't be used (since 6.6, you use 6.7.4)
sonar.issuesReport.html.enable - Issues Report Plugin which uses this parameter is incompatible with SonarQube 6.7.4
Finally you can execute a simple and short command:
mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login=[someKey]
Related
I switched from windows to MacBook Air which is having M1 chip. I installed java and added the environment variables in .zprofile as follows
export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=${HOME}/Library/Android/sdk
export PATH="${JAVA_HOME}/bin:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}"
But when I run echo $JAVA_HOME, I see the output as /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home instead of /Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home. I am not able to check if variable is set to JDK or JRE.
From Intellij, when I run mvn test clean, error is shown as,
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.example:SampleProject >----------------------
[INFO] Building SampleProject 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SampleProject ---
[WARNING] Using platform encoding (US-ASCII actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # SampleProject ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SampleProject ---
[WARNING] Using platform encoding (US-ASCII actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/moengage/IdeaProjects/SampleProject/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # SampleProject ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding US-ASCII, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Users/moengage/IdeaProjects/SampleProject/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.392 s
[INFO] Finished at: 2021-11-18T13:20:33+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project SampleProject: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[ERROR] -> [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:
Note: I checked others' questions as well and none of them were helpful. Can someone please help me in resolving this.
The following error occurred while loading my telegram bot written in Java (Maven).
-----> Java app detected
-----> Installing JDK 1.8... done
-----> Installing Maven 3.6.2... done
-----> Executing Maven
$ mvn -DskipTests clean dependency:list install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.example:GesualdoBot:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 12, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------------< org.example:GesualdoBot >-----------------------
[INFO] Building GesualdoBot 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # GesualdoBot ---
[INFO] Deleting /tmp/build_86eafd8379099658ed8301a1e005ecb8/target
[INFO]
[INFO] --- maven-dependency-plugin:2.8:list (default-cli) # GesualdoBot ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # GesualdoBot ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /tmp/build_86eafd8379099658ed8301a1e005ecb8/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # GesualdoBot ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 4 source files to /tmp/build_86eafd8379099658ed8301a1e005ecb8/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.370 s
[INFO] Finished at: 2020-05-27T18:45:46Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project GesualdoBot: Compilation failure -> [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/MojoFailureException
! ERROR: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
Can anyone tell me how to solve the problem? I think the first warning is detected because in my pom.xml file I have not specified a version for maven-compiler-plugin; does anyone know how do i see the current version i am using?
I'm having the following problem with a Maven project on our Jenkins server while running the Sonarqube maven plugin in a Jenkins pipeline.
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:54 min
[INFO] Finished at: 2017-11-14T11:42:51+00:00
[INFO] Final Memory: 74M/606M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project pandora-parent-pom: Malformed input or input contains unmappable characters: src/main/webapp/images/D??rogations.ep
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Malformed input or input contains unmappable characters: src/main/webapp/images/D??rogations.ep
at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:80)
at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:139)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: src/main/webapp/images/D??rogations.ep
at sun.nio.fs.UnixPath.encode(UnixPath.java:147)
at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at sun.nio.fs.AbstractPath.resolve(AbstractPath.java:53)
at org.sonar.api.batch.fs.internal.DefaultInputFile.path(DefaultInputFile.java:83)
at org.sonar.api.batch.fs.internal.DefaultInputFile.file(DefaultInputFile.java:75)
at org.sonar.api.batch.fs.internal.PathPattern$RelativePathPattern.match(PathPattern.java:101)
at org.sonar.batch.scan.filesystem.LanguageDetection.isCandidateForLanguage(LanguageDetection.java:124)
at org.sonar.batch.scan.filesystem.LanguageDetection.language(LanguageDetection.java:97)
at org.sonar.batch.scan.filesystem.InputFileBuilder.completeAndComputeMetadata(InputFileBuilder.java:98)
at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:164)
at org.sonar.batch.scan.filesystem.FileIndexer$1.call(FileIndexer.java:161)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[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
The file itself is named Dérogations.ep .
The part of the Jenkinsfile which contains the Sonar execution
stage('Sonar') {
withSonarQubeEnv('SonarQube') {
updateGitlabCommitStatus(name: 'sonar', state: 'running')
configFileProvider([configFile(fileId: 'ec266a3e-2586-4b2c-b0bb-386603d5a4ef', variable: 'MAVEN_SETTINGS')]) {
sh "export"
sh "${mvnHome}/bin/mvn org.jacoco:jacoco-maven-plugin:prepare-agent install -s $MAVEN_SETTINGS -Pcoverage-per-test -Dmaven.test.failure.ignore"
sh "export"
sh "${mvnHome}/bin/mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -s $MAVEN_SETTINGS -Dsonar.branch=${env.BRANCH_NAME} -Dmaven.test.failure.ignore"
sh "export"
jacoco()
}
updateGitlabCommitStatus(name: 'sonar', state: 'success')
}
}
The export call returns (amongst others) these params, which I assigned to our build node.
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
export LC_COLLATE='en_US.UTF-8'
export LC_CTYPE='en_US.UTF-8'
The maven-compiler-plugin and maven-resources-plugin are also configured in UTF-8 and the Sonar logs also suggest that everything is nicely in UTF-8 (except for one file which is in ISO-8859)
[INFO] ------------- Scan MP services jenkins
[INFO] Base dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services
[INFO] Working dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar
[INFO] Source paths: pom.xml, src/main/java
[INFO] Test paths: src/test/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 299 files indexed
[INFO] Quality profile for java: MP
[INFO] Sensor Lines Sensor
[INFO] Sensor Lines Sensor (done) | time=14ms
[INFO] Sensor JavaSquidSensor
[INFO] Configured Java source version (sonar.java.source): 7
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=1ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=3ms
[INFO] Java Main Files AST scan
[INFO] 293 source files to be analyzed
[INFO] 196/293 files analyzed, current file: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/src/main/java/be/MP/xxx/MP/dao/impl/HistoriqueActionServiceImpl.java
[INFO] 283/293 files analyzed, current file: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/src/main/java/be/MP/xxx/MP/service/impl/SourceAuthentiqueServiceImpl.java
[INFO] 293/293 source files have been analyzed
[WARNING] Classes not found during the analysis : [javax.portlet.PortletRequest]
[INFO] Java Main Files AST scan (done) | time=21386ms
[INFO] Java Test Files AST scan
[INFO] 6 source files to be analyzed
[INFO] 6/6 source files have been analyzed
[INFO] Java Test Files AST scan (done) | time=334ms
[INFO] Sensor JavaSquidSensor (done) | time=21757ms
[INFO] Sensor PmdSensor
[INFO] Execute PMD 5.4.2...
[INFO] Java version: 1.7
[INFO] PMD configuration: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/pmd.xml
[INFO] PMD configuration: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/pmd-unit-tests.xml
[INFO] Execute PMD 5.4.2 done: 2375 ms
[INFO] Sensor PmdSensor (done) | time=2379ms
[INFO] Sensor CheckstyleSensor
[INFO] Execute Checkstyle 7.3...
[INFO] Checkstyle configuration: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/checkstyle.xml
[INFO] Checkstyle charset: UTF-8
[INFO] Execute Checkstyle 7.3 done: 1605 ms
[INFO] Sensor CheckstyleSensor (done) | time=1607ms
[INFO] Sensor SCM Sensor
[INFO] SCM provider for this project is: git
[INFO] 299 files to be analyzed
[INFO] 299/299 files analyzed
[INFO] Sensor SCM Sensor (done) | time=3669ms
[INFO] Sensor FindBugs Sensor
[INFO] Loading findbugs plugin: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/findbugs/fb-contrib.jar
[INFO] Loading findbugs plugin: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/findbugs/findsecbugs-plugin.jar
[INFO] Findbugs output report: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/findbugs-result.xml
The following classes needed for analysis were missing:
org.junit.runners.model.Statement
org.junit.Assert
org.assertj.core.api.Assertions
org.assertj.core.api.AbstractIntegerAssert
org.assertj.core.api.ListAssert
org.assertj.core.api.AbstractListAssert
org.junit.rules.TestRule
org.h2.Driver
org.assertj.core.groups.Tuple
[INFO] Sensor FindBugs Sensor (done) | time=23684ms
[INFO] Sensor SurefireSensor
[INFO] Property 'sonar.junit.reportsPath' is deprecated. Use property 'sonar.junit.reportPaths' instead.
[INFO] parsing [/workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/surefire-reports]
[INFO] Sensor SurefireSensor (done) | time=114ms
[INFO] Sensor JaCoCoSensor
[INFO] Analysing /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/jacoco.exec
[INFO] No information about coverage per test.
[INFO] Sensor JaCoCoSensor (done) | time=512ms
[INFO] Sensor JaCoCoItSensor
[INFO] JaCoCoItSensor: JaCoCo IT report not found: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/jacoco-it.exec
[INFO] Sensor JaCoCoItSensor (done) | time=0ms
[INFO] Sensor JaCoCoOverallSensor
[INFO] Analysing /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/jacoco.exec
[INFO] Analysing /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Services/target/sonar/jacoco-overall.exec
[INFO] No information about coverage per test.
[INFO] Sensor JaCoCoOverallSensor (done) | time=212ms
[INFO] Sensor SonarJavaXmlFileSensor
[INFO] Sensor SonarJavaXmlFileSensor (done) | time=2ms
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=119ms
[INFO] Sensor Code Colorizer Sensor
[INFO] Sensor Code Colorizer Sensor (done) | time=4ms
[INFO] Sensor CPD Block Indexer
[INFO] JavaCpdBlockIndexer is used for java
[INFO] Sensor CPD Block Indexer (done) | time=283ms
[INFO] ------------- Scan MP Web UI jenkins
[INFO] Base dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Webui
[INFO] Working dir: /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Webui/target/sonar
[INFO] Source paths: src/main/webapp, pom.xml, src/main/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[WARNING] Invalid character encountered in file /workspace/workspace/MP-pipeline_jenkins-HSMRPDPBA52NIJUTYCTAAM5Q76P4BDGNRHEXQ6VTGOHHOGM5XPRQ/Webui/src/main/webapp/js/my/widgets/templates/TutorialWidget.html at line 3 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
The only way to make it work is adding -Dsun.jnu.encoding=UTF-8 when doing the sonarqube analysis. Why does maven need this setting for the sonar-maven-plugin but not for anything else (like mvn clean install) ?
I'm trying to setup SonarQube.com on travis for a maven project, but I see the following exception on build:
[INFO] User cache: /home/travis/.sonar/cache
[INFO] Load global settings
[INFO] Load global settings (done) | time=456ms
[INFO] User cache: /home/travis/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=16ms
[INFO] Download sonar-scm-cvs-plugin-1.0.jar
[INFO] Download sonar-scm-svn-plugin-1.3.jar
[INFO] Download sonar-plsql-plugin-2.9.0.901.jar
[INFO] Download sonar-csharp-plugin-5.8.0.660.jar
[INFO] Download sonar-java-plugin-4.7.1.9272.jar
[INFO] Download sonar-web-plugin-2.5.0.476.jar
[INFO] Download sonar-flex-plugin-2.3.jar
[INFO] Download sonar-xml-plugin-1.4.2.885.jar
[INFO] Download sonar-vbnet-plugin-3.0.3.346.jar
[INFO] Download sonar-swift-plugin-2.0.0.1127.jar
[INFO] Download sonar-python-plugin-1.7.0.1195.jar
[INFO] Download sonar-github-plugin-1.4.0.699.jar
[INFO] Download sonar-cfamily-plugin-4.6.0.7071.jar
[INFO] Download sonar-auth-github-plugin-1.3.jar
[INFO] Download sonar-rpg-plugin-2.1.0.736.jar
[INFO] Download sonar-scm-mercurial-plugin-1.1.1.jar
[INFO] Download sonar-googleanalytics-plugin-1.1.jar
[INFO] Download sonar-widget-lab-plugin-1.8.1.jar
[INFO] Download sonar-pli-plugin-1.5.0.702.jar
[INFO] Download sonar-javascript-plugin-2.21.0.4409.jar
[INFO] Download sonar-groovy-plugin-1.4.jar
[INFO] Download sonar-cobol-plugin-3.3.1.1636.jar
[INFO] Download sonar-scm-git-plugin-1.2.jar
[INFO] Download sonar-php-plugin-2.10.0.2087.jar
[INFO] Download sonar-abap-plugin-3.3.jar
[INFO] Download sonar-governance-plugin-2.0.0.1789.jar
[INFO] Download qualinsight-sonarqube-badges-3.0.1.jar
[INFO] SonarQube version: 6.3.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:42 min
[INFO] Finished at: 2017-04-03T09:47:20+00:00
[INFO] Final Memory: 70M/468M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project jraft: No license for governance -> [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
Here is the .travis.yml:
language: java
jdk:
- oraclejdk8
addons:
sonarqube:
organization: ${SONAR_ORGANIZATION}
token:
secure: ${SONAR_TOKEN}
script:
- ./travis.sh
cache:
directories:
- $HOME/.m2/repository
- $HOME/.sonar
- $HOME/jvm
- $HOME/maven
Here is the travis.sh:
#!/bin/bash
set -e
INITIAL_VERSION=1.0-SNAPSHOT
export MAVEN_OPTS="-Xmx1G -Xms128m"
mvn package sonar:sonar \
$MAVEN_ARGS \
-Dsonar.host.url=$SONAR_HOST_URL \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.projectVersion=$INITIAL_VERSION
Why I am seeing this error No license for governance as I am not using any commercial sonar component (only sonar-java I suppose)?
The problem seems to be related to the fact that one of the plugins needs a commercial key, but How I can tell Travis to only install the java plugin?
Taking a look at your repository, you should not override the various parameters that the Travis Add-on is specifying for you.
More specifically, when you override SONAR_TOKEN on the Maven command line (at line 12), the consequence is that the token that you have encrypted and passed at line 11 of your .travis.yml file is completely wiped out. Because of this, your analysis is run like if you were anonymous.
So please follow the Get Started guide and simply run the following Maven command:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
sonar-governance plugin is commercial plugin.
check here
.....
[INFO] Download sonar-governance-plugin-2.0.0.1789.jar
......
For me the below works from my jenkins pipeline
node{
stage 'Code Quality'
sh "mvn sonar:sonar -Dsonar.host.url=http://<hostname>:9000"
}
I am trying to build the Californium repository https://github.com/eclipse/californium using maven. Typing "mvn clean install" gives the following output:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.eclipse.californium:californium-core:jar:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. # line 29, column 18
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Californium (Cf) Root
[INFO] Californium (Cf) Core
[INFO] Californium (Cf) Proxy
[INFO] Californium (Cf) OSGi Bundle
[INFO] Cf-PlugtestClient
[INFO] Cf-PlugtestChecker
[INFO] Cf-PlugtestServer
[INFO] Cf-HelloWorldClient
[INFO] Cf-HelloWorldServer
[INFO] Cf-SecureServer
[INFO] Cf-ExampleCrossProxy
[INFO] Cf Benchmark Server
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Californium (Cf) Root 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.californium:element-connector:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Californium (Cf) Root ............................. FAILURE [0.097s]
[INFO] Californium (Cf) Core ............................. SKIPPED
[INFO] Californium (Cf) Proxy ............................ SKIPPED
[INFO] Californium (Cf) OSGi Bundle ...................... SKIPPED
[INFO] Cf-PlugtestClient ................................. SKIPPED
[INFO] Cf-PlugtestChecker ................................ SKIPPED
[INFO] Cf-PlugtestServer ................................. SKIPPED
[INFO] Cf-HelloWorldClient ............................... SKIPPED
[INFO] Cf-HelloWorldServer ............................... SKIPPED
[INFO] Cf-SecureServer ................................... SKIPPED
[INFO] Cf-ExampleCrossProxy .............................. SKIPPED
[INFO] Cf Benchmark Server ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.894s
[INFO] Finished at: Thu Jun 26 18:29:52 CEST 2014
[INFO] Final Memory: 6M/109M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project root: Could not resolve dependencies for project org.eclipse.californium:root:pom:1.0.0-SNAPSHOT: Could not find artifact org.eclipse.californium:element-connector:jar:1.0-SNAPSHOT -> [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/DependencyResolutionException
I tried different things but still Idon't know how to fix this errors and go on with my work. Can anyone help me?
MORE INFO:
Downloding and installing (mvn clean install) Californium Element Connector https://github.com/eclipse/californium.element-connector.git brings the build of Californium a little farther, but there are still some dependencies missing. I think that one of these is californium Scandium, but after I downloaded it, I found out that it also has some building problems...
Actually, all I want to use is the repo caled californium.tools (https://github.com/eclipse/californium.tools), which is based on Californium. I checked the pom.xml of californium.tools, and it already includes the required dependencies. However,when I build, I get the following errors:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Californium (Cf) Tools
[INFO] Cf-ConsoleClient
[INFO] Cf-GUIClient
[INFO] Cf-CoAPBench
[INFO] Cf-ExampleServer
[INFO] Cf-ResourceDirectory
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Californium (Cf) Tools 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) # tools ---
[INFO] Deleting file set: /home/ceccog/californium.tools/target (included: [**], excluded: [])
[INFO]
[INFO] --- maven-jar-plugin:2.4:test-jar (default) # tools ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/ceccog/californium.tools/target/tools-1.0.0-SNAPSHOT-tests.jar
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) # tools >>>
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) # tools <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) # tools ---
[INFO]
[INFO] --- maven-install-plugin:2.3:install (default-install) # tools ---
[INFO] Installing /home/ceccog/californium.tools/pom.xml to /home/ceccog/.m2/repository/org/eclipse/californium/tools/1.0.0-SNAPSHOT/tools-1.0.0-SNAPSHOT.pom
[INFO] Installing /home/ceccog/californium.tools/target/tools-1.0.0-SNAPSHOT-tests.jar to /home/ceccog/.m2/repository/org/eclipse/californium/tools/1.0.0-SNAPSHOT/tools-1.0.0-SNAPSHOT-tests.jar
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Cf-ConsoleClient 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.californium:scandium:jar:1.0.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Californium (Cf) Tools ............................ SUCCESS [0.886s]
[INFO] Cf-ConsoleClient .................................. FAILURE [0.078s]
[INFO] Cf-GUIClient ...................................... SKIPPED
[INFO] Cf-CoAPBench ...................................... SKIPPED
[INFO] Cf-ExampleServer .................................. SKIPPED
[INFO] Cf-ResourceDirectory .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.161s
[INFO] Finished at: Wed Jul 02 11:42:57 CEST 2014
[INFO] Final Memory: 7M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project cf-client: Could not resolve dependencies for project org.eclipse.californium:cf-client:jar:1.0.0-SNAPSHOT: Could not find artifact org.eclipse.californium:scandium:jar:1.0.0-SNAPSHOT -> [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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cf-client
EDIT: it looks like the maven repositories are online now and the bug in cf-secure has been fixed. So only step 4 is required to install the californium tools.
The repositories mentioned in README.md do not seem to be online yet. Therefore maven can not resolve the dependencies automatically. The trick is to build and install the maven artifacts directly from source in the appropriate order.
So in order to get californium.tools working:
install org.eclipse.californium:element-connector
git clone https://github.com/eclipse/californium.element-connector.git
cd californium.element-connector
mvn clean install
install org.eclipse.californium:scandium
git clone https://github.com/eclipse/californium.scandium.git
cd californium.scandium
mvn clean install
install org.eclipse.californium:californium-core
git clone https://github.com/eclipse/californium.git
cd californium
mvn -pl :californium-core -am clean install
Note that we are only building the californium-core submodule (with the -pl :californium-core -am flag), since there is a bug in cf-secure which causes the build to fail.
build the Californium tools
git clone https://github.com/eclipse/californium.tools.git
cd californium.tools
mvn -pl :cf-browser,:cf-coapbench,:cf-rd,:cf-server -am clean install
We need to exclude cf-client since it has a bug which makes the build fail.
To run any of the tools, just cd californium.tools/run and java -jar ... the appropriate jar.
Sorry, the project was recently created at eclipse.
Hudson is populating the maven repository now.