Skip to content

Instantly share code, notes, and snippets.

@viet-wego
Created August 22, 2016 07:35
Show Gist options
  • Save viet-wego/e7161fa34f33095c17f21c534b2f247e to your computer and use it in GitHub Desktop.
Save viet-wego/e7161fa34f33095c17f21c534b2f247e to your computer and use it in GitHub Desktop.
Sample Netbeans build file with Ivy
<?xml version="1.0" encoding="UTF-8"?>
<project name="sample-api" default="default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>Builds, tests, and runs the project user_api.</description>
<import file="nbproject/build-impl.xml"/>
<property name="ivy.jar.file" value="/home/viettd/netbeans-8.1/extide/ant/lib/ivy-2.4.0.jar" />
<target name="ivy-set-path" description="sets path to ivy file">
<path id="ivy.lib.path">
<pathelement location="${ivy.jar.file}"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="download-deps" depends="ivy-set-path"
description="-->download dependecy">
<ivy:resolve/> <!-- Tell Ivy to resolve dependencies -->
<ivy:retrieve/> <!-- Load dependencies to the project -->
<!-- update classpath for netbeans/ant properties file -->
<pathconvert property="ivy.classpath.computed" dirsep="/" pathsep=":">
<path>
<fileset dir="lib" includes="*.jar" excludes="*-javadoc.jar *-sources.jar"/>
</path>
<map from="${basedir}${file.separator}" to=""/>
</pathconvert>
<propertyfile file="nbproject/project.properties">
<entry operation="=" key="ivy.classpath" value="${ivy.classpath.computed}"/>
</propertyfile>
</target>
<target name="-pre-compile" depends="download-deps"/>
<target name="-pre-compile-single" depends="download-deps"/>
<target name="clean-cache-ivy" depends="ivy-set-path"
description="delete all depency">
<ivy:cleancache/>
<propertyfile file="${basedir}/nbproject/project.properties">
<entry operation="=" key="ivy.classpath" value=""/>
</propertyfile>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment