Jenkins + Sonar
I have a project Pensky with two build Jobs on my Jenkins Server. The First Build job does maven build and collects JaCoCo Code coverage report on Post Build Action.
My Second Build Job runs Sonar Analysis on my project. I would like to reuse/feed the JaCoCo code coverage report into my Sonar. But, unable to do so. I see the below message in my build job console
"Project coverage is set to 0% as build output directory does not
exist:"
The sonar job is looking for 'classes' folder in the .sonar directory (in the jenkins job directory).
Can anyone guide me how to feed the report into Sonar. Thank you
This is my sonar.properties
sonar.projectKey=Pensky
sonar.projectName=Pensky
sonar.projectVersion=1.1
sonar.projectDescription= GE Pensky
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.language=java
sonar.my.property=value
sonar.forceAnalysis=true
sonar.jacoco.reportPath=target/jacoco.exec
maven jenkins sonarqube
add a comment |
I have a project Pensky with two build Jobs on my Jenkins Server. The First Build job does maven build and collects JaCoCo Code coverage report on Post Build Action.
My Second Build Job runs Sonar Analysis on my project. I would like to reuse/feed the JaCoCo code coverage report into my Sonar. But, unable to do so. I see the below message in my build job console
"Project coverage is set to 0% as build output directory does not
exist:"
The sonar job is looking for 'classes' folder in the .sonar directory (in the jenkins job directory).
Can anyone guide me how to feed the report into Sonar. Thank you
This is my sonar.properties
sonar.projectKey=Pensky
sonar.projectName=Pensky
sonar.projectVersion=1.1
sonar.projectDescription= GE Pensky
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.language=java
sonar.my.property=value
sonar.forceAnalysis=true
sonar.jacoco.reportPath=target/jacoco.exec
maven jenkins sonarqube
add a comment |
I have a project Pensky with two build Jobs on my Jenkins Server. The First Build job does maven build and collects JaCoCo Code coverage report on Post Build Action.
My Second Build Job runs Sonar Analysis on my project. I would like to reuse/feed the JaCoCo code coverage report into my Sonar. But, unable to do so. I see the below message in my build job console
"Project coverage is set to 0% as build output directory does not
exist:"
The sonar job is looking for 'classes' folder in the .sonar directory (in the jenkins job directory).
Can anyone guide me how to feed the report into Sonar. Thank you
This is my sonar.properties
sonar.projectKey=Pensky
sonar.projectName=Pensky
sonar.projectVersion=1.1
sonar.projectDescription= GE Pensky
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.language=java
sonar.my.property=value
sonar.forceAnalysis=true
sonar.jacoco.reportPath=target/jacoco.exec
maven jenkins sonarqube
I have a project Pensky with two build Jobs on my Jenkins Server. The First Build job does maven build and collects JaCoCo Code coverage report on Post Build Action.
My Second Build Job runs Sonar Analysis on my project. I would like to reuse/feed the JaCoCo code coverage report into my Sonar. But, unable to do so. I see the below message in my build job console
"Project coverage is set to 0% as build output directory does not
exist:"
The sonar job is looking for 'classes' folder in the .sonar directory (in the jenkins job directory).
Can anyone guide me how to feed the report into Sonar. Thank you
This is my sonar.properties
sonar.projectKey=Pensky
sonar.projectName=Pensky
sonar.projectVersion=1.1
sonar.projectDescription= GE Pensky
sonar.sources=src/main/java
sonar.tests=src/test/java
sonar.language=java
sonar.my.property=value
sonar.forceAnalysis=true
sonar.jacoco.reportPath=target/jacoco.exec
maven jenkins sonarqube
maven jenkins sonarqube
asked Jul 16 '14 at 19:04
user3735260user3735260
53
53
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).
add a comment |
First of all, you should to copy the folder target of the first job in order to save time. If you do that, you have in the workspace of the job, all the binaries and the jacoco.exec file.
Then, you have to set the folder of the tests result.
sonar.junit.reportsPath=target/surefire-reports(or other)
sonar.jacoco.ReportPath=target/jacoco.exec
And finally, you have to set the binaries folder.
sonar.binaries=target/classes
Hope I have been helpful.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24788689%2fjenkins-sonar%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).
add a comment |
You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).
add a comment |
You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).
You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).
answered Jul 17 '14 at 14:13
Fabrice - SonarSource TeamFabrice - SonarSource Team
22k24851
22k24851
add a comment |
add a comment |
First of all, you should to copy the folder target of the first job in order to save time. If you do that, you have in the workspace of the job, all the binaries and the jacoco.exec file.
Then, you have to set the folder of the tests result.
sonar.junit.reportsPath=target/surefire-reports(or other)
sonar.jacoco.ReportPath=target/jacoco.exec
And finally, you have to set the binaries folder.
sonar.binaries=target/classes
Hope I have been helpful.
add a comment |
First of all, you should to copy the folder target of the first job in order to save time. If you do that, you have in the workspace of the job, all the binaries and the jacoco.exec file.
Then, you have to set the folder of the tests result.
sonar.junit.reportsPath=target/surefire-reports(or other)
sonar.jacoco.ReportPath=target/jacoco.exec
And finally, you have to set the binaries folder.
sonar.binaries=target/classes
Hope I have been helpful.
add a comment |
First of all, you should to copy the folder target of the first job in order to save time. If you do that, you have in the workspace of the job, all the binaries and the jacoco.exec file.
Then, you have to set the folder of the tests result.
sonar.junit.reportsPath=target/surefire-reports(or other)
sonar.jacoco.ReportPath=target/jacoco.exec
And finally, you have to set the binaries folder.
sonar.binaries=target/classes
Hope I have been helpful.
First of all, you should to copy the folder target of the first job in order to save time. If you do that, you have in the workspace of the job, all the binaries and the jacoco.exec file.
Then, you have to set the folder of the tests result.
sonar.junit.reportsPath=target/surefire-reports(or other)
sonar.jacoco.ReportPath=target/jacoco.exec
And finally, you have to set the binaries folder.
sonar.binaries=target/classes
Hope I have been helpful.
answered Jan 20 '15 at 8:52
Hugo DominguezHugo Dominguez
386
386
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24788689%2fjenkins-sonar%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown