I am trying to analyze the code smells of apache tomcat with sonarqube for my university project. I have installed sonarqube community version. I couldn’t run it for apache tomcat. Please help me with the procedure that how can I configure sonarcube for apache tomcat.
I realize now that there may be a better way to incorporate Sonar scanner analysis into your Ant script: exec the vanilla Sonar scanner instead of using the Sonar scanner for Ant.
Hi, Thanks a lot for your help. I was able to successfully build the Tomcat but when I was ant sonar -Dsonar.login=yourAuthenticationToken; it says Build failed, target sonar doesn’t exist.
I have attached a few screen-shorts:
When I gave the mentioned command, it shows the build failed:
sonarqube-ant-task-*.jar for the sonar ant scanner has to be in sight for ant
The most simple way is to start your ant scripts via bat file like that
set ANT_HOME=c:\tools\apache-ant-1.10.12
set ANT_ARGS=-lib c:\tools\ant_extralibs
set JAVA_HOME=c:\Program Files\JavaSoft\JDK\1.8.0_201
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%
:: default
ant -f %1
:: debug
:: ant -debug -f %1
when the ant_extralibs folder has all the additional ant tasks like i.e. sonarqube-ant-task, antcontrib,
xmltask, ant-flaka … etc.
Then you don’t need the taskdef as given in the example snippet of the sonarqube scanner for ant documentation.
<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="path/to/sonar/ant/task/lib/sonarqube-ant-task-*.jar" />
</taskdef>