usetimestamp has no effect when using ant GET task? - ant

I am trying a GET from ant but the problem if I invoke it twice, the file is downloaded twice, it should download only once because I have set the usetimestamp to true, what could be the issue?
This is the ant get command I am using:
<get src="..." dest="..." verbose="true" usetimestamp="true" />
This is part of the log that I got:
[get] last modified = Wed May 17 10:51:19 EEST 2017

sorry all I found the solution to my issue, the problem is that I had another line of code that is deleting the directory before calling the ant GET. Once I removed this line of code, the usetimestamp flag worked flawlessly.

Related

Process leaked file descriptors jenkins ERROR on Jenkins

Can someone help me to solve an issue "process leaked file descriptors jenkins"?
I tried whit BUIL_ID = dontkillme but it doesnt work.
Thx
It would help to know more about what you're trying to run but this question came up as a result of troubleshooting an issue I was having so here's how I resolved it. I am using Windows so if you're using something else it may not work for you.
First of all you need to read and understand the Jenkins documentation on the issue: https://jenkins.io/redirect/troubleshooting/process-leaked-file-descriptors
I had to install Ant first since it was not installed.
https://ant.apache.org/bindownload.cgi
The Jenkins documentation gives you an example Ant script:
<exec executable="cscript.exe">
<env key="ANTRUN_TITLE" value="Title for Window" /> <!-- optional -->
<env key="ANTRUN_OUTPUT" value="output.log" /> <!-- optional -->
<arg value="//NoLogo" />
<arg value="antRunAsync.js" /> <!-- this script -->
<arg value="real executable" />
</exec>
You will change the "real executable" to be the executable you are wanting to run.
See that .js file in the 2nd arg value? You will need to create that. There's a link to this on the Jenkins documentation page too. Grab it here: https://wiki.jenkins.io/download/attachments/1835010/antRunAsync.js?version=1&modificationDate=1184046328000&api=v2
I didn't make any edits to the contents, just pasted it right in and saved it as antRunAsync.js
So now you take your Ant example script I posted above and throw that in a text editor, save as build.xml
From this point you should be able to test on the command line by typing ant and pressing enter. Your application should load in a different window.
If you haven't set up Ant in the Jenkins Global Tool Configuration do so now and point it to your Ant install (might have to uncheck the Install checkbox). In the Jenkins project add a build step Invoke Ant. Set that up how you like according to Ant documentation.
Hope this answer helps someone else who has stumbled across this problem and this question.

ant copy task hanging when the source file is missing

In one of our build script, we have following simple copy task added ->
<copy todir="${targetdir}"
file="${sourcedir}/modules/glassfish.jaxb.xjc_1.0.0.0_2-1-12.jar"/>
This copy task started hanging when the glassfish jar name got changed (version upgrade which are not in our control) at the source location. I was expecting it to error out causing the build failure in that case. Actually at first I was not able to figure out at what particular step build was hanging. Then when I added "-debug" to the ant command and I realized its successfully completing a step prior to this copy task and still there was no trace of copy command that is hung. When I updated the new jar name, it worked fine and build was successful which proved that the copy task is hanging because of filename got changed. To make it easy to debug next time, I added an echo statement like below just prior to that copy task ->
<echo message="Copying glassfish jar to ${targetdir}.."/>
But I am still confused as to why it didn't give error with build failure? I am using Apache Ant version 1.7.1. Could this be a bug? How else I can avoid this situation in future with just the copy task (without using * in the jar name)? TIA
That worked for me. Well, didn't work for me. I got the error message. I am using Ant 1.8 and Ant 1.9.2. I didn't try it with Ant 1.7, but I doubt it's a bug.
Try to use the -v parameter in Ant:
$ ant -v target
And be prepared for a longwinded output. This will give you information what's going on with Ant, and may explain why it's freezing. There's a few things you could do: Use a fileset to specify the file.
<copy todir="${targetdir}">
<fileset dir="${sourcedir}/modules">
<include name="glassfish*.jar"/> <!-- Will catch any glassfish.jar -->
</fileset>
</copy>
Of course, if the file doesn't exist, you won't get an error or even a warning. However, a <fail/> before will detect the issue:
<fail message="missing file ${sourcedir}/modules/glassfish.jaxb.xjc_1.0.0.0_2-1-12.jar">
<condition>
<not>
<available
file="${sourcedir}/modules/glassfish.jaxb.xjc_1.0.0.0_2-1-12.jar"
type="file"/>
</not>
</condition>
</fail>
To force the build to quit, an alternative way
<available file="${sourcedir}/modules/glassfish.jaxb.xjc_1.0.0.0_2-1-12.jar"
property="glassfish.jaxb.xjc.jar.present"/>
<fail message="you message" unless="glassfish.jaxb.xjc.jar.present"/>
just a few lines less :)
If you want to dig into it, try this:
write a simple build file, which contains only one target with copy, and put it to the same place of your main build file.
<target name="test-copy">
<!-- here use an old (wrong) file name -->
<copy todir="${targetdir}"
file="${sourcedir}/modules/glassfish.jaxb.xjc_1.0.0.0_2-1-12.jar"/>
</target>
run it, check if it fails or hangs.
If this simple build file works, it's very possible that something else in your main build file is causing the bug.

findbugs not generating html report

the below is my taskdef in a ant build file
<target name="findbugs">
<echo message="${findbugs.home}"/>
<findbugs home="${findbugs.home}"
output="html"
outputFile="E:\reports\findbugs-report.html"
effort="max"
reportLevel="low" >
<sourcePath path="${basedir}/enterpriseapplication/**" />
<class location="${basedir}/**/*.class" />
</findbugs>
</target>
I checked file permissions on the directry every thing is fine. I get the cli output but no file is generated.
Any help please.
I have run into this problem before. It seems that findbugs is unable to create the file.
Create an empty file named findbugs-report.html in the directory E:\reports\
Hope that helps.
Do not forget to mark an answer as the accepted answer if it solves your question.
There were some problems with the paths that I has put in the configuration. Fixing those paths resolved the problems. Also we need to be sure that the file system has permissions to create/modify files where the result file is placed.
Thanks for all your answers/comments guys.

passing option to ant in cruisecontrol

I have following code in config.xml file:
<schedule interval = "300">
<ant anthome="/usr/share/ant"
antworkingdir="${GitDir}"
uselogger="true"
usedebug="true"/>
</schedule>
And when I execute build through it, I am just getting output, like I've been typing just ant in command line.
I need to be able to execute following command from Cruisecontrol:
ant debug
If this is making any difference, I need to be able to build android application.
How this can be done?
Thank you on advance.
You're already using the right attributes in your config.xml to start your ant scripts with loglevel debug
...
usedebug="true"
...
is equivalent to ant -debug ...
see http://cruisecontrol.sourceforge.net/main/configxml.html#ant for details.

Ant Sync task with zipfileset

I'm attempting to synchronize the contents in a zip file with a folder on my system using the ant sync task.
I have the task:
<target name="test-zipfiletest">
<sync todir="dest">
<zipfileset src="test.zip"/>
</sync>
</target>
when i run it things are fine the contents make it to the folder
test-zipfiletest:
[sync] Copying 1 resource to C:\_dev\ide\springsource\workspaces\workspace_builds\install_utils\dest
BUILD SUCCESSFUL
Total time: 184 milliseconds
Ok that's great.
BUT... now if i run the task again it deletes the contents:
test-zipfiletest:
[sync] Removed 3 dangling directories from C:\_dev\ide\springsource\workspaces\workspace_builds\install_utils\dest
[sync] Removed 1 dangling file from C:\_dev\ide\springsource\workspaces\workspace_builds\install_utils\dest
BUILD SUCCESSFUL
Total time: 148 milliseconds
I would have expected no change and nothing would have been synchronized....
Anyone come across this? Or know how to get this to work properly?
thanks,
Julian
Well i found the issue - looks like a problem with ant
https://issues.apache.org/bugzilla/show_bug.cgi?id=51462

Resources