acceleo compiler, 5:The metamodel couldn't be resolved - ant

I am attempting to create a standalone ant build file for android. We are using acceleo to generate code.
Here are the steps i am taking within the build.xml.
compile the auto generator
Generate the EMTL files
Generate the code from the EMTL files
Right now, i can run step 1 and it works fine. Then i run step 2 and it fails with the following errors (Step 2 Errors). And then i can run step 3 and it works fine. I then check all of my files and generated code and everything looks fine. However, those errors from step 2 are really bothering me and i need to get them resolved.
Any help will be greatly appreciated and if you need more information, please let me know.
Posted below are the steps in the build.xml and the errors for step 2.
the build.xml information
<target name="compileAutogen" description="Compiles Autogen">
<javac
srcdir="${AUTOGEN_SRC}"
destdir="${AUTOGEN_BIN}"
classpath="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.2.0.v20111027-0537.jar"
executable="${JAVA_JDK}/javac"
fork="true"
includeantruntime="false"
failonerror="false"
/>
</target>
<target name="generateEMTL" description="Generates the EMTL files for Autogen">
<acceleoCompiler sourceFolder="${AUTOGEN_SRC}"
outputFolder="${AUTOGEN_BIN}"
dependencies=""
binaryResource="false"
packagesToRegister="org.eclipse.emf.ecore.EcorePackage">
</acceleoCompiler>
</target>
<target name="generateFrameworkCode" description="Generates the generated code for Framework">
<java
classname="framework.generator.main.Main"
classpath="${AUTOGEN_BIN};${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.7.0.v20110520-1406.jar;${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.1.1.v20110823-1646.jar;${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.1.0.v20110913-1213.jar;${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.0.v20110505/runtime_registry_compatibility.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar;${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.100.v20110404.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.4.1.R37x_v20110725.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar;${ECLIPSE_HOME}/plugins/com.google.collect_1.0.0.v201105210816.jar"
fork="true">
<arg value="${MODEL}"/>
<arg value="${TARGET}"/>
</java>
</target>
<target
name="generateFramework"
description="Compiles Autogen, prepares the emtl files and runs the generator for Framework"
depends="compileAutogen, generateEMTL, generateFrameworkCode"
/>
(Step 2 Errors)
generateEMTL:
[acceleoCompiler] generateDataAccessObject.mtl
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler]
[acceleoCompiler] generatePerstNode.mtl
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler]
[acceleoCompiler] TreeWalk.mtl
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler]
BUILD FAILED
C:\Framework\build.xml:170: generateDataAccessObject.mtl
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved
generatePerstNode.mtl
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved
TreeWalk.mtl
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved
at org.eclipse.acceleo.parser.compiler.AcceleoCompiler.execute(AcceleoCompiler.java:121)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Acceleo indicates that the metamodel could not be resolved. What are the packages used by your generator? If you are just using http://www.eclipse.org/EMF/2002/Ecore, you may be able to compile without registering the metamodel as "Ecore" is a specific use case. Otherwise, you should write the classes of the packages of your metamodel instead of "org.eclipse.emf.ecore.EcorePackage".

Removing extra stuff out of the [module generateDataAccessObject(...)] actually fixed the problem. If i only include http://www.eclipse.org/emf/2002/Ecore and http://www.eclipse.org/acceleo/mtl/3.0 then it works.

Related

SONAR - java.lang.IllegalStateException: Infinite loop in property interpolation of ${SQLSCRIPT}: SQLSCRIPT

I have very simple Sonar configuration with Ant task:
<target name="upload_to_sonar">
<property name="sonar.jdbc.url" value="jdbc:oracle:thin:#server:1521:sid"/>
<property name="sonar.host.url" value="http://sonar:80"/>
<property name="sonar.jdbc.username" value="SONAR"/>
<property name="sonar.jdbc.password" value="SONAR"/>
<property name="sonar.projectKey" value="test"/>
<property name="sonar.projectName" value="test"/>
<property name="sonar.projectVersion" value="trunk"/>
<property name="sonar.language" value="java"/>
<property name="sonar.sources" value="sources_for_sonar"/>
<property name="sonar.binaries" value="classes_for_sonar"/>
<taskdef name="sonar" classname="org.sonar.ant.SonarTask">
<classpath path="${EXTERNAL}/sonar-ant-task-2.0.jar" />
</taskdef>
<sonar/>
</target>
Those folders contain sources and classes in root level.
For some reason execution gives me following error no matter how I configure it:
Buildfile: D:\trunk\src\build.xml
upload_to_sonar:
[sonar:sonar] Apache Ant(TM) version 1.8.2 compiled on December 20 2010
[sonar:sonar] Sonar Ant Task version: 2.0
[sonar:sonar] Loaded from: file:/D:/trunk/src/./sources/external/sonar-ant-task-
2.0.jar
[sonar:sonar] Sonar work directory: D:\trunk\src\.sonar
[sonar:sonar] Sonar server: http://sonar:80
BUILD FAILED
D:\trunk\src\build.xml:132: org.sonar.runner.RunnerException: java.lang.IllegalS
tateException: Infinite loop in property interpolation of ${SQLSCRIPT}: SQLSCRIP
T
at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
at org.sonar.runner.Runner.execute(Runner.java:151)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:93)
at org.sonar.ant.SonarTask.execute(SonarTask.java:75)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.IllegalStateException: Infinite loop in property interpolat
ion of ${SQLSCRIPT}: SQLSCRIPT
at org.apache.commons.lang.text.StrSubstitutor.checkCyclicSubstitution(S
trSubstitutor.java:701)
at org.apache.commons.lang.text.StrSubstitutor.substitute(StrSubstitutor
.java:645)
at org.apache.commons.lang.text.StrSubstitutor.substitute(StrSubstitutor
.java:656)
at org.apache.commons.lang.text.StrSubstitutor.substitute(StrSubstitutor
.java:563)
at org.apache.commons.lang.text.StrSubstitutor.replace(StrSubstitutor.ja
va:305)
at org.apache.commons.configuration.PropertyConverter.interpolate(Proper
tyConverter.java:958)
at org.apache.commons.configuration.AbstractConfiguration.interpolate(Ab
stractConfiguration.java:446)
at org.apache.commons.configuration.CompositeConfiguration.getList(Compo
siteConfiguration.java:312)
at org.apache.commons.configuration.AbstractConfiguration.getList(Abstra
ctConfiguration.java:1109)
at org.apache.commons.configuration.CompositeConfiguration.getStringArra
y(CompositeConfiguration.java:320)
at org.sonar.batch.Batch.convertToProperties(Batch.java:89)
at org.sonar.batch.Batch.create(Batch.java:78)
at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:6
8)
at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sonar.runner.Runner.delegateExecution(Runner.java:285)
... 19 more
Total time: 1 minute 12 seconds
SONAR server version is 3.2
Ant task version 2.0
Enabling verbosity don't give any additional details whatsoever
Created a ticket for community http://jira.codehaus.org/browse/SONARPLUGINS-2704

Ant can't find an ant class (DateUtils) while building

I'm trying to get a project to build via ant. It builds just fine via ant on my local machine, but on our build machine I get :
java.lang.NoClassDefFoundError: org/apache/tools/ant/util/DateUtils
at org.apache.tools.ant.DefaultLogger.formatTime(DefaultLogger.java:323)
at org.apache.tools.ant.DefaultLogger.buildFinished(DefaultLogger.java:170)
at org.apache.tools.ant.Project.fireBuildFinished(Project.java:
at org.apache.tools.ant.Main.runBuild(Main.java:778)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.util.DateUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
This happens within the jaxb-code-generation target and happens when it calls a simple ant copy method. The class it can't find (DateUtils) is within the ant.jar itself and I can't figure out how to get it to load the ant.jar for this target (which I would have thought already had the ant.jar available since it's running within ant). I know this is a classpath problem but cannot figure out how to fix it.
Here's the part of the ant build file up to the copy that fails:
<target name="jaxb-code-generation" depends="xjc-typedef-target,-do-init,-init-macrodef-javac">
<mkdir dir="${build.generated.sources.dir}/jaxb" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig"/>
<mkdir dir="build/generated/jaxbCache" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig"/>
<mkdir dir="build/generated/jaxbCache/Listing"/>
<xjc package="Listing" destdir="build/generated/jaxbCache/Listing" catalog="catalog.xml">
<classpath>
<pathelement location="${src.dir}"/>
<pathelement path="${jaxbwiz.xjcrun.classpath}"/>
</classpath>
<arg value="-xmlschema"/>
<schema file="xml-resources/jaxb/Listing/Listing.xsd"/>
<depends file="xml-resources/jaxb/Listing/Listing.xsd"/>
<produces dir="build/generated/jaxbCache/Listing"/>
</xjc>
<copy todir="${build.generated.sources.dir}/jaxb">
<fileset dir="build/generated/jaxbCache/Listing"/>
</copy>
Again, this works fine on my local machine. Both my local machine and the build machine are running Java 1.6 and Ant 1.7.1 and both are linux (mine is Linux Mint and the build machine is Ubuntu).
UPDATE: Data point: I created a new build.xml that just copies a file, that's it. it used the same ant method and that worked fine when run solo.
I had this same problem (same error, at least) in what seems like a related build problem.
The solution that worked for me was simply to set ANT_HOME environment variable.
This seems unnecessary, because ant is in the PATH, so I'd expect it would have found everything it needed, but it appeared to not. When I set ANT_HOME to the correct path, the same project then built.
Sometimes I use this:
jarfinder
You can check org/apache/tools/ant/util/DateUtils
I am not sure which you miss, but maybe helps to guess.
Run xjc native with something like this:
<target name="xjc">
<exec executable="xjc">
<arg value="-d"/>
<arg value="src"/>
<arg value="-p"/>
<arg value="bla.bla.bla"/>
<arg value="${xjc.in.dir}/bla.xsd"/>
</exec>
</target>
Works flawless for me.
found here

How to change the Path variable in ant exec task?

I tried setting the Path variable in ant exec task using this link. But its not working somehow. I am trying to add THRIFT_HOME which is set to basedir currently and I have the thrift.exe file in the basedir.
Also, when I change executable attribute value to thrift.exe, the thrift compiler works properly but the basedir is not added to the Path.
<exec executable="thrift">
<env key="Path" value="${env.Path};${THRIFT_HOME}" />
</exec>
I also tried using the setx command as:
<exec executable="setx">
<arg value="Path"/>
<arg value="%Path%;${THRIFT_HOME}"/>
</exec>
but it still does not work.
Any help would be appreciated!
how about this:
<property environment="env"/>
<!-- to see if you can access it -->
<echo message="${env.Path}" />
<exec executable="thrift">
<env key="Path" value="${env.Path};${THRIFT_HOME}" />
</exec>
I've found a hint here: http://www.factsandpeople.com/facts-mainmenu-5/23-other-software-technologies/125-using-environment-variables-in-ant-environment-variables-are-not-evaluated
I am currently using on Windows 7 and the problem was with spaces in the folder name. That's a big problem when working on Windows.
I tried placing the thrift executable at /d/thrift/ and it worked and assigning THRIFT_HOME = /d/thrift. Then I tried /d/thrift demo/ and there is the problem.
D:\noknok_fido_to_ostp\noknok_fido_to_ostp_workspace\Demo\build.xml:33: Execute failed: java.io.IOException: Cannot run program "thrift-0.9.0.exe": CreateProces
s error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 23 more
Another problem is that /d/thrift doesn't work in Eclipse Ant plugin build. I tried it using command prompt and the build was successful.
This teaches a new lesson: Always build from command prompt!
Thanks to all who answered for this question.
And what about searchpath attribute ?
searchpath: When this attribute is true, then system path environment variables will be searched when resolving the location of the executable. since Ant 1.6.3
So I think something like this:
<exec executable="thrift" searchpath="true">
<env key="Path" value="${env.Path};${THRIFT_HOME}" />
</exec>
should work.
I found it works by quote the value of variable
<exec executable="setx">
<arg line="Path "${env.Path};c:\test Path"" />
<arg line="/m" />
</exec>
https://stackoverflow.com/a/23777929/3659861

Changed Sonar web.context, now ant task fails

I had a working sonar/jenkins installation, where sonar was installed on localhost:9000 and jenkins was on localhost:8080. I then wanted to hide those services behind Apache and protect them behind Crowd-authenticated account access.
So first, I relocated Jenkins to localhost:8080/jenkins and proxied it. Which worked.
Then I relocated Sonar to localhost:9000/sonar and proxied it. Which also worked.
But now, when I try to execute the Sonar task from within the build script in Jenkins, I get the following error:
sonar:
[sonar:sonar] Apache Ant version 1.7.1 compiled on April 26 2010
[sonar:sonar] Sonar Ant Task version: 1.2
[sonar:sonar] Loaded from: file:/usr/share/ant/lib/sonar-ant-task-1.2.jar
[sonar:sonar] Sonar work directory: /var/lib/jenkins/jobs/buzzcartes/workspace/.sonar
[sonar:sonar] Sonar server: http://localhost:9000
BUILD FAILED
org.sonar.batch.bootstrapper.BootstrapException: http://localhost:9000/api/server /version
at org.sonar.batch.bootstrapper.Bootstrapper.getServerVersion(Bootstrapper.java:71)
at org.sonar.ant.SonarTask.checkSonarVersion(SonarTask.java:225)
at org.sonar.ant.SonarTask.execute(SonarTask.java:188)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.io.FileNotFoundException: http://localhost:9000/api/server/version
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1610)
at java.net.URLConnection.getContent(URLConnection.java:748)
at org.sonar.batch.bootstrapper.Bootstrapper.remoteContent(Bootstrapper.java:123)
at org.sonar.batch.bootstrapper.Bootstrapper.getServerVersion(Bootstrapper.java:69)
... 18 more
I've updated the configuration in Jenkins to reflect the new location of http://localhost/sonar so I'm not sure where the http://localhost:9000/ is now coming from. I've looked in a variety of config files so far with no joy and Google isn't turning up any good answers so far. Any pointers would be most welcome.
Oh, my sonar task in build.xml looks like this:
<target name="sonar" depends="compile">
<!-- list of mandatory Sonar properties -->
<property name="sonar.sources" value="${basedir}/src" />
<!-- list of optional Sonar properties -->
<property name="sonar.projectName" value="buzzcartes" />
<property name="sonar.binaries" value="${basedir}/build" />
<property name="sonar.tests" value="${basedir}/test" />
<property name="sonar.libraries" value="${basedir}/lib" />
<sonar:sonar key="com.benjasoft:buzzcartes" version="0.1-SNAPSHOT" xmlns:sonar="antlib:org.sonar.ant" />
Thanks!
Try so set the sonar.host.url parameter
Maven
<sonar.host.url>http://wherever.sonar.com:9000</sonar.host.url>
Ant
<property name="sonar.host.url" value="http://wherever.sonar.com:9000" />
Strangely it is not documented here, but mentioned in the ant task guide.

How to correctly setup a conditional task with Maven-Ant?

New Ant user here. I've created a conditional task, which is run inside as a Maven Ant plugin. The issue I'm facing is the condition target: "ui-test-condition" is not being found during a build.
The error returned is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (uitests) on project myProject: An Ant BuildException has occured: Target "ui-test-condition" does not exist in the project "maven-antrun-". It is used from target "ui-test-run". -> [Help 1]
This would suggest a syntax error in the code below, however I'm unable to identify the issue. Any assistance is greatly appreciated.
<target name="ui-test" depends="ui-test-run,ui-test-skip"/>
<target name="ui-test-condition">
<condition property="ui-test-condition-run">
<and>
<istrue value="${ui.test}"/>
</and>
</condition>
</target>
<target name="ui-test-run" depends="ui-test-condition" if="ui-test-condition-run">
<echo>Running tests</echo>
<exec dir="src/main/webapp/ui" executable="src/main/webapp/ui/${some.executable}"
resolveexecutable="true" failonerror="true">
<arg value="-e" />
<arg value="foo/run" />
</exec>
</target>
<target name="ui-test-skip" depends="ui-test-condition" unless="ui-test-condition-run">
<echo>Tests are skipped</echo>
</target>
I had the exact same problem and I found the answer is that the depends property of a target is not supported by maven-antrun-plugin.
Excerpt of http://maven.apache.org/plugins/maven-antrun-plugin/usage.html
Ultimately, you could specify some Ant <target/> attributes in the <target/> tag. Only depends attribute in Ant <target/> is not wrapped.
That does not prevent the feature from working, at least not from experience; by just removing the depends property and ordering the targets properly, it works.
Moreover, only the last target is considered by maven-antrun-plugin. You therefore need to find a way to evaluate your condition directly in that target.

Resources