I am using the following open source version of image J in an experiment:
https://github.com/pcj/arterioj
it uses ANT.
Of of the ant targets is:
stats
<!-- ================================================================ -->
<!-- Stats and plot generation tasks -->
<!-- ================================================================ -->
<target name="stats">
<exec executable="R">
<arg line="--vanilla --no-readline --quiet --slave --file=${basedir}/ldip-data.R --args"/>
</exec>
</target>
when I try to use this target I get the following build error message:
BUILD FAILED
/Users/James/ArterioJ/build.xml:179: Execute failed: java.io.IOException: Cannot run program "R" (in directory "/Users/James/ArterioJ"): error=2, No such file or directory
I am unsure how to fix this. I have tried to copy the R package into the /users/James/ArterioJ directory to see if that would help but to no effect.
Thanks
You might want to specify the full path of the R executable, for instance:
<property name="r.home" value="/home/me/R_INSTALL"/>
<target name="stats">
<exec executable="${r.home}/R">
<arg line="--vanilla --no-readline --quiet --slave --file=${basedir}/ldip-data.R --args"/>
</exec>
</target>
Alternatively, if the path to the executable is part of the PATH environment variable, you could just add the searchpath="true" attribute to the exec task:
<exec executable="R" searchpath="true">
<arg line="--vanilla --no-readline --quiet --slave --file=${basedir}/ldip-data.R --args"/>
</exec>
Here is an extract from the Ant documentation about searchpath:
When this attribute is true, then system path environment variables
will be searched when resolving the location of the executable
Related
I have all other modules on ant while a new module has been added on maven. So, I have created build_dl.xml file in the same directory level as pom.xml
<project name="Income">
<target name="mvn">
<exec dir="." executable="sh">
<arg line=" -c 'mvn clean install'" />
</exec>
</target>
</project>
On executing the build file ant -buildfile build_dl.xml I am getting logs saying BUILD SUCCESSFUL
Total time: 0 seconds but actually the pom.xml doesnt gets executed and no target folder is created. Could anyone please help where I am going wrong.
Try running mvn directly as the executable, and pass your args individually with value, instead of all at once with line:
<project name="Income">
<target name="mvn">
<exec dir="." executable="mvn">
<arg value="clean" />
<arg value="install" />
</exec>
</target>
</project>
After building EAR file when i'm trying to extract XML file form the EAR i'm getting error [exec] Failed to open properties file : AppManage.tra
<property name="Appmanage" value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.exe" />
<target name="extract">
<exec executable="${Appmanage}">
<arg value="-export"/>
<arg value="-ear"/>
<arg value="${workdir}\Deploy\EARs\${project}.ear"/>
<arg value="-out"/>
<arg value="${workdir}\Deploy\EARs\${project}.xml"/>
<arg value="-max"/>
</exec>
old Q : can someone share simple build.xml to create ear file from ant script
details : i'm able to pull repositories with the help ant script now i want to create EAR file from ant script for Tibco BW. can any one share simple demo .
try to solve this error using below steps.
try to check your environment variable path.
check TRA_HOME/bin/ using App manage utility.
This error "Failed to open properties file : AppManage.tra" occurs because the AppManage executable tries to look for AppManage.tra in the current execution directory and does not find it. In this particular case, the current execution directory would depend on where you are executing Ant from.
The correct way to avoid this error is to provide full path to the AppManage.tra file as an argument to the AppManage executable in the ant exec statement, as shown below, in the highlighted section (two new arguments are added "--propFile" and "full path to AppManage.tra"). Hope this helps.
<property name="Appmanage" value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.exe" />
<target name="extract">
<exec executable="${Appmanage}">
<arg value="--propFile"/>
<arg value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.tra"/>
<arg value="-export"/>
<arg value="-ear"/>
<arg value="${workdir}\Deploy\EARs\${project}.ear"/>
<arg value="-out"/>
<arg value="${workdir}\Deploy\EARs\${project}.xml"/>
<arg value="-max"/>
</exec>
I am trying to create TFS ANT build script.When getting the resource for TFS from ant : "com/teamprise/ant/antlib.xml". It is not able to load the jar. I understand from the search that ,this antlib.xml is no more supported. Can any body suggest me which resource to look for to get the access of command line tfs commands in my ant script.
Following is the snippet of the code:
<path id= "tfsant.classpath" >
<fileset dir= "${env.ANT_HOME}/lib" >
<include name= "*teamprise-ant*.jar" />
</fileset>
</path>`enter code here`
<typedef resource="com/teamprise/ant/antlib.xml" classpathref="tfsant.classpath" />
<exec executable="tf">
<arg value="checkout"/>
<arg value="${tfsroot}/temp/BUILD_${build.number}"/>
<arg value="${workdir}"/>
</exec>
You can install Team Explorer Everywhere on your machine. This will install the TF Command-Line utility. Configure the environment variable "Path" for tf.exe, then you can access to tf command directly from your ANT script.
Im trying to invoke a bash scrip from an ant target. This is my target :
<target name="report" depends="test">
<!-- Step 3: Create coverage report -->
<exec executable="./checkStyle.sh"
failonerror="true"
osfamily="unix"/>
<jacoco:report>
<!-- This task needs the collected execution data and ... -->
<executiondata>
<file file="${result.exec.file}" />
</executiondata>
<!-- the class files and optional source files ... -->
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="${result.classes.dir}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<!-- to produce reports in different formats. -->
<html destdir="${result.report.dir}" />
<csv destfile="${result.report.dir}/report.csv" />
<xml destfile="${result.report.dir}/report.xml" />
</jacoco:report>
</target>
And my bash script is :
#!/bin/bash
DEST_FOLDER='./target/checkstyle'
CLASSES_FILE='classes.txt'
REPORT_FILE='report.xml'
mkdir -p "$DEST_FOLDER"
rm -f "$DEST_FOLDER/$CLASSES_FILE"
rm -f "$DEST_FOLDER/$REPORT_FILE"
find ./project -name "*.java" >> "$DEST_FOLDER/$CLASSES_FILE"
while read p; do
java -jar ./utilJars/checkstyle-6.5-all.jar -c ./sun_checks.xml -f xml $p >> "$DEST_FOLDER/$REPORT_FILE"
done < $DEST_FOLDER/$CLASSES_FILE
When typing ./checkStyle everything works fine, but when I try "ant report" the following error is raised:
BUILD FAILED
/home/luci/workspace/operations/build.xml:60: exec returned: 3
Total time: 4 seconds
I`ve searched on google and that code seems to be "permision denied", but i dont know how i could solve this problem.
Generally with Ant (and Java), you cannot directly execute shell scripts. You need to execute the interpreter/shell and give the script as an argument.
For example:
<exec executable="/bin/bash" failonerror="true" osfamily="unix">
<arg value="-c"/>
<arg value="./checkStyle.sh"/>
</exec>
Is there a way use the svn ant task to get the svn revision number of a working copy and put it into a variable?
I would like to add an entry in my Java manifest file which includes the svn revision number, e.g. 0.9.65361 where 65361 is the revision number.
Aha, I found this idea, which depends only on the svnversion command-line utility in SVN.
<project name="ant-exec-example" default="svnversion" basedir=".">
<target name="svnversion">
<exec executable="svnversion" outputproperty="svnversion" />
<echo message="SVN Version: ${svnversion}"/>
</target>
</project>
Here's where it captures the version in an ant property:
<exec executable="svnversion" outputproperty="svnversion" />
There are a couple of ways -
Use a utility - I believe you are looking for this - https://code.google.com/p/svntask/ I have used it for some side
projects and it works well.
Use commandline utility. - "svn info http://svn.myweb.com/myproject". To use this method simply create a
batch file and put this command in the batch file. Then call this
batch file from your ant task and get the revision number from the
text by searching for that starts with line "Revision:". Or you can
just dump the whole result.
Here is my variant to bundle svn revisions info within the application artifact:
<target name="svn_revisions">
<hostinfo prefix="HOST"/>
<echo file="${dir.out}/.revisions" message="Built by ${user.name} on ${HOST.NAME}${line.separator}"/>
<exec dir="${basedir}" executable="svn" output="${dir.out}/.revisions" append="true">
<arg line="info"/>
</exec>
<exec dir="${basedir}" executable="svn" output="${dir.out}/.revisions" append="true">
<arg line="status -u"/>
</exec>
</target>
<target name="build-war" depends="compile, svn_revisions">
<war basedir="web" file="${dir.out}/ROOT.war" webxml="web/WEB-INF/web.xml">
<!-- main stuff -->
<zipfileset dir="${dir.out}" prefix="META-INF" includes=".revisions"/>
</war>
</target>