Error Failed to open properties file : AppManage.tra from Ant script - java

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>

Related

Adding autoprefix-cli to ANT build

I am trying to add autoprefix-cli to my ANT build. Below is my code.
<target name="auto">
<apply executable="autoprefixer-cli.bat" verbose="true" force="true" failonerror="true">
<arg value="-d" /> <!-- Turn on verbose -->
<arg value="prefix" />
<arg value="*.css" />
</apply>
</target>
When i do a ant build, it gives me an error saying resource not specified.
BUILD FAILED
D:\tempTest\AntTestProject\build.xml:25: no resources specified
Note: I can access autoprefix-cli from command line, its installed with -g flag and also it works when i directly use it from commandline.
The apply task basically loops the exec task on a batch of resources (files, directories, URLs, etc). If you only want to run one command, use exec instead.
However, you will likely also need to alter your command. From Ant's exec task documentation:
Note that .bat files cannot in general by executed directly. One
normally needs to execute the command shell executable cmd using the
/c switch.
https://ant.apache.org/manual/Tasks/exec.html
So instead you should have:
<exec executable="cmd" verbose="true" force="true" failonerror="true">
<arg value="/c" />
<arg value="autoprefixer-cli.bat" />
<arg value="-d" />
<arg value="prefix" />
<arg value="*.css" />
</exec>

Build Automation TFS ANT

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.

using ant svn task to get the version of a working copy?

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>

Ant & Mercurial

I am trying to add some tag information in my ant script using the following target but I get an error (Result=-1) and hg tells me it does not recognise the command:
<target name="-post-init">
<exec outputproperty="hg.tag" executable="hg">
<arg value="parents --template {latesttag}+{latesttagdistance}" />
</exec>
</target>
If I only include value="parents" it works fine.
If I run the command line hg parents --template {latesttag}+{latesttagdistance} it works fine too.
Any ideas on what is wrong in my syntax?
Just tried this and it works fine:
<exec outputproperty="hg.tag" executable="hg">
<arg value="parents" />
<arg value="--template" />
<arg value="{latesttag}+{latesttagdistance}" />
</exec>
I needed to split the arguments.

Running a class from within a jar using ant

im trying to invoke a specific class from within a jar file but I'm gettign below exception -
Buildfile: C:\Projects\GranHermano\build.xml
SignJadFilesInDir:
[java] java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
My jar file contains all required jars (in this case poi-3.6-20091214.jar) so above exception should not be thrown.
This is how I am invoking the class -
<target name="SignJadFilesInDir" description="Signs all jad files in a dir" >
<java classname="com.src.SignDeviceJadInDir">
<classpath>
<pathelement location="BuildUtils.jar"/>
</classpath>
<arg line="${jadFileDir}"/>
<arg line="${devicesExcelDir}"/>
<arg line="${wtkDir}"/>
<arg line="${keyStoreDir}"/>
<arg line="${keyStoreId}"/>
<arg line="${keyStorePwd}"/>
</java>
</target>
Thanks
Can you please open jar BuildUtils.jar to ensure it well contains the classes of poi (and not poi jar, as I'm not aware of JRE support for jar-in-a-jar out of the box) ?
If your BuildUtils.jar contains poi-3.6-20091214.jar and not its classes, your exception is quite normal.

Categories