Ant, download fileset from remote machine

Since you haven’t specified I’ll assume that your local and remote systems are unix based and therefore support rsync and ssh. A more cross-platform solution is challenging… Example Configure SSH Generate an SSH key (specify an empty passphrase): ssh-keygen -f rsync This will generate 2 files, corresponding to the private and public keys: |– rsync … 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

Cannot find Main Class in File Compiled With Ant

Looks like your runtime classpath is missing the jar containing the class org.supercsv.io.ICsvBeanReader. The gotcha is that you cannot set the classpath from the command-line when calling an executable jar. You have to set it within the manifest as follows: <target name=”dist” depends=”compile” description=”Generates distributable”> <!– creates the distribution directory –> <mkdir dir=”${dist}/lib” /> <!– … Read more

Ant path style patterns

Ant-style path patterns matching in spring-framework: The mapping matches URLs using the following rules: ? matches one character * matches zero or more characters ** matches zero or more ‘directories’ in a path {spring:[a-z]+} matches the regexp [a-z]+ as a path variable named “spring” Some examples: com/t?st.jsp – matches com/test.jsp but also com/tast.jsp or com/txst.jsp … Read more

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

How to execute XSLT 2.0 with ant?

The problem is that while Saxon is added to the classpath, the default JAXP mechanism to determine which TransformerFactory is used and it will use the default that is Xalan. You either need to: Set javax.xml.transform.TransformerFactory system variable to net.sf.saxon.TransformerFactoryImpl, Add saxon9.jar to the CLASSPATH system variable, or Use <factory name=”net.sf.saxon.TransformerFactoryImpl”/> inside the xslt element