RE: Prompt
Try this: http://www.mail-archive.com/ant-user@jakarta.apache.org/msg03059.html It has a custom task to ask the user a question... Alan. -Original Message- From: Krystan Honour [mailto:[EMAIL PROTECTED]] Sent: 12 November 2001 13:20 To: Ant Users List Cc: [EMAIL PROTECTED] Subject: Re: Prompt Hi, this is extremely useful. Only one problem I ran this successfully under windows which prompted for a password that I use to sign my jars with and signed it. When I tried to use the same script under linux I get a file not found exception because it can't find the file con ? which is asked for in the stream handler. Any ideas ? Krys - Original Message - From: Paul Perevalov [EMAIL PROTECTED] To: Ant Users List [EMAIL PROTECTED] Sent: Friday, November 09, 2001 8:02 PM Subject: RE: Prompt You have to add in ant\lib directory bsf.jar from http://oss.software.ibm.com/developerworks/projects/bsf for script task and js.jar from http://www.mozilla.org/rhino/download.html for javascript support. Paul Perevalov -Original Message- From: Mark Claassen [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 2:52 PM To: Ant Users List Subject: RE: Prompt Thanks! It will take me a while to get through all this, but this sounds like just the ticket. Will ant run this just by itself, or do I need something to help it with the JavaScript? I tried in using the ant1.3 that is bundled in with netbeans 3.2.1 and it didn't work. Maybe the optional tasks are not included by default. Mark -Original Message- From: Paul Perevalov [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 12:16 PM To: Ant Users List Subject: RE: Prompt I wrote my own target which uses javascript to get some user input into properties and then run another tagets. You can place this target in common build file and then include it main build file. Here is the target itself, after this target you can find example how to use it. target name=doTargetWithUserInput description=Executes target where some parameters provided by user from kbd. script language=javascript ![CDATA[ importPackage(Packages.java.lang); importPackage(Packages.java.io); project = doTargetWithUserInput.getProject(); //get comma separated user prompts var prompts = project.getProperty(prompts); //get comma separated user properties which should be set var properties = project.getProperty(properties); //get comma separated targets to be executed var targets = project.getProperty(targets); //get standart input stream var stdin = new BufferedReader(new InputStreamReader(new FileInputStream(con))); //split prompts,properties and targets to arrays var arrPrompts = Split(String(prompts),,); var arrProperties = Split(String(properties),,); var arrTargets = Split(String(targets),,); //fail if number of properties does not match to number of prompts if(arrPrompts.length != arrProperties.length){ fail = project.createTask(fail); fail.setMessage(Number of prompts does not match to the number of properties.); fail.execute(); } //get value for each property from user by showing corresponding prompt var temp = ; for (var i = 0; i arrPrompts.length; i++){ System.out.println(arrPrompts[i]); temp = stdin.readLine(); project.setProperty(arrProperties[i],temp); } //execute each target which now will have access to new properties for (var j = 0; j arrTargets.length; j++){ project.executeTarget(arrTargets[j]); } function Split(Expression, Delimiter) { var temp = Expression; var a, b = 0; var array = new Array(); if (Delimiter.length == 0) { array[0] = Expression; return (array); } if (Expression.length == '') { array[0] = Expression; return (array); } Delimiter = Delimiter.charAt(0); for (var i = 0; i Expression.length; i++) { a = temp.indexOf(Delimiter); if (a == -1) { array[i] = temp; break; } else { b = (b + a) + 1; var temp2 = temp.substring(0, a); array[i] = temp2; temp = Expression.substr(b, Expression.length - temp2.length); } } return (array); } ]]/script /target Then you can use this target to get some user input and run another target(s). antcall target=doTargetWithUserInput param name=prompts value=Enter user ID:,Enter user password:/ param name=properties value=user,pwd/ param name=targets value=doSomething/ /antcall target name=doSomething description=Do something with user input echo message=User id: ${user}, password : ${pwd}/ /target Hope this help. Paul Perevalov -Original Message-
RE: Prompt
You should reply to the list, everyone can benefit from the answers. These are new tasks so you need to add a taskdef. taskdef name=ask-user classname=com.sns.tools.ant.taskdefs.AskUser/ You need to have the .class in your classpath in the com.sns.tools.ant.taskdefs package. Maybe: \jakarta-ant-1.4.1\classes\com\sns\tools\ant\taskdefs\AskUser.class and add \jakarta-ant-1.4.1\classes\ to your classpath. Or you could just jar up the directory com and add the jar to the optional directory. Let me know how it goes... Alan. -Original Message- From: Krystan Honour [mailto:[EMAIL PROTECTED]] Sent: 12 November 2001 13:57 To: Alan Pearlman Spencer Subject: Re: Prompt This looks good, I`m not sure how to go about using these tasks as I am quite new to ant. I compile the src but where does the .class file want to be placed so that ant may see it ? - Original Message - From: Alan Pearlman Spencer [EMAIL PROTECTED] To: Ant Users List [EMAIL PROTECTED] Sent: Monday, November 12, 2001 1:33 PM Subject: RE: Prompt Try this: http://www.mail-archive.com/ant-user@jakarta.apache.org/msg03059.html It has a custom task to ask the user a question... Alan. -Original Message- From: Krystan Honour [mailto:[EMAIL PROTECTED]] Sent: 12 November 2001 13:20 To: Ant Users List Cc: [EMAIL PROTECTED] Subject: Re: Prompt Hi, this is extremely useful. Only one problem I ran this successfully under windows which prompted for a password that I use to sign my jars with and signed it. When I tried to use the same script under linux I get a file not found exception because it can't find the file con ? which is asked for in the stream handler. Any ideas ? Krys - Original Message - From: Paul Perevalov [EMAIL PROTECTED] To: Ant Users List [EMAIL PROTECTED] Sent: Friday, November 09, 2001 8:02 PM Subject: RE: Prompt You have to add in ant\lib directory bsf.jar from http://oss.software.ibm.com/developerworks/projects/bsf for script task and js.jar from http://www.mozilla.org/rhino/download.html for javascript support. Paul Perevalov -Original Message- From: Mark Claassen [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 2:52 PM To: Ant Users List Subject: RE: Prompt Thanks! It will take me a while to get through all this, but this sounds like just the ticket. Will ant run this just by itself, or do I need something to help it with the JavaScript? I tried in using the ant1.3 that is bundled in with netbeans 3.2.1 and it didn't work. Maybe the optional tasks are not included by default. Mark -Original Message- From: Paul Perevalov [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 12:16 PM To: Ant Users List Subject: RE: Prompt I wrote my own target which uses javascript to get some user input into properties and then run another tagets. You can place this target in common build file and then include it main build file. Here is the target itself, after this target you can find example how to use it. target name=doTargetWithUserInput description=Executes target where some parameters provided by user from kbd. script language=javascript ![CDATA[ importPackage(Packages.java.lang); importPackage(Packages.java.io); project = doTargetWithUserInput.getProject(); //get comma separated user prompts var prompts = project.getProperty(prompts); //get comma separated user properties which should be set var properties = project.getProperty(properties); //get comma separated targets to be executed var targets = project.getProperty(targets); //get standart input stream var stdin = new BufferedReader(new InputStreamReader(new FileInputStream(con))); //split prompts,properties and targets to arrays var arrPrompts = Split(String(prompts),,); var arrProperties = Split(String(properties),,); var arrTargets = Split(String(targets),,); //fail if number of properties does not match to number of prompts if(arrPrompts.length != arrProperties.length){ fail = project.createTask(fail); fail.setMessage(Number of prompts does not match to the number of properties.); fail.execute(); } //get value for each property from user by showing corresponding prompt var temp = ; for (var i = 0; i arrPrompts.length; i++){ System.out.println(arrPrompts[i]); temp = stdin.readLine(); project.setProperty(arrProperties[i],temp); } //execute each target which now will have access to new properties for (var j = 0; j arrTargets.length; j++){ project.executeTarget(arrTargets[j]); } function Split(Expression, Delimiter) { var temp = Expression; var a, b = 0; var array = new Array(); if (Delimiter.length == 0) { array[0] = Expression
RE: build.bat problem
First point I'd make is that it is easier (and better?) to define the classpath for ANT (ant only) in the batch file (like the ant.bat, it handles it's own jars nicely) and set up a fileset for your classpath inside the build script. This means you can have incompatibilities between these (like different XML parser as I have) and it will work OK. You are passing in CATALINE_HOME, so you can get it all from here... I know this does not solve your problem... Maybe it would be easier if you mentioned some specific 'cannot resolve symbol's? Alan. -Original Message- From: Peter Georgiou [mailto:[EMAIL PROTECTED]] Sent: 13 November 2001 11:12 To: [EMAIL PROTECTED] Subject: build.bat problem hi I was recently using ant within tomcat3.2 to build my struts applications. Now I've changed to Tomcat4, my build is having trouble recognising java classes within my web app, which I presume is a classpath problem. When I build I get lots of 'cannot resoolve symbol' errors. Can someone tell me if the following build.bat file is correct? Or/and someone mail me an example of a build.bat file for building a struts app in tomcat4. Thanks Peter @echo off rem build.bat -- Build Script for the Fooddoof Web Application rem $Id: source.html,v 1.2.4.3 2001/03/08 00:56:41 marcsaeg Exp $ set _CP=%CP% rem Identify the custom class path components we need set CP=%ANT_HOME%\lib\ant.jar;%CATALINA_HOME%\common\lib\servlet.jar set CP=%CP%;%CATALINA_HOME%\common\lib\xerces.jar; set CP=%CP%;%JAVA_HOME%\lib\tools.jar set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\jdbc2_0-stdext.jar set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\jta.jar set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\struts.jar set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\tiles.jar set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\commons-beanutils.j ar set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\commons-digester.ja r set CP=%CP%;%CATALINA_HOME%\webapps\fooddoof\web-inf\lib\commons-collections .jar rem Execute ANT to perform the requird build target java -classpath %CP%;%CLASSPATH% org.apache.tools.ant.Main -Dcatalina.home=%CATALINA_HOME% %1 %2 %3 %4 %5 %6 %7 %8 %9 set CP=%_CP% set _CP= -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: build.bat problem
Sorry I don't know tomcat 4.0, but I do have it. Seems that these are in servlet.jar. I'd make sure that the CATALINE_HOME points to the correct directory... Can you get your script to echo it's execution? Then we can see the classpath it uses. It seems that the line: set CP=%ANT_HOME%\lib\ant.jar;%CATALINA_HOME%\common\lib\servlet.jar is not correctly pointed as it should find these files in there... Alan. -Original Message- From: Peter Georgiou [mailto:[EMAIL PROTECTED]] Sent: 13 November 2001 12:31 To: Ant Users List Subject: Re: build.bat problem Thanks for your reply alan. Below are just a few of the cannot resolve symbol problems [javac] Compiling 22 source files to C:\catalina\webapps\fooddoof\WEB-INF\classes [javac] C:\tomcat\fooddoof-app-dev\src\com\fooddoof\actions\FLogonAction.java:3: cannot resolve symbol [javac] symbol : class HttpServletRequest [javac] location: package http [javac] import javax.servlet.http.HttpServletRequest; [javac] ^ [javac] C:\tomcat\fooddoof-app-dev\src\com\fooddoof\actions\FLogonAction.java:4: cannot resolve symbol [javac] symbol : class HttpServletResponse [javac] location: package http [javac] import javax.servlet.http.HttpServletResponse; [javac] ^ [javac] C:\tomcat\fooddoof-app-dev\src\com\fooddoof\actions\FLogonAction.java:5: cannot resolve symbol [javac] symbol : class HttpSession [javac] location: package http [javac] import javax.servlet.http.HttpSession; I've read your message and have a go at doing what you suggested. The build .bat script I mailed worked fine for Tomcat3.2. When I changed to Tomcat4 I just replaced TOMCAT_HOME to CATALINA_HOME thinking that this would work. Peter - Original Message - From: Alan Pearlman Spencer [EMAIL PROTECTED] To: Ant Users List [EMAIL PROTECTED] Sent: Tuesday, November 13, 2001 11:29 AM Subject: RE: build.bat problem First point I'd make is that it is easier (and better?) to define the classpath for ANT (ant only) in the batch file (like the ant.bat, it handles it's own jars nicely) and set up a fileset for your classpath inside the build script. This means you can have incompatibilities between these (like different XML parser as I have) and it will work OK. You are passing in CATALINE_HOME, so you can get it all from here... I know this does not solve your problem... Maybe it would be easier if you mentioned some specific 'cannot resolve symbol's? Alan. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Junit test reports
This is an (annoying) classpath issue. If you take a look at the definition of the tasks it says it needs Xalan 2 If you get this version of xalan and put it in the lib directory I think that fixes the problem. Let me know how it goes... Alan. -Original Message- From: Kazandjian Erik [mailto:[EMAIL PROTECTED]] Sent: 14 November 2001 07:51 To: 'Ant User' Subject: Junit test reports Hello, I'm trying to automise our Junit tests with Ant. Taht works but 'they' want a report every morning of the tests that ran during the night. I saw that there are some report tools for tests but I can't get them running. I'm using junit3.7. Here is a sample opf my build.xml target name=facade_tests depends=testsuite junit printsummary=no classpath pathelement path=${myenv.MY_JAVA_CLASSES}/ pathelement path=${myenv.CLASSPATH}/ pathelement location=${myenv.ANT_HOME}/lib/optional.jar/ pathelement location=${myenv.ANT_HOME}/lib/ant.jar/ /classpath batchtest fork=yes todir=/home/integrator/.tests_output formatter type=xml/formatter fileset dir=${destdir} include name=**/test/**/suites/FacadeTests.class/include /fileset /batchtest /junit /target I get the following errors when I try to run this target facade_tests: [junit] Exception in thread main javax.xml.parsers.FactoryConfigurationError: com.sun.xml.parser.DocumentBuilderFactoryImpl [junit] at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFact ory. java:80) [junit] at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.get Docu mentBuilder(XMLJUnitResultFormatter.java:81) [junit] at org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.sta rtTe stSuite(XMLJUnitResultFormatter.java:124) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.fireStartTe stSu ite(JUnitTestRunner.java:279)[junit]at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe stRu nner.java:200) [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT estR unner.java:342) [junit] TEST com.siemens.square.test.suites.FacadeTests FAILED BUILD SUCCESSFUL Does anybody have any idea what I'm doing wrong ? Thanks Erik -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How do I get a fileset to include only directories?
Hi I'm trying to search for a file in a dir tree. I'm using: available resource=properties.sample type=file property=found classpath pathelement path=x${build.props.dir}/ fileset dir=${build.root} include name=**/ exclude name=**/*.*/ /fileset /classpath /available The pathelement works, but I can't get the fileset to include all dirs in the tree... Any ideas? Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: synchronize directory task
Or copy? Copy will only copy the files it needs. -Original Message- From: Matt Lyon [mailto:[EMAIL PROTECTED]] Sent: 14 November 2001 14:16 To: Ant Users List Subject: RE: synchronize directory task Have you checked out move? -Original Message- From: Jeff Sahol [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 14, 2001 9:22 AM To: [EMAIL PROTECTED] Subject: synchronize directory task Is there a task for synchronizing a directory structure from one location to another? I don't want to do a delete and then copy, I want to minimize the need for copying files. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: central definition of classpath, please HELP !!!
I believe you need to use a property to do this. classpath refid's will not be passed (as they are XML IDs and it is a different XML file). Not as powerful, but it will be passed to other scripts... Maybe (big maybe) you could xml include other scripts using an ENTITY??? Alan. -Original Message- From: Joel Cordonnier [mailto:[EMAIL PROTECTED]] Sent: 14 November 2001 14:24 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: central definition of classpath, please HELP !!! Hi ! I really need help. I have and Ant script called build.xml (main script), that call other scripts **.xml. In the main script are Ant's PATH defined, and then, in my compile, javadoc...and other tasks, i refer to the PATHs with the statement classpath refid=../ I HAVE THE FOLLOWING PROBLEM: the 'other' script that build.xml call CAN'T refer to the PATHs defined in build.xml !! WHY Thanks for the help. /Joel ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Courrier : http://courrier.yahoo.fr -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: central definition of classpath, please HELP !!!
You can't (as far as I know) Only properties are passed... What I do is define the properties that are needed to recreate the classpath, not ideal, but it works. like classpath.lib.dir, classpath.classes.dir, classpath.other.jar??? Sorry I can't help more... Alan. -Original Message- From: Joel Cordonnier [mailto:[EMAIL PROTECTED]] Sent: 14 November 2001 14:56 To: Ant Users List Subject: Re: central definition of classpath, please HELP !!! Hi OK ! BUT BUT suppose that your 'project.class.path' is defined in a file A.xml, and that you have the target 'compile' defined in a file B.xml And then, a target in A call the 'compile' target in B.xml with the statement target name= depends= ant antfile=./B.xml dir=. target=compile/ /target Then ?? how to propagate your classpath's refid `??? /Joel écrit : hi! maybe that helps! path id=project.class.path !-- for cruisecontrol junit tests -- fileset dir=./lib include name=**/*.jar/ /fileset /path target name=compile javac srcdir=./src destdir=./classes debug=on verbose=off deprecation=yes classpath refid=project.class.path/ /javac /target cu eric - Original Message - From: Joel Cordonnier [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, November 14, 2001 3:23 PM Subject: central definition of classpath, please HELP !!! Hi ! I really need help. I have and Ant script called build.xml (main script), that call other scripts **.xml. In the main script are Ant's PATH defined, and then, in my compile, javadoc...and other tasks, i refer to the PATHs with the statement classpath refid=../ I HAVE THE FOLLOWING PROBLEM: the 'other' script that build.xml call CAN'T refer to the PATHs defined in build.xml !! WHY Thanks for the help. /Joel ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Courrier : http://courrier.yahoo.fr -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Courrier : http://courrier.yahoo.fr -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Is there a way to search a directory structure?
Hi All, Can this type of thing work for searching a dir tree? I cant get it to work? I'm trying to search for a file anywhere in a dir tree and set a property if that is there. Like the available task, but I can't see how to get it to search a complete tree. I've tried: available resource=my.file.txt type=file property=found classpath fileset dir=${search.root} include name=**/ exclude name=**/*.*/ /fileset /classpath /available And also with filesets, but I'm stuck. Any ideas? Alan. -Original Message- From: Alan Pearlman Spencer Sent: 08 November 2001 18:10 To: Ant Users List Subject: RE: Is there a way to copy only a directory structure? Thanks, I got it to work by using, but it copies files with no extension... copy todir=${foobar} includeEmptyDirs=yes fileset dir=${foo} excludes=**/*.* /fileset /copy I tried:** **.* **/* but they don't copy anything... Thanks, Alan. -Original Message- From: Matt Lyon [mailto:[EMAIL PROTECTED]] Sent: 08 November 2001 17:29 To: Ant Users List Subject: RE: Is there a way to copy only a directory structure? Hi, Just a guess (don't have time to test it for you right now), but try: copy todir=${foobar} includeEmptyDirs=yes fileset dir=${foo} excludes=**.* /fileset /copy Cheers, Matt -Original Message- From: Alan Pearlman Spencer [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 08, 2001 12:37 PM To: Ant Users List Subject: Is there a way to copy only a directory structure? I am interested in copying a whole directory tree from A to B but not the files, only the structure. Any ideas? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Is there a way to search a directory structure?
Thanks a million! I'll play with the file attribute, don't know how I missed that! Thanks, Alan. -Original Message- From: Diane Holt [mailto:[EMAIL PROTECTED]] Sent: 14 November 2001 17:06 To: Ant Users List Subject: Re: Is there a way to search a directory structure? --- Alan Pearlman Spencer [EMAIL PROTECTED] wrote: Can this type of thing work for searching a dir tree? I cant get it to work? I'm trying to search for a file anywhere in a dir tree and set a property if that is there. Like the available task, but I can't see how to get it to search a complete tree. I've tried: available resource=my.file.txt type=file property=found The resource attribute is used when you're looking for something in a jar-file. The type attribute is only valid when you've specified a file, via the file attribute, as what you're looking for (and should check for that and print an error -- my bad, so I'll fix that :) classpath fileset dir=${search.root} include name=**/ exclude name=**/*.*/ /fileset /classpath The nested classpath is used when you've specified you're looking for either a class or a resource, not when you're looking for a file (or directory). The documentation says you can use a nested filepath element when you're looking for a file (or directory), but I can't get that to work, so either I'm not doing it right, or there's a bug in how it's doing it (I'm leaning towards that :) For example, I tried: target name=findFile available property=found file=A.java filepath fileset dir=. include name=**/ /fileset /filepath /available echo message=found = ${found}/ /target Running this target with -verbose shows it recursively searching through all the subdirs, so that's good -- but it looks like it's made the filename it's looking for the full-path name, based on the basedir, so even though the file exists several subdirectories down from basedir, it's not going to match. Even more unfortunately, though, I tried just 'touch'ing an A.java in the local directory, and it didn't find it there, either :( Looks like some debugging is in order. Diane = ([EMAIL PROTECTED]) __ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: log4j + JUnit + Ant 1.4
I have used these together... I think is is because ANT tried to catch output (System.out) from tasks. I would use a file appender if I were you... Alan. -Original Message- From: Christopher Berry [mailto:[EMAIL PROTECTED]] Sent: 15 November 2001 21:59 To: Ant-User (E-mail) Subject: log4j + JUnit + Ant 1.4 Greetings, I am trying to get the junit task to run properly with log4j. Has anyone else been successful with this?? If I print to System.out in my JUnit Tests, the output is properly created. But when I use log4j to a ConsoleAppender, it is not. I am using the following Target definition:: target name=run_junit description=Run Single JUnit test if=testcase depends=quick junit printsummary=withOutAndErr haltonfailure=yes fork=true classpath pathelement location=${efc.pkgs.unpacked} / fileset dir=${efc.pkgs.lib} include name=**/*.jar / /fileset pathelement location=${efc.pkgs.unpacked.classes} / /classpath formatter type=plain usefile=true / test name=${testcase} / /junit /target NOTE: In order to see my output in the JUnit Formatters, I ended up having to add the following lines to JUnitTestRunner::run(). System.setOut( systemOut ); System.setErr( systemError ); Without these lines I never saw *any* output at all Thanks, -- Chris Chris Berry --- [EMAIL PROTECTED] -- 512-323-9479
RE: Doing both debug and release builds with same targets
I have this same configuration and I have a target that sets the flag before getting on with it. target name=debug_dist depends=set_debug,dist/ Where set_debug is like setmode... And Dist depends on an init that sets debug to false. Then I use debug in my javac calls... Alan. -Original Message- From: Peter Davis [mailto:[EMAIL PROTECTED]] Sent: 16 November 2001 06:31 To: Ant Users List Subject: Re: Doing both debug and release builds with same targets If you specify the property on the command line: ant -Dmode=debug compile-proj1 then mode will not be overwritten even if there is a property that sets it. But this means you have to type that ugly -D parameter, which is why I think that the message to which I am replying is probably the most elegant solution. On Thursday 15 November 2001 05:31 pm, you wrote: The way I would do it is the following target name=setmode unless=mode echo message=mode not set, setting mode to debug/ property name=mode value=debug / /target target name=compile-proj1 depends=prepare, setmode etc. Hope this helps, Jim --- Alan Pearson [EMAIL PROTECTED] wrote: This must be a relatively common task, so I present the Ant user commuity with the following question: I am trying to write a build.xml file that can build in either debug mode or release mode depending on which target is invoked on the command line (or build them both). The difference between the two builds will be the settings of the Optimization/Debug flags on the javac tasks, and also the output directories for classes and other generated files. My best solution has the following structure: ?xml version='1.0' encoding='utf-8'? project name=test default=both basedir=. target name=prepare echo message = Preparing ${mode} directory. / /target target name=compile-proj1 depends=prepare echo message = compiling project 1 in ${mode} mode / /target target name=compile-proj2 depends=prepare echo message = compiling project 2 in ${mode} mode / /target target name=build depends=compile-proj1,compile-proj2 / target name=debug-build property name=mode value=debug / antcall target=build / /target target name=release-build property name=mode value=release / antcall target=build / /target target name=both antcall target=debug-build / antcall target=release-build / /target /project When I run ant with the both, the debug-build or the release-build target, it does exactly what I want. The problem with this Is that I can only do the top-level build targets sucessfully. If I am working on just project1, I'd like to be able to run ant compile-proj1 and have it just build that project (preferably in debug-mode). However if I run ant that way, the ${mode}does not get set, and I get the output: prepare: [echo] Preparing ${mode} directory. compile-proj1: [echo] compiling project 1 in ${mode} mode So what I tried to do was to insert the statement property name=mode value=debug / at the very beginning of the file (right after the project declaration). My hope was that this would provide a default value for mode, and that when I ran release-build or when both antcall'ed release-build the property statement within that target would override the default setting. Unfortunately, it didn't happen that way. After adding the above property statement, the release-build target started using ${mode}=debug. Can I have my cake and eat it too? Is there a way to set the default value of ${mode} to be debug and have it set to release only when the release-build target is run? Thanks, Alan Pearson __ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- Furthermore, I believe bacon prevents hair loss. Peter Davis Developer, Speaklink Inc. [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Command line another way?
Hi, Is it possible to give the ant command line a different way? I'm using ANT in NetBeans and in Cruise Control etc... And would like to pass in -debug -quite etc... Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: INCLUDE possible?
Hi, I've found a way: If you want to define a new target or property Add this to the top of the build.xml file: !DOCTYPE project [ !ENTITY test-file SYSTEM testInclude.xml ] And then start the project: project name=project default=all basedir=. And then where you need to include the file: test-file; And get on with the rest: /project Alan. -Original Message- From: HANDSCHMANN Robert [mailto:[EMAIL PROTECTED]] Sent: 19 November 2001 08:52 To: 'Ant-User' Subject: INCLUDE possible? Hi Guys, I have several projects, which I want to build stand-alone and also build them altogether. I created a build file in the SRC directory of each project and one in the root directory of all projects. The build file in the root directory starts the sub-builds using the ANT task. Now my question: is it possible to have a common build file for all projects that I can inlude in the project´s build file to share common build rules? Has anyone done (needed) this before? Thanks, Robert -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Sharing path id across multiple build files. Is it possible?
Try this: If you want to define a new target or property or classpath Add this to the top of the build.xml file: !DOCTYPE project [ !ENTITY test-file SYSTEM testInclude.xml ] And then start the project: project name=project default=all basedir=. And then where you need to include the file: test-file; And get on with the rest: /project Alan. -Original Message- From: Martin Saxer [mailto:[EMAIL PROTECTED]] Sent: 17 November 2001 01:21 To: [EMAIL PROTECTED] Subject: Sharing path id across multiple build files. Is it possible? Hi, I've searched the mail archives and ant documentation for a couple hours and haven't found a solution to my problem. I'm wondering if somebody has a quick fix that could fix this problem. Problem statement: I'm using Ant 1.4. My project has multiple build files, one of which could be considered the parent build file that calls the children build files in succession. The issue is that I need to set the exact same path id=classes.path element in each of the child build files. It'd be nice if this could be centralized as I've done for all of the project properties/variables. Here's a subset of what the path element looks like: path id=classes.path fileset dir=${thirdparty.dir} include name=**/*.jar/ /fileset /path Is there an easy way to reference this with a refid from another build.xml? If so, what is the syntax? I tried another trick that didn't work - I put the code above inside a target like so: target name=setclasspath description=Sets classpath for project build path id=classes.path fileset dir=${thirdparty.dir} include name=**/*.jar/ /fileset /path /target In the child build file I added: target name=setclasspath ant antfile=build.xml dir=../parent target=setclasspath/ /target Unfortunately, classes.path can't be used as a refid like this. So...any other ideas I can try? Thanks, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Line numbers on Stack traces
For some reason, by default, ANT passes -g:none to the compiler and there is no way for it's default to be the same as Javacs default which is -g:line as far as I know. Also, in ANT you only have debug on (all) or off (none), check out the docs for javac and you will see it has more options... I wish ANT would expose these... Alan. -Original Message- From: Larason, Timothy [mailto:[EMAIL PROTECTED]] Sent: 19 November 2001 17:49 To: Ant Users List Subject: RE: Line numbers on Stack traces Correct me if I'm wrong everyone...but I believe the javac setting debug=true used to be the default for Ant 1.3, but isn't for Ant 1.4. To get the line numbers back in just do the following : javac debug=true / I guess it probably is best that debug=true is no longer the default. Makes for more efficient and smaller code in my opinion. -Original Message- From: David Oxley [mailto:[EMAIL PROTECTED]] Sent: Monday, November 19, 2001 12:38 PM To: 'Ant Users List' Subject: Line numbers on Stack traces All, I have lost line numbers on stack traces with code compiled with Ant 1.4. They used to be there when I compiled with Ant 1.3. Is this a default setting that has changed, a bug with Ant 1.4, or is it just coincidence and actually caused by something completely different. From the following excerpt, you can see that Tomcat line numbers come out, but not from our sources. at StaffPlannerServlet.processRequest(Unknown Source) at com.staffplanner.base.ServletBase.doPost(Unknown Source) at com.staffplanner.base.ServletBase.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) Thanks. Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Reference IDs ... can they be inherited?
No it is not possible. Search the archive and you will find the question asked many times. I posted yesterday about how to do an XML cluge to include snippets of build scripts... Alan, -Original Message- From: Eddie Espino [mailto:[EMAIL PROTECTED]] Sent: 19 November 2001 22:15 To: [EMAIL PROTECTED] Subject: Reference IDs ... can they be inherited? Is it possible to inherit Reference IDs in a subsequent ant invoked task? I would like to set a classpath Reference id in the top-level build file. I'll use it to setup references to widely used vendor and internal jar files. I would like all lower level build.xml files to have access to them through the Reference id mechanism. Is it possible? Does this question make sense? Your assistance is greatly appreciated. Regards, -=eddie _ Eddie Espino _ Tascola, Inc. 12647 Alcosta Blvd., Suite 350 San Ramon, CA 94583 Phone: (925) 244.9893 Cell: (925) 437-3734 Fax: (925) 244-6781 www.Tascola.com http://www.tascola.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Line numbers on Stack traces
Thanks, I should look at the bug list... Alan. -Original Message- From: Magesh Umasankar [mailto:[EMAIL PROTECTED]] Sent: 20 November 2001 18:07 To: Ant Users List Subject: Re: Line numbers on Stack traces Alan: This enhancement request is a duplicate of http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4127 A patch has been submitted. Please wait for it to be committed. Magesh - Original Message - From: Alan Pearlman Spencer [EMAIL PROTECTED] To: Ant Users List [EMAIL PROTECTED] Sent: Tuesday, November 20, 2001 3:49 AM Subject: RE: Line numbers on Stack traces For some reason, by default, ANT passes -g:none to the compiler and there is no way for it's default to be the same as Javacs default which is -g:line as far as I know. Also, in ANT you only have debug on (all) or off (none), check out the docs for javac and you will see it has more options... I wish ANT would expose these... Alan. -Original Message- From: Larason, Timothy [mailto:[EMAIL PROTECTED]] Sent: 19 November 2001 17:49 To: Ant Users List Subject: RE: Line numbers on Stack traces Correct me if I'm wrong everyone...but I believe the javac setting debug=true used to be the default for Ant 1.3, but isn't for Ant 1.4. To get the line numbers back in just do the following : javac debug=true / I guess it probably is best that debug=true is no longer the default. Makes for more efficient and smaller code in my opinion. -Original Message- From: David Oxley [mailto:[EMAIL PROTECTED]] Sent: Monday, November 19, 2001 12:38 PM To: 'Ant Users List' Subject: Line numbers on Stack traces All, I have lost line numbers on stack traces with code compiled with Ant 1.4. They used to be there when I compiled with Ant 1.3. Is this a default setting that has changed, a bug with Ant 1.4, or is it just coincidence and actually caused by something completely different. From the following excerpt, you can see that Tomcat line numbers come out, but not from our sources. at StaffPlannerServlet.processRequest(Unknown Source) at com.staffplanner.base.ServletBase.doPost(Unknown Source) at com.staffplanner.base.ServletBase.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) Thanks. Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
wlrun - anyone using it.
Is Anyone using the wlrun task and is it supported? Can't find docs except the javadoc... Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
generating absolute paths from relative ones...
Hello, I have a general problem where I have 2 build.xml files in different directories. One passes the other directory names for it to do it's job, but all the paths I have are relative and when I pass them from one to the other which have different basedirs I get a problem. Is there a way I can convert a relative path to an absolute one when I don't have any absolute paths? I thought PathConvert might help, but it does not look like it. I need to use something apart from string concats as I usually do. Any ideas would be very welcome... Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Problem with classes still loaded from WLS...
Hi All, I have an anoying.interesting problem. I have a build script that runs from CruiseControl. It builds everything, runs unit tests, starts weblogic, runs system tests and then finishes. But, the next time it runs it tries to remove the previous build, but it says it can't delete the .jar files. I presume that this is because weblogic loaded the jar files and is not letting go even though it has been shut down (as it runs in the same VM as the build). I would like to have the wlrun task run in a separate VM, but I can't seem to get it to do this... Any idea Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Problem with classes still loaded from WLS...
Follow on: I've removed the weblogic and it is still there. If I remove the unit testing it goes away. I now have junit running with a fork=true and it seems to be OK. But I can't get WLS to run in a separate VM using the wlrun task, I could just do a java to get it to run, but it seems to defeat the purpose. Is it possible to have an ant call run in a seperate VM? Maybe it would be nice to have a fork task that forked to run the tasks within??? Thanks, Alan. -Original Message- From: Alan Pearlman Spencer Sent: 28 November 2001 09:28 To: Ant Users List Subject: Problem with classes still loaded from WLS... Hi All, I have an anoying.interesting problem. I have a build script that runs from CruiseControl. It builds everything, runs unit tests, starts weblogic, runs system tests and then finishes. But, the next time it runs it tries to remove the previous build, but it says it can't delete the .jar files. I presume that this is because weblogic loaded the jar files and is not letting go even though it has been shut down (as it runs in the same VM as the build). I would like to have the wlrun task run in a separate VM, but I can't seem to get it to do this... Any idea Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Problem with classes still loaded from previous... (was: Problem with classes still loaded from WLS...)
More follow on: I still have the problem. I run a build from cruise control: all OK. I run the second build and I can't delete the jar files produced by the first build because, I presume, something in the first build is still holding on. I thought it was WLS, I removed it and it still happened. I thought it was junit, I removed it and it was still happening. Now I think it may be the javadoc. I'm tempted to replace my ant call with a java fork=true seems overkill though. Other people must (?) have seen this problem. If I try to delete the file by hand it (windows) will not let me until I stop the cruise control process. I presume the same problem would occur if I tried to delete the files at the end of the ant script running. Any ideas? Thanks, Alan. -Original Message- From: Alan Pearlman Spencer Sent: 28 November 2001 10:18 To: Ant Users List Subject: RE: Problem with classes still loaded from WLS... Follow on: I've removed the weblogic and it is still there. If I remove the unit testing it goes away. I now have junit running with a fork=true and it seems to be OK. But I can't get WLS to run in a separate VM using the wlrun task, I could just do a java to get it to run, but it seems to defeat the purpose. Is it possible to have an ant call run in a seperate VM? Maybe it would be nice to have a fork task that forked to run the tasks within??? Thanks, Alan. -Original Message- From: Alan Pearlman Spencer Sent: 28 November 2001 09:28 To: Ant Users List Subject: Problem with classes still loaded from WLS... Hi All, I have an anoying.interesting problem. I have a build script that runs from CruiseControl. It builds everything, runs unit tests, starts weblogic, runs system tests and then finishes. But, the next time it runs it tries to remove the previous build, but it says it can't delete the .jar files. I presume that this is because weblogic loaded the jar files and is not letting go even though it has been shut down (as it runs in the same VM as the build). I would like to have the wlrun task run in a separate VM, but I can't seem to get it to do this... Any idea Thanks, Alan. Alan Pearlman-Spencer MobileAware Ltd. 3225 Lake Drive, National Digital Park, CityWest Business Campus, Dublin 24. Ireland. Phone: +353 (0)1 2410 500 Fax: +353 (0)1 2410 501 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Copy to map dos to unix?
D'oh. Never noticed that one. I'll need to do another trawl through all the tasks. Thanks, Alan. -Original Message- From: Jon Skeet [mailto:[EMAIL PROTECTED]] Sent: 30 November 2001 09:37 To: Ant Users List Subject: RE: Copy to map dos to unix? Is it possible to convert dos to unix for ascii files? I was thinking of using copy maybe with a weird FilterSet, but I can't seem to get that to work. I think you're looking for the FixCRLF task. Jon -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]