o applying patches for MPGENAPP-1
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MPGENAPP-1 git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114435 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -25,18 +25,20 @@
|
|||||||
<i:ask question="${maven.genapp.prompt.template}" answer="template" default="${maven.genapp.default.template}"/>
|
<i:ask question="${maven.genapp.prompt.template}" answer="template" default="${maven.genapp.default.template}"/>
|
||||||
</j:if>
|
</j:if>
|
||||||
|
|
||||||
|
<!-- Search the template in the plugin resources at first place -->
|
||||||
|
<u:available file="${plugin.resources}/${template}">
|
||||||
|
<j:set var="maven.genapp.template.dir" value="${plugin.resources}/${template}"/>
|
||||||
|
</u:available>
|
||||||
|
|
||||||
<!-- If template is in the user's home directory, use it -->
|
<!-- If template is in the user's home directory, use it -->
|
||||||
<u:available file="${user.home}/.maven/template/${template}">
|
<u:available file="${user.home}/.maven/template/${template}">
|
||||||
<j:set var="maven.genapp.template.dir" value="${user.home}/.maven/template/${template}"/>
|
<j:set var="maven.genapp.template.dir" value="${user.home}/.maven/template/${template}"/>
|
||||||
</u:available>
|
</u:available>
|
||||||
|
|
||||||
<j:set var="currenttemplatedir" value="${maven.genapp.template.dir}"/>
|
<!-- If template is in a given template repository, use it -->
|
||||||
<j:if test="${empty(currenttemplatedir)}">
|
<u:available file="${maven.genapp.template.repository}/${template}">
|
||||||
<!-- The template was not found in user.home, check in the plugin resources -->
|
<j:set var="maven.genapp.template.dir" value="${maven.genapp.template.repository}/${template}"/>
|
||||||
<u:available file="${plugin.resources}/${template}">
|
</u:available>
|
||||||
<j:set var="maven.genapp.template.dir" value="${plugin.resources}/${template}"/>
|
|
||||||
</u:available>
|
|
||||||
</j:if>
|
|
||||||
</j:if>
|
</j:if>
|
||||||
|
|
||||||
<j:set var="currenttemplatedir" value="${maven.genapp.template.dir}"/>
|
<j:set var="currenttemplatedir" value="${maven.genapp.template.dir}"/>
|
||||||
@@ -65,33 +67,45 @@
|
|||||||
<u:properties file="${maven.genapp.template.dir}/template.properties"/>
|
<u:properties file="${maven.genapp.template.dir}/template.properties"/>
|
||||||
</u:available>
|
</u:available>
|
||||||
|
|
||||||
<!-- Ensure we have a project id, name, and package -->
|
<!-- Split variables manually, since jelly does not support this currently. -->
|
||||||
|
<u:tokenize var="maven.genapp.param.split" delim=",">${maven.genapp.param}</u:tokenize>
|
||||||
|
|
||||||
<j:set var="presetid" value="${maven.genapp.template.id}"/>
|
<j:forEach var="var" items="${maven.genapp.param.split}">
|
||||||
<j:if test="${empty(presetid)}">
|
<j:set var="varname">maven.genapp.template.${var}</j:set>
|
||||||
<i:ask question="${maven.genapp.prompt.id}" answer="maven.genapp.template.id" default="${maven.genapp.default.id}"/>
|
<j:set var="presetval" value="${context.findVariable(varname)}"/>
|
||||||
</j:if>
|
<j:if test="${empty(presetval)}">
|
||||||
|
<j:set var="varname">maven.genapp.default.${var}</j:set>
|
||||||
|
<j:set var="defaultval" value="${context.findVariable(varname)}"/>
|
||||||
|
<j:set var="varname">maven.genapp.prompt.${var}</j:set>
|
||||||
|
<j:set var="prompt" value="${context.findVariable(varname)}"/>
|
||||||
|
<j:if test="${empty(prompt)}">
|
||||||
|
<j:set var="maven.genapp.template.${var}" value="${defaultval}"/>
|
||||||
|
</j:if>
|
||||||
|
<j:if test="${!empty(prompt)}">
|
||||||
|
<i:ask question="${prompt}" answer="maven.genapp.template.${var}" default="${defaultval}"/>
|
||||||
|
</j:if>
|
||||||
|
</j:if>
|
||||||
|
<j:invoke method="toUpperCase" on="${var}" var="placeholder" />
|
||||||
|
<j:set var="varname">maven.genapp.template.${var}</j:set>
|
||||||
|
<j:set var="value" value="${context.findVariable(varname)}"/>
|
||||||
|
<filter token="${placeholder}" value="${value}"/>
|
||||||
|
</j:forEach>
|
||||||
|
|
||||||
<j:set var="presetname" value="${maven.genapp.template.name}"/>
|
<!-- Show used variables for template -->
|
||||||
<j:if test="${empty(presetname)}">
|
<ant:echo>Parameters used in template:</ant:echo>
|
||||||
<i:ask question="${maven.genapp.prompt.name}" answer="maven.genapp.template.name" default="${maven.genapp.default.name}"/>
|
<j:forEach var="var" items="${maven.genapp.param.split}">
|
||||||
</j:if>
|
<j:set var="varname">maven.genapp.template.${var}</j:set>
|
||||||
|
<j:set var="value" value="${context.findVariable(varname)}"/>
|
||||||
<j:set var="presetpackage" value="${maven.genapp.template.package}"/>
|
<j:invoke method="toUpperCase" on="${var}" var="placeholder" />
|
||||||
<j:if test="${empty(presetpackage)}">
|
<ant:echo>${varname} (${placeholder}):${value}</ant:echo>
|
||||||
<i:ask question="${maven.genapp.prompt.package}" answer="maven.genapp.template.package" default="${maven.genapp.default.package}"/>
|
</j:forEach>
|
||||||
</j:if>
|
|
||||||
|
|
||||||
<!-- Turn the specified package into a path -->
|
<!-- Turn the specified package into a path -->
|
||||||
<u:replace var="appPath" oldChar="." newChar="/" value="${maven.genapp.template.package}"/>
|
<u:replace var="appPath" oldChar="." newChar="/" value="${maven.genapp.template.package}"/>
|
||||||
|
|
||||||
<!-- We want to substitute in the id, name, and package name. -->
|
<!-- split variables manually, since jelly does not support this currently. -->
|
||||||
<filter token="ID" value="${maven.genapp.template.id}"/>
|
|
||||||
<filter token="NAME" value="${maven.genapp.template.name}"/>
|
|
||||||
<filter token="PACKAGE" value="${maven.genapp.template.package}"/>
|
|
||||||
|
|
||||||
<!-- split the list of dirs that need repackaged -->
|
|
||||||
<u:tokenize var="maven.genapp.repackage.split" delim=",">${maven.genapp.repackage}</u:tokenize>
|
<u:tokenize var="maven.genapp.repackage.split" delim=",">${maven.genapp.repackage}</u:tokenize>
|
||||||
|
<u:tokenize var="maven.genapp.filter.split" delim=",">${maven.genapp.filter}</u:tokenize>
|
||||||
|
|
||||||
<!-- copy resources that need repackaged, eg java files -->
|
<!-- copy resources that need repackaged, eg java files -->
|
||||||
<j:forEach var="res" items="${maven.genapp.repackage.split}">
|
<j:forEach var="res" items="${maven.genapp.repackage.split}">
|
||||||
@@ -104,7 +118,7 @@
|
|||||||
<!-- copy resources that just need filtered, eg project.xml -->
|
<!-- copy resources that just need filtered, eg project.xml -->
|
||||||
<ant:copy todir="${basedir}" filtering="true">
|
<ant:copy todir="${basedir}" filtering="true">
|
||||||
<ant:fileset dir="${maven.genapp.resources}">
|
<ant:fileset dir="${maven.genapp.resources}">
|
||||||
<j:forEach var="res" items="${maven.genapp.filter}">
|
<j:forEach var="res" items="${maven.genapp.filter.split}">
|
||||||
<include name="${res}"/>
|
<include name="${res}"/>
|
||||||
</j:forEach>
|
</j:forEach>
|
||||||
</ant:fileset>
|
</ant:fileset>
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
maven.genapp.resources=${plugin.resources}/default
|
|
||||||
|
|
||||||
maven.genapp.prompt.template=Enter a project template to use:
|
maven.genapp.prompt.template=Enter a project template to use:
|
||||||
|
|
||||||
maven.genapp.prompt.id=Please specify an id for your application:
|
|
||||||
maven.genapp.prompt.name=Please specify a name for your application:
|
|
||||||
maven.genapp.prompt.package=Please specify the package for your application:
|
|
||||||
|
|
||||||
maven.genapp.default.template=default
|
maven.genapp.default.template=default
|
||||||
|
|
||||||
|
maven.genapp.param=id,name,package,user
|
||||||
|
|
||||||
maven.genapp.default.id=app
|
maven.genapp.default.id=app
|
||||||
|
maven.genapp.prompt.id=Please specify an id for your application:
|
||||||
|
|
||||||
maven.genapp.default.name=Example Application
|
maven.genapp.default.name=Example Application
|
||||||
|
maven.genapp.prompt.name=Please specify a name for your application:
|
||||||
|
|
||||||
maven.genapp.default.package=example.app
|
maven.genapp.default.package=example.app
|
||||||
|
maven.genapp.prompt.package=Please specify the package for your application:
|
||||||
|
|
||||||
|
maven.genapp.default.user=${user.name}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
|
||||||
<project>
|
<project>
|
||||||
<extend>../project.xml</extend>
|
<extend>../project.xml</extend>
|
||||||
<pomVersion>3</pomVersion>
|
<pomVersion>3</pomVersion>
|
||||||
<id>maven-genapp-plugin</id>
|
<id>maven-genapp-plugin</id>
|
||||||
<name>Maven Genapp Plugin</name>
|
<name>Maven Genapp Plugin</name>
|
||||||
<currentVersion>2.0</currentVersion>
|
<currentVersion>2.1-SNAPSHOT</currentVersion>
|
||||||
<shortDescription>A collection of example projects showing how to use maven in different situations</shortDescription>
|
<shortDescription>A collection of example projects showing how to use maven in different situations</shortDescription>
|
||||||
<url>http://maven.apache.org/reference/plugins/genapp/</url>
|
<url>http://maven.apache.org/reference/plugins/genapp/</url>
|
||||||
<siteDirectory>/www/maven.apache.org/reference/plugins/genapp/</siteDirectory>
|
<siteDirectory>/www/maven.apache.org/reference/plugins/genapp/</siteDirectory>
|
||||||
@@ -39,6 +39,12 @@
|
|||||||
<name>Ryan Hoegg</name>
|
<name>Ryan Hoegg</name>
|
||||||
<email>rhoegg@isisnetworks.net</email>
|
<email>rhoegg@isisnetworks.net</email>
|
||||||
</contributor>
|
</contributor>
|
||||||
|
<contributor>
|
||||||
|
<name>Jörg Schaible</name>
|
||||||
|
<id>joehni</id>
|
||||||
|
<email>joerg.schaible@elsag-solutions.com</email>
|
||||||
|
<organization>Elsag-Solutions AG</organization>
|
||||||
|
</contributor>
|
||||||
</contributors>
|
</contributors>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -5,6 +5,37 @@
|
|||||||
<author email="dion@apache.org">dIon Gillard</author>
|
<author email="dion@apache.org">dIon Gillard</author>
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
|
<release version="2.1" date="SNAPSHOT">
|
||||||
|
<action dev="joehni" type="add">
|
||||||
|
Support of configuration files in the template starting
|
||||||
|
with a dot (e.g. .cvsignore).
|
||||||
|
</action>
|
||||||
|
<action dev="joehni" type="fix">
|
||||||
|
Fix usage of explicit template provided with the property
|
||||||
|
maven.genapp.template.dir. Suppress question for template
|
||||||
|
name, since it is implicit.
|
||||||
|
</action>
|
||||||
|
<action dev="joehni" type="add">
|
||||||
|
Add property maven.genapp.template.repository to support
|
||||||
|
a user-defined location for own templates. This allows a
|
||||||
|
CVS-based template management for a company.
|
||||||
|
</action>
|
||||||
|
<action dev="joehni" type="fix">
|
||||||
|
Fix usage of a comma-separated string as value for property
|
||||||
|
maven.genapp.filter to define multiple files.
|
||||||
|
</action>
|
||||||
|
<action dev="joehni" type="add">
|
||||||
|
Add property maven.genapp.template.user to support the
|
||||||
|
user's account name in the filter with @USER@. The default
|
||||||
|
value is the system property user.name.
|
||||||
|
</action>
|
||||||
|
<action dev="joehni" type="add">
|
||||||
|
Support user-defined parameters for filtering.
|
||||||
|
</action>
|
||||||
|
<action dev="joehni" type="update">
|
||||||
|
Update and improve documentation for properties.
|
||||||
|
</action>
|
||||||
|
</release>
|
||||||
<release version="2.0" date="2003-09-29">
|
<release version="2.0" date="2003-09-29">
|
||||||
<action dev="evenisse" type="update">
|
<action dev="evenisse" type="update">
|
||||||
Add a taglib for use the generation in other plugins.
|
Add a taglib for use the generation in other plugins.
|
||||||
|
|||||||
@@ -7,68 +7,133 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<section name="Application Generation Settings">
|
<section name="General Application Generation Settings">
|
||||||
<div>Some of these properties are prompted for when the plugin runs, if not already specified.</div>
|
<p>
|
||||||
|
In addition to the default property files read while processing a
|
||||||
|
plugin, genapp uses on top a template specific property file. This
|
||||||
|
will be read after the plugin has found the template specified by
|
||||||
|
the user. Since all the property files share the same namespace
|
||||||
|
you can define any of the properties below anywhere. But typically
|
||||||
|
you will have properties specific for each template.
|
||||||
|
</p>
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Property</th><th>Optional?</th><th>Description</th><th>Default</th></tr>
|
<tr><th>Property</th><th>Description</th><th>Default</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td>maven.genapp.filter</td>
|
||||||
|
<td>
|
||||||
|
Specifies the files (comma-separated list) that have to be copied
|
||||||
|
into the new project after they have been filtered. The filtering
|
||||||
|
replaces placeholders with properties (see below).
|
||||||
|
</td>
|
||||||
|
<td>java,test</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>maven.genapp.param</td>
|
||||||
|
<td>
|
||||||
|
Specifies the filter parameters (comma-separated list). See
|
||||||
|
filtering rules below and a descitpion of the default parameters.
|
||||||
|
</td>
|
||||||
|
<td>id,name,package,user</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>maven.genapp.repackage</td>
|
||||||
|
<td>
|
||||||
|
Specifies the directories (comma-separated list) with files to
|
||||||
|
build a Java package. Genapp will copy the files into the new
|
||||||
|
project according the path rules for packages. The package is
|
||||||
|
defined with the property maven.genapp.template.package. The
|
||||||
|
files are not only copied, but also filtered.
|
||||||
|
</td>
|
||||||
|
<td>project.xml</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>maven.genapp.template</td>
|
<td>maven.genapp.template</td>
|
||||||
<td>Yes</td>
|
|
||||||
<td>
|
<td>
|
||||||
Specifies the template to use when generating the application.
|
Specifies the template to use when generating the application.
|
||||||
If this property is not defined, the user will be prompted.
|
If this property is not defined, the user will be prompted with
|
||||||
</td>
|
the default value from property maven.genapp.default.template.
|
||||||
<td>
|
|
||||||
default
|
|
||||||
</td>
|
</td>
|
||||||
|
<td>default</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>maven.genapp.template.dir</td>
|
<td>maven.genapp.template.dir</td>
|
||||||
<td>No</td>
|
|
||||||
<td>
|
<td>
|
||||||
Specifies the template directory to use when generating the application.
|
Specifies the template directory to use when generating the application.
|
||||||
Usually set based on the maven.genapp.template chosen. Users can override
|
Usually set based on the maven.template.repository and maven.genapp.template
|
||||||
this property and maven.genapp.template (which will then go unused)
|
chosen. Users can override this property in order to use a custom template
|
||||||
in order to use a custom template directory. This can be useful for other
|
directory. meven.template.repository and maven.genapp.template will then go
|
||||||
plugins.
|
unused. This can be useful for other plugins.
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Specified by the template.
|
|
||||||
</td>
|
</td>
|
||||||
|
<td>n/a</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>maven.genapp.template.repository</td>
|
||||||
|
<td>
|
||||||
|
Specifies a directory that has additional templates. If this property
|
||||||
|
is not defined, the template will be searched in the local Maven directory
|
||||||
|
or in the resources of the plugin itself.
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
${maven.home.local}/template
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
<section name="Application Generation Filter Settings">
|
||||||
|
<p>
|
||||||
|
Generating a project from a template a lot of parameters can be useful for the
|
||||||
|
template depending on the organisation using them. Genapp has some predefined
|
||||||
|
parameters described in the table below. Each parameter makes usage of some
|
||||||
|
properties following a naming scheme and can be declared interactive i.e. the
|
||||||
|
user generating an application from a template will be asked for the parameter's
|
||||||
|
value. The property maven.genapp.param declares all available parameters for
|
||||||
|
the filtering. During the project generation the filter uses the properties
|
||||||
|
that follow the naming scheme maven.genapp.template.<param>. It is always
|
||||||
|
possible to overwrite these values. The default value is always defined by a
|
||||||
|
property named maven.genapp.default.<param>. If the value should be
|
||||||
|
enetered interactive, you can define the prompt with a property
|
||||||
|
maven.genapp.prompt.<param>. The filter itself is used copying the files
|
||||||
|
defined by maven.genapp.repackage and maven.genapp.filter and will replace any
|
||||||
|
occurrence of @<PARAM>@ in the files with the value of
|
||||||
|
maven.genapp.template.<param>.
|
||||||
|
</p>
|
||||||
|
<table>
|
||||||
|
<tr><th>Property</th><th>Description</th><th>Default</th><th>Prompted</th></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>maven.genapp.template.id</td>
|
<td>maven.genapp.template.id</td>
|
||||||
<td>Yes</td>
|
|
||||||
<td>
|
<td>
|
||||||
Specifies the id of the application to be generated
|
Specifies the id of the application to be generated
|
||||||
If this property is not defined, the user will be prompted.
|
If this property is not defined, the user will be prompted.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>app</td>
|
||||||
app
|
<td>Yes</td>
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>maven.genapp.template.name</td>
|
<td>maven.genapp.template.name</td>
|
||||||
<td>Yes</td>
|
|
||||||
<td>
|
<td>
|
||||||
Specifies the name of the application to be generated
|
Specifies the name of the application to be generated
|
||||||
If this property is not defined, the user will be prompted.
|
If this property is not defined, the user will be prompted.
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>Example Application</td>
|
||||||
Example Application
|
<td>Yes</td>
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>maven.genapp.template.package</td>
|
<td>maven.genapp.template.package</td>
|
||||||
<td>Yes</td>
|
|
||||||
<td>
|
<td>
|
||||||
Specifies the name of the Java package that code will be
|
Specifies the name of the Java package that code will be
|
||||||
generated for.
|
generated for.
|
||||||
If this property is not defined, the user will be prompted.
|
If this property is not defined, the user will be prompted.
|
||||||
</td>
|
</td>
|
||||||
|
<td>example.app</td>
|
||||||
|
<td>Yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>maven.genapp.template.user</td>
|
||||||
<td>
|
<td>
|
||||||
example.app
|
Specifies the user's account name.
|
||||||
</td>
|
</td>
|
||||||
|
<td>${user.name}</td>
|
||||||
|
<td>No</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user