downloaded 'sonarqube-ant-task-2.7.0.1612.jar' and set the classpath using it, but It doesn't work

447 views Asked by At

I tried to analyze code with sonar-scanner which is installed on our Jenkins server with ant-build. And every time of analyzing we download 'sonarqube-ant-task-2.7.0.1612.jar' from our Nexus repository. cause we work with closed network.

But there is a problem. Even the sonarqube-ant-task-2.7.0.1612.jar was dawnloaded(workspace/modules) and I checked it up with ls -al command,

+ curl -u ****:**** http://nexus.adpaas.cloud.samsungds.net/repository/VM/lib/sonarqube-ant-task-2.7.0.1612.jar --output sonarqube-ant-task-2.7.0.1612.jar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  618k  100  618k    0     0  14.8M      0 --:--:-- --:--:-- --:--:-- 15.1M
+ mv ./sonarqube-ant-task-2.7.0.1612.jar ./workspace/modules
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] echo
Location : /home/jenkins/workspace/portal-space185041/ssd/dev/fw5channel-sonar
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] script
[Pipeline] {
[Pipeline] echo
Build : 20201012.135547
[Pipeline] sh
 > git rev-list --no-walk 0af1889ccfbd347f427d3a1d5d15c9a33886e6be # timeout=10
+ ls -al workspace/modules
total 632
drwxr-xr-x 2 jenkins jenkins    152 Oct 12 13:55 .
drwxr-xr-x 3 jenkins jenkins    152 Oct 12 13:55 ..
-rw-r--r-- 1 jenkins jenkins 633825 Oct 12 13:55 sonarqube-ant-task-2.7.0.1612.jar

But, still the analysis use default sonar library located in Jenkins Image like below.

    [sonar:sonar] Apache Ant(TM) version 1.10.5 compiled on July 10 2018
    [sonar:sonar] SonarQube Ant Task version: 2.2
    [sonar:sonar] Loaded from: file:/usr/share/ant/ant-1.10.5/lib/sonar-ant-task-2.2.jar

I also set up the build.xml for Sonar analysis.

<target name="sonar" depends = "init, resources-dev, compile">
        <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
            <!-- Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
            <classpath path ="./workspace/modules/sonarqube-ant-task-2.7.0.1612.jar.jar"/>
        </taskdef>
        <sonar:sonar/>

with the sonarqube official annotation above( Update the following line, or put the "sonarqube-ant-task-*.jar" file in your "$HOME/.ant/lib" folder ), I guess that the latter is valid when I don't set the the former 'classpath' option. isnt it?

although it works well, no errors, I have to make a template. so I need to know exact reason of it. Anyone knows the reason? Thanks a lot in advance.

0

There are 0 answers