I am trying to set up ANT build.
However when I invoke build command
helloworld_15/${NAME} does not exist.
BUILD FAILED (total time: 0 seconds)
Also the configure variables does not seems to be assigned.
However i have set them into /etc/envitonment
I tried echo $<varaiable_name> and value get displayed.
Tried to google but not solutions seems am the first one having this issue.
PS: OS Ubuntu 10.10
The environment variables of the calling shell are not, by default, converted into Ant properties. If you want to access them, you need to 'import' them using something like:
<property environment="e_pref" />
in your buildfile. Once you've done that, you can access them by means of the prefix you just set:
<echo message="NAME=${e_pref.NAME}" />
You can set environment="" - i.e. an empty prefix - but you would still need the dot to access:
<echo message="NAME=${.NAME}" />
Sorted out the issue.
Somehow netbeans ant does not access environment variables when run in sudo mode.
I didnt find out a solution for that but i settled down with non sudo UI fornetbeans.
Thanx for your valuable time and help.
Related
Is there any "adequate" way to change system properties in Jenkins? What is the easiest/fastest way change them? For instance, I need to turn off the useless (in my case) pinging thread.
If you really want a quick and simple way to change a system property, you can use the script console
System.setProperty("hudson.remoting.Launcher.pingIntervalSec", 0)
But that won't survive a restart. To make it permanent, add the setting to the java args. For me (CentOS, Jenkins 2.7.1) that's a line about halfway down /etc/sysconfig/jenkins (for other distributions I believe it's /etc/default/jenkins) where you should add your option to the existing list like this:
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.remoting.Launcher.pingIntervalSec=0"
You'll have to restart Jenkins after you make that change (thanks Mark Tickner)
If you run Jenkins on windows as a service without tomcat, you can edit jenkins.xml. Add the property in <service><arguments> before the -jar.
Than restart the service.
<service>
<!-- ... -->
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true -Dhudson.tasks.MailSender.SEND_TO_USERS_WITHOUT_READ=true -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>
The system properties available and how to set them are listed on the wiki:
https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties
To disable slave pinging, you can set hudson.remoting.Launcher.pingIntervalSec to 0.
System properties can be set in the same way as with any other Java program, e.g.:
java -Dhudson.remoting.Launcher.pingIntervalSec=0 -jar jenkins.war
If you use Tomcat on Windows you can edit the File C:\apache-tomcat-7.0.67\conf\catalina.properties and simply add the Line
hudson.DNSMultiCast.disabled=true
at the End of the File. Then safe the File and restart Tomcat.
I have the similar problem: I need to disable DNSMultiCast (set hudson.DNSMultiCast.disabled = false) and I can't understand how to do it
for example, https://wiki.jenkins-ci.org/display/JENKINS/Features+controlled+by+system+properties - there is such advice "...pass all of these arguments before the -jar argument..." but I run jenkins under tomcat so I am not sure I can change startup parameters.
I tried to change /etc/tomcat6/Catalina/localhost/jenkins.xml to
<?xml version="1.0" encoding="UTF-8"?>
<Context >
<Environment name="JENKINS_HOME" value="/var/jenkins"
type="java.lang.String" override="false"/>
<Environment name="hudson.DNSMultiCast.disabled" value="true"
type="java.lang.Boolean" override="false"/>
</Context>
but I didn't help.
Can someone explain how to change jenkins system properties when tomcat is used.
Maybe it's a bad hack but I set it in the pipeline job that needs the setting.
Like this:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") // allow formatted HTML pages to be published
It seems to work - as far as I can tell...
I followed each steps mentioned above but it fails.
So I did change the system time zone using timedatectl set-timezone Europe/London command and then I have restarted jenkins service service jenkins restart it worked.
I was using Rehdat 7.5
Jenkins version 2.168.
Jenkins Installed via yum install jenkins
I hope this will help some one.
I am running the following command from my ant target:
<exec executable="${soa.mypath}\deploy.exe" failonerror="true" vmlauncher="false">
<arg value="-n" />
<arg value="${myfile}" />
</exec>
Where ${soa.mypath} is B:\bin.
This drive B is a network drive that I mapped on a other server.
when I connect remotly to the server where that ant script is running I can totally see and browse the B drive via the Windows explorer and the user I use is the same user that runs tha ant script.
However when I run my target, I got this error:
[exec] The system cannot find the drive specified.
Which is very weird.
Do you know if I am missing some option in the exec command?
Thank you,
Regards
Using ant 1.9.3 under Windows 8.1 I was able to get this to work with no problem with a network-mounted drive, including various combinations of forward and backslashes in the path.
My only suggestion is to replace your property with the hard-coded executable path (B:\bin\deploy.exe) in the exec task and see if that works. Also - use hard-coded path to ${myfile}.
If deploy.exe has a -version command or similar you might also try that, to rule out the problem actually being in the drive/path of ${my file}.
hth
Ant seems to be ignoring one of my properties files.
<property file="local.properties" />
<property file="build.properties" />
build.properties contains the typical properties my team wants to use. I'm introducing local.properties which contains overrides for my specific workstation. We're using Eclipse for this project (I'm using Kepler), but regardless of whether I build in Eclipse or build via the command line the build fails because it is using some values in build.properties even though local.properties contains overrides.
In my specific case, my version of Java is newer than the other developers/environments. Despite specifying the version I have in local.properties, it still tries to use the compiler for the version in build.properties.
I know the values are fine because if I put my local properties in build.properties everything works.
Eclipse doesn't care about your build.xml or your properties files. That's only with Ant.
Try running ant with the -d flag, and capture STDOUT and STDERR. This will show you whether or not the local.proeprties is being read in and what values are set. It will say whether or not it's attempting to read local.properties, whether it found local.properties, and if so, what properties are being set.
Also remember that properties are set first come/first serve. You didn't say where in your build.xml you're reading in local.properties. It could be that this is being read in a target while other properties are set outside of targets. Even if they appear later in the build.xml file, properties set outside of any target are set first. If these are set, and you read in local.properties, local.properties isn't going to over ride them. I mention this because it was a problem I ran into here. Someone had a bunch of <property/> tasks placed at the end of their build.xml,and they didn't realize that these would be set before any target was run.
Again, try this:
Unix and Mac:
$ ant -d 2>&1 | tee ant.out # Allows you to see and capture the results
Windows
$ ant -d > ant.out 2>&1 # There's no "tee" command in Windows.
The output of ant.out will be thousands of lines long, but it'll help you figure out what's going on. What you post looks correct.
When I run targets on ant it says it is unable to locate the variable I passed to it.
Config for environment variables :
in build.xml
<property environment="Env"/>
but I am unable to find the parameter defined parameter with
${Env.CATALINA_HOME}
where in the .bash_profile
export CATALINA_HOME=/Users/olgunkaya/development/apache-tomcat-7.0.34
and export PATH=${PATH}:$CATALINA_HOME
What can I do to achive this ?
Before you run ant, check to see if CATALINA_HOME is actually defined as an environment variable. I bet you'll find it isn't. Ant doesn't read your .profile or .bash_profile before starting, so if it's not already defined in your environment, Ant won't see it.
As you've seen opening a terminal window on a Mac doesn't necessarily guarantee that the .bash_profile file is executed. Try setting up these environment variables in .bashrc file instead.
Or, you can force .bash_profile to run by setting it as the Startup file in Terminal. Select File->Preferences from the menu, go to the Shell tab, select your default shell, and then click the Run Command checkbox and put .bash_profile in there. That will guarantee that .bash_profile is executed with each new terminal window.
I had a similar problem when referencing a custom variable, which was definitely defined in the shell spawning ant.
The solution was to EXPORT the variable when defined (in ~/.profile), so the shell would pass it to its children.
I'm having an extremely strange problem with ant. This snippet produces a set of files with the correct names and timestamps, but with obsolete contents.
<target name="inflate-workspace">
<copy todir="${rns.workspace.dir}" preservelastmodified="true" >
<fileset dir="${git.dir}/azia" />
<fileset dir="${git.dir}/scrap-menagerie" />
</copy>
</target>
The resulting timestamps in toDir correctly match those in the filesets, but the contents of each file is about 2 days old. I activated the verbose flag and manually verified that the source and destination directories are correct. I also manually deleted the toDir and ran the target in isolation, to be sure nothing else weird was happening. Running cp -R ... with the exact same directories works perfect.
The environment is Debian on VBox, hosted in Windows 7. Google turns up nothing related to "ant copy obsolete file contents" or anything like it... anyone heard of such a thing? Please let me know, it's really a bother to have ant copy broken!
Try adding overwrite="true" to your copy command.
The problem here is that ant 1.8.0 was simply broken. I can't imagine why it was ever posted, or why it's still in synaptic for Debian. What a horrible bug... hacky apache.
Check for .class files that could be left forgotten and delete them before building next time with ant.