I'm trying to configure a job that runs with Ant on Jenkins.
I was wonder if there is an option to change the path of the build.xml file
(that it will not run from /var/lib/jenkins/jobs//workspace/)
Thanks in advance
Try to set -Dbasedir=/do/start/here in java options or system properties in the job configuration
Related
Hi I need some help in overriding the user.home property of ant from Jenkins. I created a simple job on jenkins that runs a build script on a slave machine of the master. One of the tasks of the scripts is to use the user.home property of ant and access certain files. The problem is that when I try to echo this property from the command line of the slave machine, I see C:\Users\Administrator but when I run the exact the same script from the Jenkins server I see C:\ . This difference is causing the build to fail on Jenkins. Can anyone please tell me what is the reason for this difference? Is there any way I can override this?
I tried having a property called user.home in the config file of my job but it doesn't seem to pick it up. Another interesting point is that when I changed the user.home value to some gibberish in the config file and run ant from command line on the slave, it still picks it up as C:\Users\Administrator
I am using ant 1.7.1 and Jenkins 1.598
You likely have jenkins running as a different ID than Administrator. Which is a good thing.
Properties in ant are immutable so you can specify those properties from the ant plugin in jenkins and they'll override any other values. (click advanced under the invoke ant buildstep to see the properties text box).
I'd recommend you not override user.home but rather refactor your ant so there is a config.location property that defaults to user.home but can be overidden to whatever you want from jenkins. It just seems unnatural to ovrride user.home
I have a problem with the configuration in an ant project at jenkins with sonar. For to establish a ant project with sonar at Jenkins it's necessary to indicate the properties: sonar.projectVersion, sonar.projectName, sonar.projectKeys, sonar.binaries, sonar.libraries and sonar.sources. I would like knowing if it's possible to establish the projectVersion and projectName in the file build.xml or build.properties and to indicate in the sonar that it takes the value of these properties. For example:
build.properties (or build.xml):
project.name=XXX-XXX-XXX
project.version=2.0.3
Sonar configuration at Jenkins:
sonar.projectName=${project.name}
sonar.projectVersion=${project.version}
Thanks and sorry for my english.
This is not possible yet, but feel free to vote for https://jira.codehaus.org/browse/SONARUNNER-76
Dos it exist a way to propagate java system property from Tomcat to jenkins ant task?
Particularly I would like to propagate catalina.home property to ant task. When trying catalina.home=${catalina.home} I get error Property catalina.home was circularly defined.
so you want catalina.home of the tomcat that's running jenkins passed into your ant build?
hmmm... I'm not sure it's goign to work, but try setting the catalina.home property to the value of the CATALINA_HOME environment variable:
catalina.home=${evn.CATALINA_HOME}
It likely won't work, you'll want to see what you set CATALINA_HOME environment variable is and just pass that into your ant build:
ant -Dcatalina.home="/usr/share/tomcat7
I don't think you have direct access from your job configuration to your system properties. You will need to write your own plugin to read out the system properties.
Check if you have CATALINA_HOME available. If you do, pass it into ant (ant plugin has a field for that) or set it within your ant-script like thekbb suggested. catalina.home=${evn.CATALINA_HOME}
For some GUI testing I'm creating a Jenkins task for each GUI module to be tested.
Once created I'm using Ant to build these tests, but I'm not aware of how to actually pass parameters from Jenkins to Ant build file? Basically how do I do variable substitution in Ant?
I'm using the Sahi framework to test GUI components, so the flow goes like this...
Jenkins → Ant build script → Sahi file to execute
Can anyone please take a look at it?
"Using ant -Dname=value lets you define values for properties on the Ant command line." http://ant.apache.org/faq.html#passing-cli-args
To use a jenkins parameter as a variable when you call any use ${variablename}
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build
Click Advance under configure section of your job in jenkins and use "Properties" section to pass parameter value to Ant script.
e.g
jenkins.param=10
ant.prop=$jenkins.param where jenkins.param is the parameter defined in the jenkins job .
Now in your ant build script ,you can get the value by using ${ant.prop}.
From Jenkins to SAHI Pro via ANT.
In the ant target that you call from Jenkins, give the following within sahi tag.
<customfield key="variable_name" value=" variable _value"/>
Now, such values from Jenkins will be available in SAHI Pro through the ant target. To retrieve them in SAHI, you should set them in “CUSTOM_FIELDS” of testrunner file.
For example:
SET CUSTOM_FIELDS= -variable_name jenkinsToSahiVariable
Where -variable_name should be same key that you set in ant target. And second string will contain the value you set from Jenkins. To get this in a sahi file, use sahiSuite API like following.
$jenkinsValues = _suiteInfo();
$sahiVariable = $ jenkinsValues ["jenkinsToSahiVariable"];
Surely this must be easy. But nothing on the ant file config dialogs inside of intellij (10.5) has anything to do with working directories...
Thanks.
There is no way to configure it. Normally your script should be using paths relative to itself or some property.