Using ant to detect os and set property

Move your condition out of the <target />, as your target probably isn’t invoked. <condition property=”isWindows”> <os family=”windows” /> </condition> <condition property=”isLinux”> <os family=”unix” /> </condition>

Ant – how to get all files’ name in a specific folder

You’re on the right track, use manifestclasspath task. The jarfile attribute is used to create relative links to the jars contained in the fileset. <manifestclasspath property=”jar.classpath” jarfile=”${client_work_dir}/HelloWorld.jar”> <classpath> <fileset name=”” dir=”${client_work_dir}/lib” includes=”*.jar”/> </classpath> </manifestclasspath> <jar jarfile=”${client_deploy_dir}/HelloWorld.jar” basedir=”${client_work_dir}/compiled”> <manifest> <attribute name=”Main-Class” value=”HelloWorld.Main”/> <attribute name=”Class-Path” value=””${jar.classpath}”/> </manifest> </jar>

integrating JaCoCo in sonar using Ant

The following is an ANT build that is configured to run a junit unit test and use jacoco for code coverage reporting. The results are uploaded to Sonar and finally ivy is used to download 3rd party jars and manage classpaths. Example ├── build.properties ├── build.xml ├── ivy.xml └── src ├── main │   └── java … Read more

Create jfreechart-1.5.3 JAR from source code

As illustrated here, you can clone the repository, check out the branch with the desired tag and use maven to build the release JARs. See also Migration from JFreeChart 1.0.x $ git clone https://github.com/jfree/jfreechart.git jfreechart $ pushd jfreechart $ git fetch –tags $ git tag –list … v1.5.3 $ git checkout v1.5.3 Note: switching to … Read more

How to include ant-contrib.jar dynamically in Ant

The best way is to put the Ant-Contrib jarfile inside you project. For example, let’s say the build.xml is in the root of your project. Create a directory called ant.lib\ant-contrib inside your project, then put the ant-contrib*.jar in this folder. You can use this method for other optional Ant tasks that you might need (for … Read more

Ivy, what is the master configuration and why is it not pulling jvyaml?

I would suggest restructuring your configurations as follows: <ivy-module version=”2.0″> <info organisation=”com.myspotontheweb” module=”demo”/> <configurations> <conf name=”compile” description=”Libraries needed only for compilation” /> <conf name=”runtime” description=”Libraries only needed at runtime” extends=”compile” /> <conf name=”test” description=”Libraries only needed for testing” extends=”runtime” /> </configurations> <dependencies> <dependency org=”net.java.dev” name=”jvyaml” rev=”0.2.1″ conf=”runtime->default” /> <dependency org=”org.apache.solr” name=”solr-core” rev=”3.6.0″ conf=”runtime->default” /> </dependencies> … Read more

Generate manifest class-path from in Ant

<path id=”build.classpath”> <fileset dir=”${basedir}”> <include name=”lib/*.jar”/> </fileset> </path> <pathconvert property=”manifest.classpath” pathsep=” “> <path refid=”build.classpath”/> <mapper> <chainedmapper> <flattenmapper/> <globmapper from=”*.jar” to=”lib/*.jar”/> </chainedmapper> </mapper> </pathconvert> <target depends=”compile” name=”buildjar”> <jar jarfile=”${basedir}/${test.jar}”> <fileset dir=”${build}” /> <manifest> <attribute name=”Main-Class” value=”com.mycompany.TestMain”/> <attribute name=”Class-Path” value=”${manifest.classpath}”/> </manifest> </jar> </target> For further information check out this article.

Ant to Maven – multiple build targets

You could do this with profiles… If you really wanted to use two separate profiles and customize the JAR plugin to include and exclude patterns of class and package names, you could easily do this by putting something like this in your POM: <profiles> <profile> <id>everything</id> <build> <plugins> <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <classifier>everything</classifier> <includes> <include>**/*</include> </includes> … Read more

How do I use Nant/Ant naming patterns?

The rules are: a single star (*) matches zero or more characters within a path name a double star (**) matches zero or more characters across directory levels a question mark (?) matches exactly one character within a path name Another way to think about it is double star (**) matches slash (/) but single … Read more