How to use incremental mode in SonarQube? - maven

I've trying to fiddle with SonarQube and now I'm learning about the incremental mode. In my understanding it should analyze only the changed files.
So my first test is just to run SonarQube twice on our project without any change. I run SonarQube (5.1.2) installed locally on windows 7 64-bit machine with SSD drive and I7 CPU. We use java 1.7 and Maven 3.3.3. Our project is fairly big (~570 modules) of maven, most of them are java code. After I run a prepare-agent of jacoco along with my unit tests I understand that its time to run sonar:sonar and create a report.
So what I try is:
mvn sonar:sonar -Dsonar.analysis.mode=incremental -Dsonar.host.url=http://localhost:9000 -Dsonar.java.coveragePlugin=jacoco
This runs for 20 minutes. Ok, now I run the same command again without doing any change and it still runs the same 20 minutes
So my question is - whether someone can explain me how to use the incremental mode correctly? I have a hard time understanding what I'm doing wrong, in my understanding the second run has to be much faster, otherwise I don't see any advantage over the preview mode here.
Thanks Mark

The incremental mode will analyze only changed files since latest "regular" analysis on server. So in your case you should first run a normal (now called "publish") analysis:
mvn sonar:sonar -Dsonar.java.coveragePlugin=jacoco
Then your can use the incremental mode:
mvn sonar:sonar -Dsonar.analysis.mode=incremental -Dsonar.java.coveragePlugin=jacoco

Related

Maven build through Jenkins pipeline takes 4 times longer than usual

Our Jenkins pipeline has a stage to build with following command -
mvn clean install -DdestFolder=<destination-folder-path>
Above command takes 1 hour when run through pipeline. If same is run locally from same machine, it takes only 15 mins.
When run through Jenkins pipeline, I can see enough memory, enough space. Also I had explicitly assigned memory to maven using MAVEN_OPTS, still same result.
Could you please help to understand what could be wrong here?

Reduce Travis-CI building time for Gradle

I've started a new project of SprintBoot and Kotlin and I wanted to use Travis-CI as my CI server.
I also wanted to use codecov to collect the reports about my code coverage
Everything seems to work perfectly beside one thing, My project currently is an empty SpringBoot project that contains (and no tests) and the build itself takes up to 2m (mostly due to the time it takes to install Gradle).
I checked on their site and saw some optimizations to the build, but they're looked to early for this stage of the project (e.g. parallel tests execution).
Am I missing something? is 2m is the baseline for Travis-CI building time?
My current configurations for Travis :
# This enables the 'defaults' to test java applications:
language: java
# We can specify a list of JDKs to be used for testing
# A list of available JDKs in Trusty can be seed in:
# https://docs.travis-ci.com/user/reference/xenial/#jvm-clojure-groovy-java-scala-support
jdk:
- openjdk11
before_script:
# makes sure that gradle commands can be executed on build
- chmod +x gradlew
script:
# Makes sure that gradle can be executed.
- ./gradlew check
# Generates the reports for codecov
- ./gradlew jacocoTestReport
# This is to enable CodeCov's coverage
# If a build is successful, the code is submitted for coverage analysis
after_success:
- bash <(curl -s https://codecov.io/bash)
You'll want to cache to improve speeds of your build on Travis. Gradle has a dedicated guide on building on Travis: https://guides.gradle.org/executing-gradle-builds-on-travisci/
For caching, scroll down to Enable caching of downloaded artifacts

How to get cppcheck-results into SonarQube

We use cpp-check and SonarQube 6.0 and want to inject the results of cppcheck into the system. Cppcheck runs fine and produces an xml-file with results. However Cpp-check and SonarQube are not running on the same machine.
Is it sufficient to set something in
Administration > C++(Community) > CodeCode analysis > Cppcheckreports ?
We put the name of the xml into that field - but how should SonarQube find that?
What are we missing here?
The cppcheck plugin for SonarQube has not been maintained for 6 years now and won't work with resent versions of SonarQube. https://github.com/SonarQubeCommunity/sonar-cppcheck/issues/6#issuecomment-377563241
SonarQube and Cppcheck don't have to run on the same machine. But the Cppcheck report does need to be available to the analysis. If you can't run analysis on the machine where Cppcheck runs, then you just need to set up some process (FTP? Sneakernet?) to get the file where it needs to go.
This all assumes you have the Cppcheck plugin installed in SonarQube, as well as some plugin, such as SonarC++($), which declares the language.

How to run Apache Tez Locally?

One of the ways that one can execute tez is in local mode beside integrated with hadoop. In order to run it localy
I read this page and understood the changes I have to make and I updated tez-site.xml configuration. But I don't know how to start it.
I tried running one of the tez-examples (e.g. wordCount) that has a main method. But it stalls and don't print anything to stdout. Is there anything that I have to start first?
How can I run tez in local mode?
I managed to run it with including needed libraries. I could changing pom and build the final jar file with the dependencies, but I preferred not to change the project.
After building it with mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true
I ran it with setting java classpath:
java -cp tez-dist/target/tez-0.7.0/lib/*:tez-dist/target/tez-0.7.0/* org.apache.tez.examples.OrderedWordCount in.txt out

Improve gradle startup time with groovyserv or nailgun or what

I'm trying to improve the startup time of Gradle. The expererimental --daemon switch doesn't seem to really speed it up. So I'm thinking to use some server process independent of gradle, and make gradle connect to it. The options I found so far are
nailgun to invoke java
GroovyServ to invoke a groovy script
Since gradle is started by a shell script, it takes some tweaking. My question is: has anyone used the above options to start gradle? Or if you have successfully used another option, what's that?
My guess is that your build is doing something at configuration time that it should be doing at execution time. With m5, gradle build --profile will give you an HMTL report showing where the time goes. Another way to see what's going on is gradle build --info or gradle build --debug.

Resources