Re: Creating task/macro wrappers

2019-02-23 Thread Al Le
You could write a script, e.g. in JavaScript. There, you would create a new instance of the testng task (using the global 'project' object), then set all the necessary attributes and nested elements of the task (don't forget to set the owning target), and, finally, call its 'execute' method.

Re: How to find out the classpath used to load a custom task

2018-12-09 Thread Al Le
PS. Since the custom task is in the same JAR as the main class, I could just call the 'main' method from the task's 'execute' method. I'd still prefer to do it via the Java task to be able to fork etc. Am 08.12.2018 um 21:57 schrieb Al Le: Hello, I have crea

How to find out the classpath used to load a custom task

2018-12-08 Thread Al Le
Hello, I have created a JAR that contains (among other things) a java class with the 'main' method, i.e. it can be executed from the command line or using the 'java' task. The program can take many parameters on the command line; the parameters have not very nice names (for some historical r

RE: How to set content type in "get" task?

2018-05-26 Thread Al Le
He-he, I've just discovered that the GET task does support headers, and does so via nested "header" elements. Since Ant 1.8.0, released in 2010. I don't know how I missed that then. And nobody pointed me to the fact :-) - To un

Question about the task life cycle (one shot or not)

2018-02-19 Thread Al Le
Hello, I have a question about how many times a task is instantiated during a build. I've read the description at https://ant.apache.org/manual/develop.html but still a question remains. [BTW, there is a typo on that page: "addCondifgired"] The mentioned page describes very well how a task i

API to create a temp file for the duration of task execution

2018-02-18 Thread Al Le
Hello, I'd like to implement a custom task. Its implementation would perform following things: 1. Create a file (in .properties format) 2. Do some magic (the main logic of the task) which uses the file created in step 1. 3. Delete the file created in step 1. You see that the file from the

Passing system properties by default to java task

2017-08-17 Thread Al Le
Hello, I'd need an advice from the experts. In my ant script, I run a java program several times (up to 20) via the 'java' task. The program opens a connection to some server and uses the IAIK library for this (some Java security stuff). The server requires a certain level of the security me

Re: How to define a task with nested elements in Ant?

2017-06-05 Thread Al Le
Yes, indeed. But then I'd probably rather translate the whole Ant script and then let Ant process the result of the translation. I.e. the "trick" would be absolutely transparent to Ant (it would be rather part of the build infrastructure). Not quite what I've thought of (in my dreams it shou

Re: How to define a task with nested elements in Ant?

2017-06-04 Thread Al Le
Hrm... It would be cool if there existed a task which would allow to construct the translation of the task in Ant into some other existing tasks, e.g. using XPath. I.e. you'd 1. Define the syntax of a new task; not with 'attribute' and 'element' (like in macrodef) but via e.g. XSD. 2. Def

How to define a task with nested elements in Ant?

2017-06-03 Thread Al Le
Hello, is it possible to define a task in Ant which would have some nested elements? Sort of like how it's done with the macrodef task but with a bit structure. For example, I'd like to define a task which would be used as follows: This should internally translate to

Aw: Re: macrodef with parameters to pass to java task

2017-05-29 Thread Al Le
Yes, it works! Thank you! > Gesendet: Montag, 29. Mai 2017 um 12:16 Uhr > Von: "Stefan Bodewig" > An: user@ant.apache.org > Betreff: Re: macrodef with parameters to pass to java task > > On 2017-05-29, Al Le wrote: > > > in my ant script I'd like to

Aw: macrodef with parameters to pass to java task

2017-05-29 Thread Al Le
I'm sorry, the last closing tag in the example should of course be "". > Gesendet: Montag, 29. Mai 2017 um 12:04 Uhr > Von: "Al Le" > An: user@ant.apache.org > Betreff: macrodef with parameters to pass to java task > > Hello, > > in my an

macrodef with parameters to pass to java task

2017-05-29 Thread Al Le
Hello, in my ant script I'd like to define a macro (via macrodef) which would call the 'java' task as a part of its body/implementation. In the java task call in the macro, I want to just specify the main class name and the classpath. The parameters (which are usually specified via nested 'arg'

How to specify a password parameter in Java task

2017-02-24 Thread Al Le
Hello, in my ant script, I have a call to the "java" task. The parameters are specified via nested "arg" elements. One of the parameters is a password; its value is not stored in the script but is calculated by a javascript and saved to an ant property. When I run the script with the "-v" opti

Aw: Re: Ant get task to accept arbitrary header

2017-01-19 Thread Al Le
> Please, after changing the java code, what are the steps required to let > the tag accept children nodes and ? You should have methods like "setHeaders" (for the headers element) and "addHeader"/"addConfiguredHeader" for the nested elements. See https://ant.apache.org/manual/develop.html fo

Re: How to capture HTTP response with the status 500?

2017-01-17 Thread Al Le
Hello Klaus, > I am quite confident that you can call the > Method HttpURLConnection.getErrorStream within the respective catch block to > read the body of the HTTP response. Hope that helps. Thank you for the tip! I didn't know of that method! Indeed, with getErrorStream() I could read out th

Re: How to capture HTTP response with the status 500?

2017-01-16 Thread Al Le
> So maybe it's because of the inbuilt JDK's implementation of > connection.getInputStream (it throws an exception if the status is 500). I've debugged it and found out that the connection object is of type 'sun.net.www.protocol.https.HttpsURLConnectionImpl' which delegates the getInputStream()

Re: How to capture HTTP response with the status 500?

2017-01-16 Thread Al Le
Jan, thank you for taking time! Am 16.01.2017 um 08:27 schrieb Jan Matèrne (jhm): Otherwise the return of the url.openConnection().getInputStream() is copied to local file. So a response for a 500-error should be captured to file. _But_ that file is deleted if an error (non-success, e.g. catc

How to capture HTTP response with the status 500?

2017-01-13 Thread Al Le
Hello, the GET task allows to save the response of a HTTP server. One URL I try to get returns the HTTP status 500 (internal server error). Along with the status, some data is returned in the response (I verified this with cUrl) which provides some details about the error. However this data is

AW: How to delete all files in a dirset

2016-10-20 Thread Al Le
Hua, Jan, thank you for the great example! My requirement is not quite "delete recursively all directories which contain a marker file". But very similar. It is: Delete recursively all directories which only contain files with some name patterns but no other files. If there are other files in t

Aw: AW: How to delete all files in a dirset

2016-10-20 Thread Al Le
> Could you use a ? I could use a fileset with "type=dir" filter, yes. But then I'd still have a problem of how to delete all files in these dirs. For now, I just use "apply" and execute "cmd /c rmdir /s /q " on each dir (I'm on windows). AL ---

How to delete all files in a dirset

2016-10-20 Thread Al Le
Hello, I have a dirset defined in my script. How can I delete all files contained in that dirset? Actually, my goal is to delete the dirs from the dirset, including all the files contained in them. But since the delete task does not delete non empty dirs, I'd first delete all the files and, in

Re: "Sync" sometimes does not delete folders

2016-10-17 Thread Al Le
Hello, I could track down the reason for the problem. Now I'd need an advice from experts how to solve it :-) When synchronizing the dirs, we'd like to preserve some files. These files have a certain local name. Hence we specify these files in the 'preserveintarget' clause. The problem is tha

Re: "Sync" sometimes does not delete folders

2016-09-18 Thread Al Le
Windows does not allow one to delete a file if there is a process that has an open handle to it Thank you for the hint! I'll check whether the dir is locked by a process. I do not know if the sync task checks if file deletions actually succeed. It is common for Java programs to not check the r

"Sync" sometimes does not delete folders

2016-09-17 Thread Al Le
Hello, Sometimes I get a wrong result when using the task "sync". I try to synchronize a directory which is defined as a share on a windows system (source) to a local directory (target), i.e. the local dir should look like the share after the sync. But sometimes, after the sync, I see that d

How to create a task associated a target

2016-04-25 Thread Al Le
Hello, in my ant script, I do the following: 1. there is a target "calledTarget" 2. there is a task "macroTask", defined via "macrodef". This task contains in its body a call to "calledTarget" (via "antcall"). 3. there is a target "mainTarget" which contains a task "script" (javascript). In t

Aw: Re: MacroDef: Setting attribute via API should convert to lowercase

2016-04-17 Thread Al Le
> Thanks, should be fixed in git, will be fixed in 1.9.8 and 1.10.0. That's not fair! I've needed so long to identify the problem and create a bug report, and you fix it so quickly! :-) - To unsubscribe, e-mail: user-unsubscr...

Re: MacroDef: Setting attribute via API should convert to lowercase

2016-04-16 Thread Al Le
My guess is that you are the first person who's trying what you do and you've simply hit a bug. [...] Please open a bug ticket. Created the bug report 59339. - To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For addit

MacroDef: Setting attribute via API should convert to lowercase

2016-04-12 Thread Al Le
Hello, in my ant script, I define a task "MyTask" via "macrodef". The task has a mandatory attribute "nodeName" (not the camelCase name). Then I call the task from a javascript snippet: var myTask = project.createTask('myTask'); myTask.setDynamicAttribute("nodeName", "blah"); myTask.perform();

Re: How to set content type in "get" task?

2016-03-19 Thread Al Le
Is curl an option? You can run it with the Ant exec task. Yes, I already considered using curl or wget. It will be simpler than implementing the feature from scratch in JavaScript (or in some other language). - To unsubscri

How to set content type in "get" task?

2016-03-18 Thread Al Le
Hello, in our ant script, we use the "get" task to fetch some data from the server via HTTP GET. The server interprets the 'Content-Type' header of the request and delivers the response in the appropriate format (html/xml/json). We'd like to have the result as XML and hence would need to set th

Re: How to set content type in "get" task?

2016-03-18 Thread Al Le
No, the get task doesn't support setting the Accept-Header. Probably pretty easy to add this via a script-def... Thank you for the quick responses! I'll try it with JavaScript. I just wanted to make sure I didn't miss something. Basicly, I'll have to implement the get task in JavaScript (u

Re: XSL transformation with Ant: sorting a list

2016-03-07 Thread Al Le
If the classpath is not identical, you could get a different transform provider. For example, we use Saxon as our provider, overriding what is provided in the runtime library. Thank you for the hint! I downloaded the latest xalan distribution and executed the ant script with the "classpath" a

Aw: Re: XSL transformation with Ant: sorting a list

2016-03-07 Thread Al Le
Hello Scot, thanks for a quick response! > first you are killing yourself in the way you XSLT is > written > [. . .] > You are trying to do the work of the templating engine in your XSLT :) Yes, I know this is a "procedural" way of doing things and maybe not the best. But the example is just a

Aw: XSL transformation with Ant: sorting a list

2016-03-07 Thread Al Le
> It does not occur if I perform it via a Java program I have to correct myself. It tried a java program in different JVMs, and it gives me different results. In one case it gives the correct result, in other cases still the wrong result is delivered. I could not find out yet what the differenc

XSL transformation with Ant: sorting a list

2016-03-06 Thread Al Le
Hello, I'm facing a weird problem (IMHO) which, in short, is: a node list passed as a parameter to a template can't be sorted. The problem occurs only if I do the transformation from within Ant (I use Ant 1.8.4). It does not occur if I perform it via a Java program or in XmlSpy or through ht

Re: Extracting individual tokens after using stringtokenizer

2015-05-25 Thread Al Le
but it seems to be overly complicated for getting individual tokens out when I am able to separate them using stringtokenizer. Isn't there any other simplere way to do what I am after? I have not fully understood your case, but I generally use the 'script' task (with JavaScript) when I have to

Re: Pass build failure message to the calling script

2015-03-25 Thread Al Le
ava code ... import org.apache.commons.io.IOUtils; public class MyClass {} -Ursprüngliche Nachricht- Von: Al Le [mailto:al...@gmx.de] Gesendet: Mittwoch, 25. März 2015 10:40 An: user@ant.apac

Aw: RE: Pass build failure message to the calling script

2015-03-25 Thread Al Le
> > Is it possible without parsing the output of Ant? If yes, how? > > output="output.html" But doesn't it essentially mean parsing the build output -- something I'd like to avoid? I rather thought about Ant setting some kind of an environment variable when it exits. I.e. I'd specify some optio

Pass build failure message to the calling script

2015-03-24 Thread Al Le
Hello, I call Ant (execute a build) from a .bat script (under Windows). If the build fails, I'd like not only to detect that it failed (this is possible via ERRORLEVEL) but also get the failure message (at least its first line if the message contains multiple lines). Is it possible without par

Re: move rename date pattern

2014-09-20 Thread Al Le
If it works for you then it's fine. I'd do it a little bit differently. I'd use the script to only calculate the date strings and would perform copying/deletion by the standard ant tasks (copy/...). I strive to use script tasks for as little as possible in ant scripts.

Re: move rename date pattern

2014-09-20 Thread Al Le
> In directory $foo$ take file [\d\d\d\d-\d\d-\d\d zzz_today.ico] and > rename it to <... something not trivial ...> If I have to do something which I can't easily do with standard Ant tasks I use the script task, usually with JavaScript. There, you can do whatever computations you want and pas

Aw: Re: How to override a property that was set in the command line via "-D..."

2014-07-31 Thread Al Le
nt it within the file, so that someone trying to work > out why the command line option didn't "take" will be able to find it. > > > > > > Main: outFileName: ${outFileName} > > > > > > > > > > > > > >

Aw: AW: AW: How to override a property that was set in the command line via "-D..."

2014-07-31 Thread Al Le
Gesendet: Donnerstag, 31. Juli 2014 um 14:27 Uhr > Von: "Knuplesch, Jürgen" > An: "Ant Users List" > Betreff: AW: AW: How to override a property that was set in the command line > via "-D..." > > Did you try inheritall=false option? > > -

Aw: AW: How to override a property that was set in the command line via "-D..."

2014-07-31 Thread Al Le
> your case "called.xml" > > Its very important to understand why immutability is a feature and not a > bug... (-; > > Juergen > > > > > > -Ursprüngliche Nachricht- > Von: Al Le [mailto:al...@gmx.de] > Gesendet: Donnerstag,

How to override a property that was set in the command line via "-D..."

2014-07-31 Thread Al Le
user@ant.apache.org How to override a property that was set in the command line via "-D..." Hello. Could someone please help me with the following situation? I have some ant scripts that are used in two ways: 1. Standalone build, i.e. the script is executed directly from the command line 2. As