Created
January 4, 2018 13:51
-
-
Save mjul/c9690910cc04dce4c2f041f2cb05c441 to your computer and use it in GitHub Desktop.
Ant macros for parametrized builds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- use Ant macrodef for to simplify building similar WAR files for test and production --> | |
<macrodef name="build-war"> | |
<attribute name="wartype" /> | |
<sequential> | |
<mkdir dir="${dist}/@{wartype}"/> | |
<war warfile="${dist}/@{wartype}/${ant.project.name}.war" webxml="etc/web-@{wartype}.xml"> | |
<classes dir="${path-to-classes}"/> | |
<mappedresources> | |
<fileset dir="etc"> | |
<include name="context-@{wartype}.xml"/> | |
</fileset> | |
<globmapper from="*-@{wartype}.xml" to="META-INF/*.xml"/> | |
</mappedresources> | |
<lib dir="lib"> | |
<exclude name="servlet-api.jar"/> | |
<exclude name="Xerces-J-bin.2.6.2.jar"/> | |
<exclude name="activation.jar"/> | |
<exclude name="mail.jar"/> | |
<exclude name="ojdbc6.jar"/> | |
<exclude name="xerces.jar"/> | |
</lib> | |
<fileset dir="web"> | |
<exclude name="WEB-INF/web.xml"/> | |
<exclude name="META-INF/context.xml"/> | |
</fileset> | |
</war> | |
</sequential> | |
</macrodef> | |
<target name="dist-test" depends="compile"> | |
<build-war wartype="test" /> | |
</target> | |
<target name="dist-prod" depends="compile"> | |
<build-war wartype="prod" /> | |
</target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment