Jenkins + Sonar












0















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









share|improve this question



























    0















    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









    share|improve this question

























      0












      0








      0








      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









      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 16 '14 at 19:04









      user3735260user3735260

      53




      53
























          2 Answers
          2






          active

          oldest

          votes


















          2














          You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).






          share|improve this answer































            1














            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.






            share|improve this answer























              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              2














              You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).






              share|improve this answer




























                2














                You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).






                share|improve this answer


























                  2












                  2








                  2







                  You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).






                  share|improve this answer













                  You haven't set the "sonar.binaries" property to point to the build directory (= "target/classes" if you compile it with Maven).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 17 '14 at 14:13









                  Fabrice - SonarSource TeamFabrice - SonarSource Team

                  22k24851




                  22k24851

























                      1














                      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.






                      share|improve this answer




























                        1














                        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.






                        share|improve this answer


























                          1












                          1








                          1







                          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.






                          share|improve this answer













                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 20 '15 at 8:52









                          Hugo DominguezHugo Dominguez

                          386




                          386






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              這個網誌中的熱門文章

                              Xamarin.form Move up view when keyboard appear

                              Post-Redirect-Get with Spring WebFlux and Thymeleaf

                              Anylogic : not able to use stopDelay()