opinionated-vertx/build.xml
Peter Schuller b950c9ebdb [wip] initial commit
extracted useful snippets from other projects
2021-12-17 07:31:44 +01:00

106 lines
4.7 KiB
XML
Executable file

<?xml version="1.0" encoding="utf-8" ?>
<project name="opinionated-vertx" default="runnable-jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="source" location="src" />
<property name="doc" location="javadoc" />
<property name="bin" location="bin" />
<property name="source-test" location="test" />
<property name="lib-source" location="lib" />
<property name="ivy-conf-build" value="default" />
<property name="dist-dir" location="dist" />
<property name="reports-dir" location="reports" />
<property name="jar-bin" location="jar" />
<property name="main-verticle" value="de.pzzz.movr.repo.server.MainVerticle" />
<property name="main-class" value="io.vertx.core.Launcher" />
<property name="ivy.install.version" value="2.5.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<path id="project.class.path">
<pathelement location="${bin}" />
<fileset dir="${lib-source}" includes="*.jar" />
<fileset dir="${lib-source}" includes="**/*.jar" />
</path>
<target name="clean" description="Cleans this project">
<delete dir="${bin}" failonerror="false" />
<delete dir="${reports-dir}" failonerror="false" />
<delete dir="${doc}" failonerror="false" />
</target>
<target name="resolve" description="retrieve dependencies with ivy">
<ivy:retrieve pattern="${lib-source}/[conf]/[artifact]-([classifier]-)[revision].[ext]" sync="true" />
<ivy:report todir="${reports-dir}" graph="false" />
</target>
<target name='javadoc' description='Generate javadoc'>
<javadoc use='true' author='true' version='true' access='package' sourcepath='${source}' packagenames='*.*' destdir='${doc}' windowtitle='${ant.project.name} // ${STAMP}' noqualifier='java.*:javax.*:com.sun.*'>
<classpath refid='project.class.path' />
</javadoc>
</target>
<target name="compile" description="Compile java source to bytecode">
<mkdir dir="${bin}" />
<javac srcdir="${source}" includes="**" encoding="utf-8" destdir="${bin}" source="1.8" target="1.8" nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path" />
</javac>
<copy todir="${bin}">
<fileset dir="${source}" excludes="**/*.java" />
</copy>
</target>
<target name="runnable-jar" depends="compile" description="Create a war file">
<mkdir dir="${jar-bin}" />
<copy todir="${jar-bin}">
<fileset dir="${source}" excludes="**/*.java" />
</copy>
<copy todir="${jar-bin}">
<fileset dir="${bin}" />
</copy>
<jar jarfile="${dist-dir}/dependencies-all.jar">
<zipgroupfileset dir="${lib-source}">
<include name="**/*.jar" />
</zipgroupfileset>
</jar>
<mkdir dir="${dist-dir}" />
<jar destfile="${dist-dir}/${ant.project.name}.jar" basedir="${jar-bin}">
<zipfileset src="${dist-dir}/dependencies-all.jar" excludes="META-INF/*.SF" />
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<attribute name="Main-Verticle" value="${main-verticle}"/>
</manifest>
</jar>
</target>
<property name="ivy.install.version" value="2.5.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
</project>