Need help on setting jvmarg
Hi all, I'm using ant as my building tool. I have written some test case for my project and ran via goal. In this case i made fork="true" and ran on Linux (Ubuntu) system and worked perfectly. But when i try to run it on a Windos XP machine, rather than running the test cases, and when excuiting the goal, i get a help to "java", which is pertty wierad. Could some pro kindly tell me, what have i done false here. Any aid will be highly apprciated. Thanks, Saminda ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: and failifexecutionfails
I must admit that this area seems to be a real shortcoming in existing ANT tasks - not being able to reliably swallow errors in subtasks, whatever they may be. When I was trying to solve this problem before, there were suggestions as to how I can check that the specific task (tomcat undeploy) would succeed before executing it, rather than being able to support a failonerror property. This pre-validation is of course much more complex and less useful for similar problems but which aren't for tomcat related tasks. Is there a straightforward way to create a Task which swallows errors generically, regardless of the type of task. Can it be built? Cefn http://cefn.com -Original Message- From: Nicolas Vervelle [mailto:[EMAIL PROTECTED] Sent: Mon 9/19/2005 8:28 PM To: Ant Users List Subject: Re: and failifexecutionfails Hi again, I found how to overcome this problem : I first try to run xgettext2 with task and with only one arg (--help) abd with attributes failifexecutionfails="false" resultproperty="xxx" just to check for xgettext2 existence. Then I can use if xgettext2 exists. To me, it really seems to be a bug in failifexecutionfails="false" for the task. It doesn't work, at least not in the same way of the task. Nicolas De: Nicolas Vervelle <[EMAIL PROTECTED]> > Hi, > > I want to run an executable during the build only if the > executable is > available. > How can I prevent the build from failing if the executable is not > here ? > > I tried the failifexecutionfails attribute : > verbose="true" relative="true" forwardslash="true" > failifexecutionfails="false"> > > > > > > > > > > > > I thought that it would do the trick, but when I run the build > with the > executable missing, I got the following exception: > E:\Java\Jmol-HEAD\build-i18n.xml:54: Execute failed: > java.io.IOException: CreateProcess: xgettext2 -kGT._ -- > language=Java -- > [EMAIL PROTECTED] --output- > dir=E:\Java\Jmol-HEAD/src/org/jmol/translation/Jmol/tmp -- > output=Jmol.pot JmolApplet.java JmolAppletControl.java ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: and failifexecutionfails
[EMAIL PROTECTED] wrote: I must admit that this area seems to be a real shortcoming in existing ANT tasks - not being able to reliably swallow errors in subtasks, whatever they may be. When I was trying to solve this problem before, there were suggestions as to how I can check that the specific task (tomcat undeploy) would succeed before executing it, rather than being able to support a failonerror property. This pre-validation is of course much more complex and less useful for similar problems but which aren't for tomcat related tasks. Is there a straightforward way to create a Task which swallows errors generically, regardless of the type of task. Can it be built? I didn't try it but when I was looking for a solution to my problem I saw that ant-contrib has a tak. They are speaking about catching BuildException, not sure if it would catch other. From: Nicolas Vervelle [mailto:[EMAIL PROTECTED] Hi again, I found how to overcome this problem : I first try to run xgettext2 with task and with only one arg (--help) abd with attributes failifexecutionfails="false" resultproperty="xxx" just to check for xgettext2 existence. Then I can use if xgettext2 exists. To me, it really seems to be a bug in failifexecutionfails="false" for the task. It doesn't work, at least not in the same way of the task. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: and failifexecutionfails
[EMAIL PROTECTED] wrote: I must admit that this area seems to be a real shortcoming in existing ANT tasks - not being able to reliably swallow errors in subtasks, whatever they may be. You have to remember that Ant is designed to be a build tool, first and foremost, not a generic workflow system. It is only later, as things like deployment get involved, that you do start thinking about fault handling, cleanup etc. And in most builds, a simple "build failed" response is exactly right. The build failed: something didn't work. Many tasks have failonerror attributes, but that is still fairly simple error handling, it is "ignore specific errors here"; not real fault handling at all. 1. you can use to search a path (eg. env.Path and env.PATH) for an executable. You need to include the .exe extension for windows, assuming is an executable. 2. try/catch from ant-contrib will catch faults and let you handle them properly. -steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: problem with using fork in windows xp
Hi All, I am working on Apache axis2 project. I am trying to run few test cases using a build.xml. I do codegeneration, compiling and run all via this build.xml. But I am getting a runtime exception if I set fork = "false" both in linux and windows. Things are ok when fork="true" in linux(Ubuntu). But in windows it shows me the help to use java commands when fork = "true". Could somebody pls help me to overcome this triouble? This is a part of my build.xml where I get the trouble This is output in commant prompt when fork="true" E:\SVN2\modules\integration>ant Buildfile: build.xml prepare: clean: [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\classes1 [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\classes2 [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\src1 [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\src2 gen-1: [move] Moving 402 files to E:\SVN2\modules\integration\doclit-interop\class es1 [delete] Deleted 36 directories from E:\SVN2\modules\integration\doclit-inter op\src1\schema compile-1: [javac] Compiling 221 source files to E:\SVN2\modules\integration\doclit-int erop\classes1 compile-stub1: [javac] Compiling 4 source files to E:\SVN2\modules\integration\doclit-inter op\classes1 run-1: [junit] Running test.WMRound3Compound1InteropTest [junit] Usage: java [-options] class [args...] [junit](to execute a class) [junit]or java [-options] -jar jarfile [args...] [junit](to execute a jar file) [junit] where options include: [junit] -client to select the "client" VM [junit] -server to select the "server" VM [junit] -hotspot is a synonym for the "client" VM [deprecated] [junit] The default VM is client. [junit] -cp [junit] -classpath [junit] A ; separated list of directories, JAR archives, [junit] and ZIP archives to search for class files. [junit] -D= [junit] set a system property [junit] -verbose[:class|gc|jni] [junit] enable verbose output [junit] -version print product version and exit [junit] -version: [junit] require the specified version to run [junit] -showversion print product version and continue [junit] -jre-restrict-search | -jre-no-restrict-search [junit] include/exclude user private JREs in the version s earch [junit] -? -help print this help message [junit] -Xprint help on non-standard options [junit] -ea[:...|:] [junit] -enableassertions[:...|:] [junit] enable assertions [junit] -da[:...|:] [junit] -disableassertions[:...|:] [junit] disable assertions [junit] -esa | -enablesystemassertions [junit] enable system assertions [junit] -dsa | -disablesystemassertions [junit] disable system assertions BUILD FAILED E:\SVN2\modules\integration\build.xml:137: Test test.WMRound3Compound1InteropTes t failed Total time: 35 seconds If fork="no" then the output is an runtime exception:- [junit] java.util.zip.ZipException: error in opening zip file [junit] at java.util.zip.ZipFile.open(Native Method) [junit] at java.util.zip.ZipFile.(ZipFile.java:112) [junit] at java.util.zip.ZipFile.(ZipFile.java:128) [junit] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLo ader.java:919) [junit] at org.apache.tools.ant.AntClassLoader.getResource(AntClassLoade r.java:832) [junit] at org.apache.log4j.helpers.Loader.getResource(Loader.java:78) [junit] at org.apache.log4j.LogManager.(LogManager.java:94) [junit] at org.apache.log4j.Logger.getLogger(Logger.java:85) [junit] at org.apache.commons.logging.impl.Log4JLogger.(Log4JLogge r.java:102) [junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeC onstructorAccessorImpl.java:39) [junit] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Del egatingConstructorAccessorImpl.java:27) [junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:27 4) [junit] at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(Lo gFactoryImpl.java:525) [junit] at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(Lo gFactoryImpl.java:272) [junit] at org.apac
where is the problem?
hii everybody, I am newbie about ant I am having difficulties about ant+eclipse combination... Now I have a working source code, I can compile it under the command line .. without any problems.. how ever I couldnt been able to compile it via using ant .. . When I call it from eclipse, I get some intresiting errors from compiler.. that, for example, says, "\workspace\mysecond\src\form.java:2: package javax.servlet does not exist [javac] import javax.servlet.*;" and continues.. this is only specific problem when I use ant to compile and deploy it.. so I think it is related with my build.xml file.. which is... description tag leri arasi I think I am misiing a little point but really getting exhausted about that... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FW: problem with using fork in windows xp
Gayan Asanka wrote: Hi All, I am working on Apache axis2 project. I am trying to run few test cases using a build.xml. I do codegeneration, compiling and run all via this build.xml. But I am getting a runtime exception if I set fork = "false" both in linux and windows. Things are ok when fork="true" in linux(Ubuntu). But in windows it shows me the help to use java commands when fork = "true". Could somebody pls help me to overcome this triouble? probably means your classpath is bad, so javac is getting confused. run in -verbose to see what command is generated, and look for too many quotes in the classpath argument -steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is the problem?
Hi Aydin, try putting the servlet (J2EE) classes in the classpath for the javac task. The following page shows you how to do this under references (it should look familiar): http://ant.apache.org/manual/using.html Barry Aydın Toprak wrote: hii everybody, I am newbie about ant I am having difficulties about ant+eclipse combination... Now I have a working source code, I can compile it under the command line .. without any problems.. how ever I couldnt been able to compile it via using ant .. . When I call it from eclipse, I get some intresiting errors from compiler.. that, for example, says, "\workspace\mysecond\src\form.java:2: package javax.servlet does not exist [javac] import javax.servlet.*;" and continues.. this is only specific problem when I use ant to compile and deploy it.. so I think it is related with my build.xml file.. which is... description tag leri arasi I think I am misiing a little point but really getting exhausted about that... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is the problem?
Thanks Barry, But I have already added those paths to my enviroment and everything (excep this) works smoothly.. how ever, it still resists about the missing packages.. but I have them and can compile the java code on the command promp, in the same directory.. Barry White wrote: Hi Aydin, try putting the servlet (J2EE) classes in the classpath for the javac task. The following page shows you how to do this under references (it should look familiar): http://ant.apache.org/manual/using.html Barry Aydın Toprak wrote: hii everybody, I am newbie about ant I am having difficulties about ant+eclipse combination... Now I have a working source code, I can compile it under the command line .. without any problems.. how ever I couldnt been able to compile it via using ant .. . When I call it from eclipse, I get some intresiting errors from compiler.. that, for example, says, "\workspace\mysecond\src\form.java:2: package javax.servlet does not exist [javac] import javax.servlet.*;" and continues.. this is only specific problem when I use ant to compile and deploy it.. so I think it is related with my build.xml file.. which is... description tag leri arasi basedir="${build}"/> I think I am misiing a little point but really getting exhausted about that... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: where is the problem?
Hello Aydin, Ant+Eclipse is a slightly diffferent animal than Ant all alone - depending on how you have your classpath setup for compiling (basically - explicitly listed in build.xml vs imported as a property vs set in your environment) you may have to mess about with Eclipse's Ant runtime preferences (Window -> Preferences -> Ant -> Runtime) /t >-Original Message- >From: Aydın Toprak [mailto:[EMAIL PROTECTED] >Sent: Tuesday, September 20, 2005 2:33 PM >To: Ant Users List >Subject: Re: where is the problem? > >Thanks Barry, >But I have already added those paths to my enviroment and everything >(excep this) works smoothly.. how ever, it still resists about the >missing packages.. but I have them and can compile the java >code on the >command promp, in the same directory.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is the problem?
Ant must be using a different environment then, because it can't find javax.servlet My advice would be to forget eclipse for now and get the build working on the command line. How many javac's do you have on your system? Which one is in your PATH? What is JAVA_HOME set to? If JAVA_HOME is set to a J2SE installation there will be no javax.servlet in the classpath - unless explicitly set in CLASSPATH or in the build file. Eclipse may just confuse matters while you are learning Ant. Get back to basics and make sure Ant is set up correctly. I only use eclipse for code editing - Ant does the rest. Good luck, Barry Aydın Toprak wrote: Thanks Barry, But I have already added those paths to my enviroment and everything (excep this) works smoothly.. how ever, it still resists about the missing packages.. but I have them and can compile the java code on the command promp, in the same directory.. Barry White wrote: Hi Aydin, try putting the servlet (J2EE) classes in the classpath for the javac task. The following page shows you how to do this under references (it should look familiar): http://ant.apache.org/manual/using.html Barry Aydın Toprak wrote: hii everybody, I am newbie about ant I am having difficulties about ant+eclipse combination... Now I have a working source code, I can compile it under the command line .. without any problems.. how ever I couldnt been able to compile it via using ant .. . When I call it from eclipse, I get some intresiting errors from compiler.. that, for example, says, "\workspace\mysecond\src\form.java:2: package javax.servlet does not exist [javac] import javax.servlet.*;" and continues.. this is only specific problem when I use ant to compile and deploy it.. so I think it is related with my build.xml file.. which is... description tag leri arasi basedir="${build}"/> I think I am misiing a little point but really getting exhausted about that... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: problem with using fork in windows xp
Hi steve, Nop, it compiles well. You can see if observe my output (also I tried ant -v, everything is in the classpath). I am getting a runtime exception if only I set fork="no", that is both in linux and windows. But it runs in linux when fork="true". So I need a way to run it in windows xp with fork="yes". Since it shows me the help for java commands when I set fork="true" in win xp, I think I have to set jvmargs to set the "java" command again (because fork="true" overrides junit values), if I set fork="true", am I right? If so how can I set jvmargs? If I am wrong, still need your help. :) Thank you very much for the concern Thanks Gayan Asanka -Original Message- From: Steve Loughran [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 20, 2005 5:37 PM To: Ant Users List Subject: Re: FW: problem with using fork in windows xp Gayan Asanka wrote: > > > Hi All, > > > > I am working on Apache axis2 project. I am trying to run few test cases > using a build.xml. I do codegeneration, compiling and run all via this > build.xml. But I am getting a runtime exception if I set fork = "false" both > in linux and windows. Things are ok when fork="true" in linux(Ubuntu). But > in windows it shows me the help to use java commands when fork = "true". > Could somebody pls help me to overcome this triouble? probably means your classpath is bad, so javac is getting confused. run in -verbose to see what command is generated, and look for too many quotes in the classpath argument -steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is the problem?
Thanks for everyone; I have solved the problem. The problem is all about the libraries (.jar files) that we have to add the ant runtime which is in the eclipse(window->preferances->ant->runtime)... I used to add the related libraries like j2ee.jar... however whenever I add those important libraries to the runtime enviroment and close the window, every thing that I have added dissapears (as far as I understood, ant envirement didnt include them!) ... but when I added thoses libraries under the global entries, I have succeded... now everthing stays :)... it is a dramtic stiuation for a proffessional.. but I am still learning.. :) Barry White wrote: Ant must be using a different environment then, because it can't find javax.servlet My advice would be to forget eclipse for now and get the build working on the command line. How many javac's do you have on your system? Which one is in your PATH? What is JAVA_HOME set to? If JAVA_HOME is set to a J2SE installation there will be no javax.servlet in the classpath - unless explicitly set in CLASSPATH or in the build file. Eclipse may just confuse matters while you are learning Ant. Get back to basics and make sure Ant is set up correctly. I only use eclipse for code editing - Ant does the rest. Good luck, Barry Aydın Toprak wrote: Thanks Barry, But I have already added those paths to my enviroment and everything (excep this) works smoothly.. how ever, it still resists about the missing packages.. but I have them and can compile the java code on the command promp, in the same directory.. Barry White wrote: Hi Aydin, try putting the servlet (J2EE) classes in the classpath for the javac task. The following page shows you how to do this under references (it should look familiar): http://ant.apache.org/manual/using.html Barry Aydın Toprak wrote: hii everybody, I am newbie about ant I am having difficulties about ant+eclipse combination... Now I have a working source code, I can compile it under the command line .. without any problems.. how ever I couldnt been able to compile it via using ant .. . When I call it from eclipse, I get some intresiting errors from compiler.. that, for example, says, "\workspace\mysecond\src\form.java:2: package javax.servlet does not exist [javac] import javax.servlet.*;" and continues.. this is only specific problem when I use ant to compile and deploy it.. so I think it is related with my build.xml file.. which is... description tag leri arasi basedir="${build}"/> I think I am misiing a little point but really getting exhausted about that... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SOLUTION: Cvs and extSSH and Ant
Hi All, i have seen various posts here and elsewhere about talking to a cvs server using ant when the auth method is ssh. I have finally managed to track down a web page with instructions that work for windows. Here it is: http://nlp.stanford.edu/javanlp/cvs-guide.html I can confirm the Windows instructions work. Take care Rakesh
Re: FW: problem with using fork in windows xp
Gayan Asanka wrote: Hi steve, Nop, it compiles well. You can see if observe my output (also I tried ant -v, everything is in the classpath). I am getting a runtime exception if only I set fork="no", that is both in linux and windows. But it runs in linux when fork="true". So I need a way to run it in windows xp with fork="yes". well, it ought to, unless the commands to java are getting screwed up. Since it shows me the help for java commands when I set fork="true" in win xp, I think I have to set jvmargs to set the "java" command again (because fork="true" overrides junit values), if I set fork="true", am I right? If so how can I set jvmargs? If I am wrong, still need your help. :) no, you need to look at the detailed jvm args and paste it in to your next mail. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where is the problem?
Aydın Toprak wrote: Thanks for everyone; I have solved the problem. The problem is all about the libraries (.jar files) that we have to add the ant runtime which is in the eclipse(window->preferances->ant->runtime)... I used to add the related libraries like j2ee.jar... however whenever I add those important libraries to the runtime enviroment and close the window, every thing that I have added dissapears (as far as I understood, ant envirement didnt include them!) ... but when I added thoses libraries under the global entries, I have succeded... now everthing stays :)... it is a dramtic stiuation for a proffessional.. but I am still learning.. :) You shouldnt be setting your classpath up this way. instead declare a path that explicitly includes a copy of j2ee.jar that you have somewhere in your project libraries. then use it in compiles - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ssh advice
I would suggest changing your process slightly. Run Ant on the unix box where you "dist the project". Of course, I'm not sure what output you are trying to evaluate, but this may help your situation. -Rob Anderson > -Original Message- > From: Ramnish Kalsi [mailto:[EMAIL PROTECTED] > Sent: Friday, September 16, 2005 4:19 AM > To: Ant Users List > Subject: ssh advice > > Hi, I am working on a project to automate a build system, and > the flow is somewhat like this: > > 1. ssh into a unix machine. > 2. Sync the repository > 3. dist the projects. > 4. ssh into application-specific unix boxes and deploy > appropriate apps to appropriate boxes. > > How can i gather the output of ssh task into a variable and > take logical decisions based upon the output. > What should be the best possible approach for this ? > > thanks. > ramnish. > > Ant version: 1.6.2 > Java version: 1.4.2_03 > > > ** > This email and any files transmitted with it are confidential > and intended solely for the use of the individual or entity > to whom they are addressed. If you have received this email > in error please notify the system manager. > > This footnote also confirms that this email message has been > swept by MIMEsweeper for the presence of computer viruses. > > www.mimesweeper.com > ** > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] For > additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Extracting application version from Java file
Hi, In one of my Java source file, I have a line like this: public final static String version = "XX.YY.ZZ"; I'd like to extract the XX.YY.ZZ from the Ant build to name the resulting jar file with it : Jmol.XX.YY.ZZ.jar Can someone help me with how to extract the string from the file ? Thanks in advance, Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extracting application version from Java file
You're going to wrong way. Pass into your Ant build the version number like so: ant -Dversion=XX.YY.ZZ clean build test. Then use the task to replace a token in your Java file. Even better, you store that number in MANIFEST.MF and update it with the task. Or, use a properties file. That way your dev's aren't the ones that set the version, your build controller/cm person does. Oh, and just grab ${version} and use it in your task like so: ... Robert Nicolas Vervelle <[EMAIL PROTECTED]> 09/20/2005 11:23 AM Please respond to "Ant Users List" To user@ant.apache.org cc Subject Extracting application version from Java file Hi, In one of my Java source file, I have a line like this: public final static String version = "XX.YY.ZZ"; I'd like to extract the XX.YY.ZZ from the Ant build to name the resulting jar file with it : Jmol.XX.YY.ZZ.jar Can someone help me with how to extract the string from the file ? Thanks in advance, Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extracting application version from Java file
Hi Nicolas, how about controlling the version number in the build? then update the version in the source file on every build: and then compile and use ${version} to name the jar? Barry Nicolas Vervelle wrote: Hi, In one of my Java source file, I have a line like this: public final static String version = "XX.YY.ZZ"; I'd like to extract the XX.YY.ZZ from the Ant build to name the resulting jar file with it : Jmol.XX.YY.ZZ.jar Can someone help me with how to extract the string from the file ? Thanks in advance, Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extracting application version from Java file
We go one step further.. In the code base there is a build.properties file with the following data: build.version=XX.YY.ZZ build.date=2005-09-21 build.date.format=-mm-dd Then instead of a static variable in Java class (say called BuildInfo.java) we have static method called getBuildVersion() (and getBuildDate()) which read the build.properties file, cache the results and return the value the callee. Our build process (using CruiseControl) writes/updates the build.properties file only... Build.java is not modified. Hope that helps, Ninju --- Barry White <[EMAIL PROTECTED]> wrote: > Hi Nicolas, > > how about controlling the version number in the > build? > > > > then update the version in the source file on every > build: > > file="${source}/some/package/Class.java"> > > > > > and then compile and use ${version} to name the jar? > > Barry > > Nicolas Vervelle wrote: > > Hi, > > > > In one of my Java source file, I have a line like > this: > > public final static String version = "XX.YY.ZZ"; > > > > I'd like to extract the XX.YY.ZZ from the Ant > build to name the > > resulting jar file with it : Jmol.XX.YY.ZZ.jar > > > > Can someone help me with how to extract the string > from the file ? > > > > Thanks in advance, > > Nicolas > > > > > > > - > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Extracting application version from Java file
Hello List, I was going to reply to Nicolas that, whilst i agree with the other two replies (you should pass the version in somehow and not read it from the java source file), you *can* achieve what he is trying to do using the task with a nested filterchain. But i can't seem to get it to work. I've posted my example below, can anybody see what i'm doing wrong? --mytest.java public class mytest { public static final String VERSION = "XX.YY.ZZ"; public static void main(String[] args) { System.out.println("Hello, World!"); } } --build.xml ${VERSION} i get a "Unable to load file: java.io.IOException" message. I've tried putting a static properties file and loading that - no probs. I've tried copying the class to a properties file by using the classconstants filterchain... didn't work (same error). /t >-Original Message- >From: Nicolas Vervelle [mailto:[EMAIL PROTECTED] >Sent: Tuesday, September 20, 2005 6:23 PM >To: user@ant.apache.org >Subject: Extracting application version from Java file > >Hi, > >In one of my Java source file, I have a line like this: >public final static String version = "XX.YY.ZZ"; > >I'd like to extract the XX.YY.ZZ from the Ant build to name the >resulting jar file with it : Jmol.XX.YY.ZZ.jar > >Can someone help me with how to extract the string from the file ? > >Thanks in advance, >Nicolas > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Extracting application version from Java file
Sorted - i didn't have the bcel.jar in my lib folder. Added it and it works fine. Sooo - Nicolas, *if* you have bcel.jar installed, you can use the example below to get your version string out of your file! (but you shouldn't ;) /t >-Original Message- >From: RADEMAKERS Tanguy >Sent: Tuesday, September 20, 2005 8:26 PM >To: 'Ant Users List' >Subject: RE: Extracting application version from Java file > >Hello List, > >I was going to reply to Nicolas that, whilst i agree with the >other two replies (you should pass the version in somehow and >not read it from the java source file), you *can* achieve what >he is trying to do using the task with a >nested filterchain. But i can't seem to get >it to work. I've posted my example below, can anybody see what >i'm doing wrong? > >--mytest.java >public class mytest >{ > public static final String VERSION = "XX.YY.ZZ"; > > public static void main(String[] args) > { > System.out.println("Hello, World!"); > } >} > >--build.xml > > > > > destdir="." > includes="mytest.java"/> > > > > > > > >${VERSION} > > > > > >i get a "Unable to load file: java.io.IOException" message. >I've tried putting a static properties file and loading that - >no probs. I've tried copying the class to a properties file by >using the classconstants filterchain... didn't work (same error). > >/t - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ANT build script from NetBeans is failing
I'm using NetBeans to manage a few Java projects. Recently I found a need to build manually with the command line (read: scriptable) ant, and I found that one of the three projects would sometimes fail. On the NetBeans machine (windows + cygwin), the ant build works fine. The same directory copied to two other machines (linux boxes) fails. Clearing the classpath, -debug and -verbose don't seem to offer any clues. Here's the output: -pre-compile: -do-compile: [javac] Compiling 98 source files to /root/tmpdev/svn_buildtest__2005.09.20..10.52.56/trunk/netbeans/CFApplet/build/classes [javac] /root/tmpdev/svn_buildtest__2005.09.20..10.52.56/trunk/netbeans/CFApplet/source/com/ibm/cf/ui/adminapplet/CFConnection.java:61: cannot find symbol [javac] symbol : method printf(java.lang.String,java.lang.String) [javac] location: class java.io.PrintWriter [javac] out.printf("%s\0", mystr); [javac]^ [javac] /root/tmpdev/svn_buildtest__2005.09.20..10.52.56/trunk/netbeans/CFApplet/source/com/ibm/proj/soapclient/AddServerClient.java:77: incompatible types [javac] found : java.lang.Integer [javac] required: int [javac] return (Integer) ret; [javac]^ [javac] It seems as though the classpath is messed up, but the other projects build just fine. What can I do to further diagnose what is going on? Is there a fundamental incompatibility between NetBeans auto-generated scripts and manual ant building? (NetBeans 4.1, ant 1.6.5) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Extracting application version from Java file
Thanks for this solution :) I am considering where I should put the version (in a Java file, a property file or in the build.xml) The pros and the cons: 1) in build.xml: I don't like it because : - two files are modified and need to be committed when the version is changed (build.xml and java). - requires to run Ant to put the correct version in the program. I am working under Eclipse, so Ant is only used when I need to make a distribution. 2) in a property file: Seems better. Need to modify the program and the build file at first, but after only one property file. 2) in the Java file: That was my first idea. Need to modify only the build file at first, and after only the java file. After your first mail, I had a look at and found an other way to do it. It doesn't require bcel, because I can directly parse the java source code. Not very elegant, but works: Well, thanks a lot for the ideas Have to decide what way to go with ;) Nicolas De: RADEMAKERS Tanguy <[EMAIL PROTECTED]> > Sorted - i didn't have the bcel.jar in my lib folder. Added it and it > works fine. > > Sooo - Nicolas, *if* you have bcel.jar installed, you can use > the example below to get your version string out of your file! > > (but you shouldn't ;) > > /t > > >-Original Message- > >From: RADEMAKERS Tanguy > >Sent: Tuesday, September 20, 2005 8:26 PM > >To: 'Ant Users List' > >Subject: RE: Extracting application version from Java file > > > >Hello List, > > > >I was going to reply to Nicolas that, whilst i agree with the > >other two replies (you should pass the version in somehow and > >not read it from the java source file), you *can* achieve what > >he is trying to do using the task with a > >nested filterchain. But i can't seem to get > >it to work. I've posted my example below, can anybody see what > >i'm doing wrong? > > > >--mytest.java > >public class mytest > >{ > > public static final String VERSION = "XX.YY.ZZ"; > > > > public static void main(String[] args) > > { > > System.out.println("Hello, World!"); > > } > >} > > > >--build.xml > > > > > > > > > > > destdir="." > > includes="mytest.java"/> > > > > > > > > > > > > > > > >${VERSION} > > > > > > > > > > > >i get a "Unable to load file: java.io.IOException" message. > >I've tried putting a static properties file and loading that - > >no probs. I've tried copying the class to a properties file by > >using the classconstants filterchain... didn't work (same error). > > > >/t > > --- > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FW: problem with using fork in windows xp
Hi Steve, For your convenience I hoped attach my build.xml to this mail. If you don't mind I can send my other resources too as you can regenerate this error (if you can find a win xp os). This is the output I see. E:\SVN2\modules\integration>ant Buildfile: build.xml prepare: [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\classes1 [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\classes2 [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\src1 [mkdir] Created dir: E:\SVN2\modules\integration\doclit-interop\src2 gen-1: [move] Moving 402 files to E:\SVN2\modules\integration\doclit-interop\class es1 [delete] Deleted 36 directories from E:\SVN2\modules\integration\doclit-inter op\src1\schema compile-1: [javac] Compiling 221 source files to E:\SVN2\modules\integration\doclit-int erop\classes1 compile-stub1: [javac] Compiling 4 source files to E:\SVN2\modules\integration\doclit-inter op\classes1 run-1: [junit] Running test.Round3DocLitInteropTest [junit] Usage: java [-options] class [args...] [junit](to execute a class) [junit]or java [-options] -jar jarfile [args...] [junit](to execute a jar file) [junit] where options include: [junit] -client to select the "client" VM [junit] -server to select the "server" VM [junit] -hotspot is a synonym for the "client" VM [deprecated] [junit] The default VM is client. [junit] -cp [junit] -classpath [junit] A ; separated list of directories, JAR archives, [junit] and ZIP archives to search for class files. [junit] -D= [junit] set a system property [junit] -verbose[:class|gc|jni] [junit] enable verbose output [junit] -version print product version and exit [junit] -version: [junit] require the specified version to run [junit] -showversion print product version and continue [junit] -jre-restrict-search | -jre-no-restrict-search [junit] include/exclude user private JREs in the version s earch [junit] -? -help print this help message [junit] -Xprint help on non-standard options [junit] -ea[:...|:] [junit] -enableassertions[:...|:] [junit] enable assertions [junit] -da[:...|:] [junit] -disableassertions[:...|:] [junit] disable assertions [junit] -esa | -enablesystemassertions [junit] enable system assertions [junit] -dsa | -disablesystemassertions [junit] disable system assertions BUILD FAILED E:\SVN2\modules\integration\build.xml:132: Test test.Round3DocLitInteropTest failed Total time: 36 seconds E:\SVN2\modules\integration> -Original Message- From: Steve Loughran [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 20, 2005 8:33 PM To: Ant Users List Subject: Re: FW: problem with using fork in windows xp Gayan Asanka wrote: > Hi steve, > > Nop, it compiles well. You can see if observe my output (also I tried ant > -v, everything is in the classpath). > > I am getting a runtime exception if only I set fork="no", that is both in > linux and windows. But it runs in linux when fork="true". So I need a way to > run it in windows xp with fork="yes". well, it ought to, unless the commands to java are getting screwed up. > Since it shows me the help for java commands when I set fork="true" in win > xp, I think I have to set jvmargs to set the "java" command again (because > fork="true" overrides junit values), if I set fork="true", am I right? If > so how can I set jvmargs? If I am wrong, still need your help. :) no, you need to look at the detailed jvm args and paste it in to your next mail. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Interop tests for doc-lit, code generated samples - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]