Praveen
Praveen

Reputation: 11

How can I use ant <exec> to execute commands on Windchill?

Need to run this below command in the Ant exec tag.

windchill ext.cummins.securityLabel.CumminsLoadAgreement -d %WT_HOME%/loadFiles/ext/cummins/Agreements/AgreementList/Agreement_Loader.xlsx -u wcadmin -p wcadmin

Upvotes: 1

Views: 289

Answers (2)

Loic Mouchard
Loic Mouchard

Reputation: 1141

In a your ant xml file, define a ant target with the tag , the path for Windchill Home is accessible with the variable ${env.WT_HOME}

<project name="YourProjectName" default="YourTargetName" basedir=".">
    <target name="YourTargetName">
        <exec executable="windchill" dir="." failonerror="true">
            <arg line="ext.cummins.securityLabel.CumminsLoadAgreement -d ${env.WT_HOME}/loadFiles/ext/cummins/Agreements/AgreementList/Agreement_Loader.xlsx -u wcadmin -p wcadmin" />
        </exec>
    </target>
</project>

From a windchill shell you can then run the target as "usual":

ant -f yourFile.xml YourTargetName

Tipp: if you name your ant file build.xml, you even do not need to specify it as parameter.

Upvotes: 0

Vignesh Vino
Vignesh Vino

Reputation: 1238

You can make use of Java Task in your ant script to perform this.

Use the below script

<java classname="ext.cummins.securityLabel.CumminsLoadAgreement" fork="true">
            <arg value="${username}"/>
            <arg value="${password}"/>
            <arg value="-d"/>
            <arg path="${Your_Custom_Directory}/${Custom_file}"/>
        </java>

Upvotes: 0

Related Questions