Here’s how you can run any class from a jar file, using ant:
<java classname="my.class">
<classpath>
<pathelement location="my.jar"/>
</classpath>
</java>
Here’s how you can run any class from a jar file, using ant:
<java classname="my.class">
<classpath>
<pathelement location="my.jar"/>
</classpath>
</java>
Recently, I had to increase the memory ant was using. This is what I used:
set ANT_OPTS=-Xmx256m
An example on how you could use a fileset from a ruby script task:
<script language="ruby" classpathref="jruby_classpath">
task = $project.createDataType("fileset")
task.case_sensitive = false
task.setDir java.io.File.new($basedir)
task.setIncludes("**/*.*")
task.setExcludes("**/*test*/**")
scanner = task.getDirectoryScanner($project)
scanner.getIncludedFiles.each {|f| puts f}
</script>
This snippet will include every file in the basedir, except those containing the string test.
If you have a path written in a file, and you’d like to get a basename from it, like in the following example:
/this/is/my/path.txt
after you run this target, you will have only path.txt. Here’s the code that makes that possible:
<target name="rgx" description="basename equivalent">
<replaceregexp file="a.txt" match="(.*/)|(.*\\)" replace="" byline="true"/>
</target>
If for some reason ant interprets your backslashes and you need slashes to make your thing work, here’s a snippet that will convert your windows style path to a unix style one :
Here are some tips I can offer you which will most certainly make your life easier :
If I had known these tips, I would have saved several hours of work.