I would like to be able to run ruby and perl scripts from build.xml in ant.
Languages like Ruby have Java implementations.
<project name="RunRubyExample">
<property environment="env" />
<script language="ruby" manager="bsf">
<classpath>
<fileset dir="${env.JRUBY_HOME}/lib" includes="*.jar" />
</classpath>
print 'hello world'
</script>
</project>
See the list of languages supporting the JSR233 standard.
Unfortunately no Java version of Perl is available. The only way to run Perl scripts is to invoke the interpreter directly:
<project name="RunPerlExample">
<exec executable="perl" failonerror="true">
<arg value="-e" />
<arg value="print 'hello world'" />
</exec>
</project>
You can always use the ant`s exec task to run arbitrary programs, such as ruby and perl. For example and from the docs:
<target name="help">
<exec executable="cmd">
<arg value="/c"/>
<arg value="ant.bat"/>
<arg value="-p"/>
</exec>
</target>
Related
I am running this in Bamboo using command task executable=Gradle.
<target name="deploy-jar">
<exec executable="${maven.bin}" >
<arg value="deploy:deploy-file" />
<arg value="-DgroupId=${groupid}" />
<arg value="-DartifactId=${artifact}" />
<arg value="-Dversion=${version}" />
<arg value="-Dpackaging=jar" />
<arg value="-Dfile=${file}" />
<arg value="-Durl=${maven.repo.url}"/>
<arg value="-DrepositoryId=${maven.repo.id}" />
</exec>
</target>
The build is failing due to incorrect executable="${maven.bin}"
Would someone be able to give me the proper maven project location for it to run in Bamboo successfully? or at least an idea.
Thank you!!
I am using TeamCity to build the.Net Solution using Nant script and everything works fine if I hard Code the solution path. I want to use Environment Variables from TeamCity (env.) to be used as Solution Path -->env.solution.path----- C:\a\testteamcity\Demo\deptest.sln inside Nant script test.build file:
<?xml version="1.0"?>
<project name ="first Nant file" default="compile-solution" >
<property name="bin.folder.svn" value="C:\a\testteamcity\Demo\bin123"/>
<property name="bin.folder.sln" value="C:\cicheckout\webapp\bin"/>
<target name="compile-solution">
<exec program="C:\Program Files (x86)\MSBuild\12.0\Bin\Msbuild.exe" verbose="true" >
<arg line="${environment::get-variable('env.solution.path')}" />
<arg value="/p:Configuration=Release" />
</exec>
<copy todir="${bin.folder.sln}" overwrite="true" failonerror="true">
<fileset basedir="${bin.folder.svn}">
</fileset>
</copy>
</target>
</project>
Error:Unexpected token 'Punctuation'.
Expression: ${environment::get-variable(‘env.solution.path’)}
Any Help would be great.Thanks
Create system.solution.path --> C:\a\testteamcity\demo\deptest.sln under System Properties (system.) in Teamcity and in Nant script-->
<?xml version="1.0"?>
<project name ="Build-Solution" default="build-solution" >
<property name="solution.path" value="${system.solution.path}" dynamic="true" unless="${property::exists('solution.path')}"/>
<!-- Build solution -->
<target name="build-solution">
<exec program="C:\Program Files (x86)\MSBuild\12.0\Bin\Msbuild.exe" verbose="true" >
<arg line="${solution.path}" />
<arg value="/p:Configuration=Release" />
</exec>
</target>
</project>
I have written an app in Objective-C for running it on Mac(OSX not iOS). I want to use it for direct distribution. In XCode, I can create .app file using Product -> Archive -> Distribute.
How do I create .app file using ant?
I found the answer myself. My ant.xml is as follows
<project name="MacAgent" default="MacCompile">
<property name="keychain.password" value="my_password"/>
<property name="user" value="my_username"/>
<property name="project.id" value="my_project_name"/>
<property name="xcodeHome" value="/Applications/Xcode.app/Contents/Developer"/>
<target name="MacCompile">
<exec executable="security">
<arg value="unlock-keychain"/>
<arg value="-p"/>
<arg value="${keychain.password}"/>
<arg value="/Users/${user}/Library/Keychains/login.keychain"/>
</exec>
<exec executable="${xcodeHome}/usr/bin/xcodebuild">
<arg value="-project"/>
<arg value="${project.id}.xcodeproj"/>
<arg value="clean"/>
<arg value="build"/>
</exec>
</target>
</project>
I'm trying to install highcharts exporting server(by java). I want to write below maven command line in build.xml file of my project. Not run from cmd.
$ cd highcharts-export/
$ mvn install
How should I do that in build.xml file?
I wrote following in build.xml file and run by ANT. But nothing happens. And idea?
<target name="buildHighchartsExporting" description="Builds highcharts exporting">
<exec dir="${basedir}/highcharts-export" executable="cmd">
<arg value="mvn" />
<arg line="-f highcharts-export/pom.xml install" />
</exec>
<target name="buildWarFile" description="Builds highcharts exporting War">
<exec dir="${basedir}/highcharts-export/highcharts-export-web" executable="cmd">
<arg value="mvn" />
<arg line="clean package" />
</exec>
If you are just trying to execute a project where the pom.xml is at another folder, you can use the -f parameter:
6.1.6. Using a Custom POM or Custom Settings File
If you don’t like the pom.xml file name, the location of your user-specific Maven
settings, or the default location of your global settings file, you
can customize any of these things with the following options:
-f, --file <file>
Forces the use of an alternate POM file
This way, from where you'd execute:
$ cd highcharts-export/
$ mvn install
You can just use:
$ mvn -f highcharts-export/pom.xml install
Running mvn from an ANT build.xml file
You can use the Ant Exec Task:
<target name="buildProject" description="Builds the project">
<exec dir="${source.dir}\${projectName}" executable="cmd">
<arg value="mvn" />
<arg line="-f highcharts-export/pom.xml install" />
</exec>
</target>
Or, more specifically (to your example):
<target name="buildWarFile" description="Builds highcharts exporting War">
<exec dir="${basedir}/highcharts-export" executable="cmd">
<arg value="mvn" />
<arg line="clean package" />
</exec>
What is the exact way of generating a Java code using WSDL in a ant build file? There were so many ways given, but most of them are not reorganized by Ant.
There is Axis Ant Task for this. There is also CXF way of doing things. I would use Apache CXF, like this:
<target name="cxfWSDLToJava">
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-client"/>
<arg value="-d"/>
<arg value="src"/>
<arg value="MyWSDL.wsdl"/>
<classpath>
<path refid="cxf.classpath"/>
</classpath>
</java>
</target>