maven-plugins/genapp/plugin.jelly

53 lines
1.6 KiB
XML

<?xml version="1.0"?>
<project
xmlns:ant="jelly:ant"
xmlns:j="jelly:core"
xmlns:u="jelly:util">
<goal
name="genapp"
description="Generate Application using 'maven -Dpackage=org.mycompany.project genapp'">
<j:if test="${package == null}">
<ant:fail message="">
You must specifiy a package for your application!
</ant:fail>
</j:if>
<!-- Turn the specified package into a path -->
<u:replace var="appPath" oldChar="." newChar="/" value="${package}"/>
<!-- We want to substitute in the package name. -->
<ant:filter token="PACKAGE" value="${package}"/>
<!-- Make Java source directory and populate. -->
<j:set var="appDirectory" value="${basedir}/src/java/${appPath}"/>
<ant:mkdir dir="${appDirectory}"/>
<ant:copy todir="${appDirectory}" filtering="true">
<ant:fileset dir="${plugin.resources}/src/java"/>
</ant:copy>
<!-- Make Java unit test source directory and populate. -->
<j:set var="appTestDirectory" value="${basedir}/src/test/${appPath}"/>
<ant:mkdir dir="${appTestDirectory}"/>
<ant:copy todir="${appTestDirectory}" filtering="true">
<ant:fileset dir="${plugin.resources}/src/test"/>
</ant:copy>
<!-- Starter POM and POM properties. -->
<ant:copy todir="${basedir}" filtering="true">
<ant:fileset dir="${plugin.resources}/src/pom"/>
</ant:copy>
<!-- Starter conf files to be placed in the JAR. -->
<ant:copy todir="${basedir}/src/conf">
<ant:fileset dir="${plugin.resources}/src/conf"/>
</ant:copy>
</goal>
</project>