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:
parent
aca688b63c
commit
ddd35b494d
@ -25,18 +25,20 @@
|
||||
<i:ask question="${maven.genapp.prompt.template}" answer="template" default="${maven.genapp.default.template}"/>
|
||||
</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 -->
|
||||
<u:available file="${user.home}/.maven/template/${template}">
|
||||
<j:set var="maven.genapp.template.dir" value="${user.home}/.maven/template/${template}"/>
|
||||
</u:available>
|
||||
|
||||
<j:set var="currenttemplatedir" value="${maven.genapp.template.dir}"/>
|
||||
<j:if test="${empty(currenttemplatedir)}">
|
||||
<!-- The template was not found in user.home, check in the plugin resources -->
|
||||
<u:available file="${plugin.resources}/${template}">
|
||||
<j:set var="maven.genapp.template.dir" value="${plugin.resources}/${template}"/>
|
||||
</u:available>
|
||||
</j:if>
|
||||
<!-- If template is in a given template repository, use it -->
|
||||
<u:available file="${maven.genapp.template.repository}/${template}">
|
||||
<j:set var="maven.genapp.template.dir" value="${maven.genapp.template.repository}/${template}"/>
|
||||
</u:available>
|
||||
</j:if>
|
||||
|
||||
<j:set var="currenttemplatedir" value="${maven.genapp.template.dir}"/>
|
||||
@ -64,34 +66,46 @@
|
||||
<u:available file="${maven.genapp.template.dir}/template.properties">
|
||||
<u:properties file="${maven.genapp.template.dir}/template.properties"/>
|
||||
</u:available>
|
||||
|
||||
<!-- Ensure we have a project id, name, and package -->
|
||||
|
||||
<j:set var="presetid" value="${maven.genapp.template.id}"/>
|
||||
<j:if test="${empty(presetid)}">
|
||||
<i:ask question="${maven.genapp.prompt.id}" answer="maven.genapp.template.id" default="${maven.genapp.default.id}"/>
|
||||
</j:if>
|
||||
|
||||
<j:set var="presetname" value="${maven.genapp.template.name}"/>
|
||||
<j:if test="${empty(presetname)}">
|
||||
<i:ask question="${maven.genapp.prompt.name}" answer="maven.genapp.template.name" default="${maven.genapp.default.name}"/>
|
||||
</j:if>
|
||||
|
||||
<j:set var="presetpackage" value="${maven.genapp.template.package}"/>
|
||||
<j:if test="${empty(presetpackage)}">
|
||||
<i:ask question="${maven.genapp.prompt.package}" answer="maven.genapp.template.package" default="${maven.genapp.default.package}"/>
|
||||
</j:if>
|
||||
|
||||
|
||||
<!-- Split variables manually, since jelly does not support this currently. -->
|
||||
<u:tokenize var="maven.genapp.param.split" delim=",">${maven.genapp.param}</u:tokenize>
|
||||
|
||||
<j:forEach var="var" items="${maven.genapp.param.split}">
|
||||
<j:set var="varname">maven.genapp.template.${var}</j:set>
|
||||
<j:set var="presetval" value="${context.findVariable(varname)}"/>
|
||||
<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>
|
||||
|
||||
<!-- Show used variables for template -->
|
||||
<ant:echo>Parameters used in template:</ant:echo>
|
||||
<j:forEach var="var" items="${maven.genapp.param.split}">
|
||||
<j:set var="varname">maven.genapp.template.${var}</j:set>
|
||||
<j:set var="value" value="${context.findVariable(varname)}"/>
|
||||
<j:invoke method="toUpperCase" on="${var}" var="placeholder" />
|
||||
<ant:echo>${varname} (${placeholder}):${value}</ant:echo>
|
||||
</j:forEach>
|
||||
|
||||
<!-- Turn the specified package into a path -->
|
||||
<u:replace var="appPath" oldChar="." newChar="/" value="${maven.genapp.template.package}"/>
|
||||
|
||||
<!-- We want to substitute in the id, name, and package name. -->
|
||||
<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 -->
|
||||
|
||||
<!-- split variables manually, since jelly does not support this currently. -->
|
||||
<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 -->
|
||||
<j:forEach var="res" items="${maven.genapp.repackage.split}">
|
||||
@ -104,7 +118,7 @@
|
||||
<!-- copy resources that just need filtered, eg project.xml -->
|
||||
<ant:copy todir="${basedir}" filtering="true">
|
||||
<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}"/>
|
||||
</j:forEach>
|
||||
</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.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.param=id,name,package,user
|
||||
|
||||
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.package=example.app
|
||||
maven.genapp.prompt.name=Please specify a name for your application:
|
||||
|
||||
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>
|
||||
<extend>../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-genapp-plugin</id>
|
||||
<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>
|
||||
<url>http://maven.apache.org/reference/plugins/genapp/</url>
|
||||
<siteDirectory>/www/maven.apache.org/reference/plugins/genapp/</siteDirectory>
|
||||
@ -39,6 +39,12 @@
|
||||
<name>Ryan Hoegg</name>
|
||||
<email>rhoegg@isisnetworks.net</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jörg Schaible</name>
|
||||
<id>joehni</id>
|
||||
<email>joerg.schaible@elsag-solutions.com</email>
|
||||
<organization>Elsag-Solutions AG</organization>
|
||||
</contributor>
|
||||
</contributors>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -5,6 +5,37 @@
|
||||
<author email="dion@apache.org">dIon Gillard</author>
|
||||
</properties>
|
||||
<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">
|
||||
<action dev="evenisse" type="update">
|
||||
Add a taglib for use the generation in other plugins.
|
||||
|
||||
@ -7,68 +7,133 @@
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Application Generation Settings">
|
||||
<div>Some of these properties are prompted for when the plugin runs, if not already specified.</div>
|
||||
<section name="General Application Generation Settings">
|
||||
<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>
|
||||
<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>
|
||||
<td>maven.genapp.template</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies the template to use when generating the application.
|
||||
If this property is not defined, the user will be prompted.
|
||||
</td>
|
||||
<td>
|
||||
default
|
||||
If this property is not defined, the user will be prompted with
|
||||
the default value from property maven.genapp.default.template.
|
||||
</td>
|
||||
<td>default</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.genapp.template.dir</td>
|
||||
<td>No</td>
|
||||
<td>
|
||||
Specifies the template directory to use when generating the application.
|
||||
Usually set based on the maven.genapp.template chosen. Users can override
|
||||
this property and maven.genapp.template (which will then go unused)
|
||||
in order to use a custom template directory. This can be useful for other
|
||||
plugins.
|
||||
</td>
|
||||
<td>
|
||||
Specified by the template.
|
||||
Usually set based on the maven.template.repository and maven.genapp.template
|
||||
chosen. Users can override this property in order to use a custom template
|
||||
directory. meven.template.repository and maven.genapp.template will then go
|
||||
unused. This can be useful for other plugins.
|
||||
</td>
|
||||
<td>n/a</td>
|
||||
</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>
|
||||
<td>maven.genapp.template.id</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies the id of the application to be generated
|
||||
If this property is not defined, the user will be prompted.
|
||||
</td>
|
||||
<td>
|
||||
app
|
||||
</td>
|
||||
<td>app</td>
|
||||
<td>Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.genapp.template.name</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies the name of the application to be generated
|
||||
If this property is not defined, the user will be prompted.
|
||||
</td>
|
||||
<td>
|
||||
Example Application
|
||||
</td>
|
||||
<td>Example Application</td>
|
||||
<td>Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.genapp.template.package</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Specifies the name of the Java package that code will be
|
||||
generated for.
|
||||
If this property is not defined, the user will be prompted.
|
||||
</td>
|
||||
<td>example.app</td>
|
||||
<td>Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.genapp.template.user</td>
|
||||
<td>
|
||||
example.app
|
||||
Specifies the user's account name.
|
||||
</td>
|
||||
<td>${user.name}</td>
|
||||
<td>No</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user