org.sonar.runner.impl.RunnerException: Unable to execute Sonar - ant

I am trying to integrate Sonar task in Ant build in Eclipse. SonarQube server is running successfully at the default port on localhost. On opening "http://localhost:9000/" in browser, SonarQube web interface is successfully opening.
Problem is when I am running Sonar task from Ant build file it is giving error "org.sonar.runner.impl.RunnerException: Unable to execute Sonar". That's it. No stacktrace is logged on console.
The sonar task in ANt build is defined as below:
<target name="sonar" depends="jcompile">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="<PathToAntPlugin>/lib/sonar-ant-task-2.2.jar" />
</taskdef>
<property name="sonar.projectDescription" value="Example application using Ant and Jacoco" />
<property name="sonar.sources" value="${basedir}/src" />
<property name="sonar.host.url" value="http://localhost:9000"/>
<property name="sonar.surefire.reportsPath" value="${reports.junit.xml.dir}" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.jacoco.antTargets" value="run-tests" />
<property name="sonar.projectKey" value="<PathToMyProject>" />
<property name="sonar.projectVersion" value="1.0" />
<sonar:sonar xmlns:sonar="antlib:org.sonar.ant"/>
</target>
Other details:
SonarQube Server 4.5,
sonar-ant-task-2.2.jar,
JDK 1.6.0_21,
Eclipse Kepler
Is there any comptability issue between the jdk, eclipse, sonar server or sonar ant jar? Is there any way to find the detail logs in order to debug the issue?
Apart from above issue, I am having other issue. When I am installing SonarCube plugin in eclipse, in Windows ->Preferences SonarCube is not coming. However, in installed software list in Eclipse it is listed. I have tried to run eclipse with -clean option but no success. Please let me know what could be the problem?

When we are running the build file from eclipse it is not giving full stack trace on console in some cases. Try to run the build file from the command prompt.
For example:
Open command prompt window and go to eclipse ant bin directory path(In my system it is C:\eclipse\plugins\org.apache.ant_1.9.6.v201510161327\bin) and from here run your build file using ant command.
C:\eclipse\plugins\org.apache.ant_1.9.6.v201510161327\bin>ant -buildfile [path_of_build_file]\build-test.xml
I know I am late, but this is to help who visits this with same problem

For the missing preferences, the Installation FAQ of Sonar says to do a restart with -clean argument.

Related

How to run a Junit Plugin Test using Ant from eclipse

How can we run a junit plugin test using ant from eclipse, also from command prompt? I'm using Junit4.4.
The org.eclipse.test plugin provides a library.xml file that contains ant tasks for running plugin tests both in UI (ui-test target) and headless (core-test target) modes. Example of invoking the task below, you'll need to provide a few properties to suite your own environment and check the org.eclipse.test plugin version:
<property name="library-file"
value="${eclipse-home}/plugins/org.eclipse.test_3.2.0/library.xml" />
...
<ant target="ui-test" antfile="${library-file}"
dir="${eclipse-home}">
<property name="data-dir" value="${workspace}" />
<property name="plugin-name" value="${plugin-name}" />
<property name="classname"
value="com.example.MyTestSuite" />
<property name="junit-report-output" value="${results.dir}"/>
</ant>

Apache tomcat server 7.0.42 fails to start after running ant build script

I am using apache ant 1.9.4. I have written build xml for starting apache tomcat server 7.0.42. But the server closes as soon it gets started. Also the build is showing successfull.
My build.xml is.,
<property name="build.dir" value="aar" />
<property name="deploy-location" value="D:\EIT SOFTWARES\apache-tomcat-7.0.42_aqar\webapps" />
<property name="catalina.home" value="D:\EIT SOFTWARES\apache-tomcat-7.0.42_aqar"/>
<property name="tomcat" value="${catalina.home}" />
<target name="start-tomcat">
<echo message="Starting tomcat">
</echo>
<exec executable="${catalina.home}\bin\startup.bat"></exec>
</echo>
</target>
What i am making wrong. Ant experts please help me.

ant build failed xxx\xxx\build.xml:49: Java returned: -1

I am trting to build Blackberry project and generate the cod file.
My environment is Windows 7 and the apache-ant version is 1.8.2.
I have encountered two problems and they all lead to failure.
The command I used to build is "ant -Dbuild_env=prod"
Below is part of the code in the build.xml file.
<property file="build.properties" />
<property environment="SystemVariable"/>
<!--<property name="jde.home" value="${SystemVariable.JDE_HOME}"/> -->
<property name="jde.home" value="E:\eclipse-blackberry\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components"/>
<property name="bb_sign_pwd" value="${SystemVariable.BB_SIGN_PWD}"/>
<property name="jde.sigtooljar" value="${jde.home}/bin/SignatureTool.jar"/>
First problem:
If I use the code
<property name="jde.home" value="${SystemVariable.JDE_HOME}"/>
to run the building,
the error(error 1) is
"jde home must be a directory",
but if I use the code
<property name="jde.home" value="E:\eclipse-blackberry\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components"/>
it works but still build failed.
I think may be the ant cannot find the enviromental varialbe although I set the enviromental varialbe "JDE_HOME" in the Windows to "E:\eclipse-blackberry\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components".
Second problem:
Use the code
<property name="jde.home" value="E:\eclipse-blackberry\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components"/>
instead but another error(error 2) is
"XXX\XXX\XXX\build.xml:49:Java returned: -1"
Line 48 to 50 in the build.xml is like this
48:<target name="build" description="Builds Project" depends="init"/>
49:<rapc jdehome="${jde.home}" jdkhome="${SystemVariable.JAVA_HOME}" destdir="${output.dir}" output="${app.name}_${build_env}" quiet="false" generatesourcelist="true"/>
50:<jdp title="${app.title}" type="cldc" vendor="XXX Inc." version="${app.version}" description="XXX Application" icon="${icon.path}" focusicon="true" startuptier="7" ribbonposition="0"/>
Is there any one can help and tell me why there is error 1 and error 2?
Thanks.

Jenkins Phing Plugin - Resource Temporarily Unavailable

I have just started getting Jenkins setup with Phing as the build tool. Although I have used Jenkins before, I'm new to Phing.
I have a project setup in Jenkins that has a Mercurial Repository setup and a Phing Build step.
The build.xml file simply archives the existing file, deletes them and copies the new files from the repository.
I have run phing from the terminal and everything works as planned. However, when running from within Jenkins, I'm getting the following in the Console Output:
[workspace] $ /usr/local/pear/bin/phing -buildfile /Users/Shared/Jenkins/Home/jobs/Project/workspace/build.xml "-Dwebroot=/Volumes/Websites/Project/ -Dcheckoutroot=/Users/Shared/Jenkins/Home/jobs/Project/workspace -Drevision=5" -logger phing.listener.DefaultLogger
/usr/local/pear/bin/phing: fork: Resource temporarily unavailable
Build step 'Invoke Phing targets' marked build as failure
My first thought was that it was permission related, but I've changed Jenkins to run as the same user that I ran Phing manually as and it still got the same issue.
Does anybody have any thoughts as to what might be causing the problem?
I can't find anything related to this error anywhere that isn't related to Cygwin...
The system is running on OS X 10.7.5 with Jenkins 1.518 and Phing 2.5.1
The build.xml file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Project" default="dist">
<property name="revision" value="old" />
<property name="webroot" value="/Volumes/Websites/${phing.project.name}" />
<property name="checkoutroot" value="./" />
<target name="clean">
<echo msg="Backing up old site to ${phing.project.name}-${revision}..." />
<tar destfile="${webroot}/../${phing.project.name}-${revision}.tar.gz" basedir="${webroot}" compression="gzip" />
<echo msg="Deleting site from ${webroot}..." />
<delete>
<fileset dir="${webroot}" />
</delete>
</target>
<target name="dist" depends="clean">
<echo msg="Copying files to website at ${webroot}..." />
<copy todir="${webroot}">
<fileset dir="${checkoutroot}/Website">
<exclude name="**/.hg/**" />
</fileset>
</copy>
</target>
</project>
I've managed to resolve this issue by removing all of the path details in the Phing configuration section within Jenkins.
This makes absolutely no sense to me as to why it's working without these details as I definitely only have one Phing install, so it's not as if it was picking up the wrong one or something.
However, by not specifying anything in the Phing section of the Jenkins project config so it picks up the default path, default build target etc. and this is working flawlessly now!

ant builds running through maven issue

So I'm building a project with maven, and in this maven pom we have a reference to an ant build script. The maven pom triggers this ant build to build a project (an install of alfresco with mysql database and tomcat server packed up with it).
The issue seems to be when you try to set up a database for alfresco to use through the ant build. This is the part of the ant build.
<target name="createDatabase">
<exec spawn="false" executable="${mysql.home}/bin/mysql" failonerror="true">
<arg value="-u" />
<arg value="root" />
<arg value="-e" />
<arg value="source ${alfresco.home}\mysql\db_setup.sql" />
</exec>
</target>
I'm getting 'unknown command '\U' sent back to me as an error on this. Of course you can install the DB manually but I want it as part of this ant script. SOmeone I work with runs this successfully on XP, but I'm getting that error on win7. Any ideas?

Resources