Skip to content

Instantly share code, notes, and snippets.

@osima
Created November 12, 2010 05:42
Show Gist options
  • Select an option

  • Save osima/673772 to your computer and use it in GitHub Desktop.

Select an option

Save osima/673772 to your computer and use it in GitHub Desktop.
groovy と java を混ぜた状態でビルドする build.xml の記述方法(Ant)
<?xml version="1.0" encoding="UTF-8"?>
<project default="jar">
<property environment="env" />
<path id="groovy.classpath"> <fileset dir="${env.GROOVY_HOME}/embeddable/" /> </path>
<taskdef
name = "groovyc"
classname = "org.codehaus.groovy.ant.Groovyc"
classpathref = "groovy.classpath" />
<target name="init">
<property name="version" value="1.0"/>
<property name="name" value="test-${version}"/>
<property name="build.src" value="./src"/>
<property name="build.dest" value="./bin"/>
<property name="build.jar" value="${name}.jar"/>
<property name="libdir" value="./lib"/>
<path id="compile.class.path">
<fileset dir="${libdir}" includes="*.jar" />
<fileset dir="${env.GROOVY_HOME}/lib/" />
<!--
<fileset dir="${env.GROOVY_HOME}/embeddable/" />
-->
</path>
</target>
<target name="clean" depends="init">
<delete dir="${build.dest}" />
<delete file="${build.jar}" />
</target>
<target name="jar" depends="compile">
<jar destfile="${build.jar}">
<zipfileset dir="${build.dest}" />
</jar>
</target>
<target name="compile" depends="init" description = "compile groovy to bytecode">
<mkdir dir="${build.dest}" />
<groovyc
encoding="UTF-8"
srcdir="${build.src}"
destdir="${build.dest}"
classpathref = "compile.class.path" >
<javac >
<classpath refid="compile.class.path"/>
<include name="**/*.java" />
</javac>
</groovyc>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment