From ddd35b494d3fa00a8a42c1b811e1af0d23dd82ce Mon Sep 17 00:00:00 2001 From: jvanzyl Date: Sun, 30 Nov 2003 21:26:26 +0000 Subject: [PATCH] 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 --- genapp/plugin.jelly | 80 ++++++++++++++---------- genapp/plugin.properties | 18 +++--- genapp/project.xml | 10 ++- genapp/xdocs/changes.xml | 31 ++++++++++ genapp/xdocs/properties.xml | 117 ++++++++++++++++++++++++++++-------- 5 files changed, 187 insertions(+), 69 deletions(-) diff --git a/genapp/plugin.jelly b/genapp/plugin.jelly index dbbf132a..7d467839 100644 --- a/genapp/plugin.jelly +++ b/genapp/plugin.jelly @@ -25,18 +25,20 @@ + + + + + - - - - - - - + + + + @@ -64,34 +66,46 @@ - - - - - - - - - - - - - - - - - - + + + ${maven.genapp.param} + + + maven.genapp.template.${var} + + + maven.genapp.default.${var} + + maven.genapp.prompt.${var} + + + + + + + + + + maven.genapp.template.${var} + + + + + + Parameters used in template: + + maven.genapp.template.${var} + + + ${varname} (${placeholder}):${value} + + - - - - - - - + + ${maven.genapp.repackage} + ${maven.genapp.filter} @@ -104,7 +118,7 @@ - + diff --git a/genapp/plugin.properties b/genapp/plugin.properties index c9415205..5b7818e0 100644 --- a/genapp/plugin.properties +++ b/genapp/plugin.properties @@ -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 \ No newline at end of file +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} diff --git a/genapp/project.xml b/genapp/project.xml index 08477779..ffd0b259 100644 --- a/genapp/project.xml +++ b/genapp/project.xml @@ -1,11 +1,11 @@ - + ../project.xml 3 maven-genapp-plugin Maven Genapp Plugin - 2.0 + 2.1-SNAPSHOT A collection of example projects showing how to use maven in different situations http://maven.apache.org/reference/plugins/genapp/ /www/maven.apache.org/reference/plugins/genapp/ @@ -39,6 +39,12 @@ Ryan Hoegg rhoegg@isisnetworks.net + + Jörg Schaible + joehni + joerg.schaible@elsag-solutions.com + Elsag-Solutions AG + diff --git a/genapp/xdocs/changes.xml b/genapp/xdocs/changes.xml index fbcd4389..5e5fd030 100644 --- a/genapp/xdocs/changes.xml +++ b/genapp/xdocs/changes.xml @@ -5,6 +5,37 @@ dIon Gillard + + + Support of configuration files in the template starting + with a dot (e.g. .cvsignore). + + + Fix usage of explicit template provided with the property + maven.genapp.template.dir. Suppress question for template + name, since it is implicit. + + + 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. + + + Fix usage of a comma-separated string as value for property + maven.genapp.filter to define multiple files. + + + 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. + + + Support user-defined parameters for filtering. + + + Update and improve documentation for properties. + + Add a taglib for use the generation in other plugins. diff --git a/genapp/xdocs/properties.xml b/genapp/xdocs/properties.xml index 986cae78..bd61895d 100644 --- a/genapp/xdocs/properties.xml +++ b/genapp/xdocs/properties.xml @@ -7,68 +7,133 @@ -
-
Some of these properties are prompted for when the plugin runs, if not already specified.
+
+

+ 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. +

- + + + + + + + + + + + + + + + + - - + - - + + + + + + +
PropertyOptional?DescriptionDefault
PropertyDescriptionDefault
maven.genapp.filter + 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). + java,test
maven.genapp.param + Specifies the filter parameters (comma-separated list). See + filtering rules below and a descitpion of the default parameters. + id,name,package,user
maven.genapp.repackage + 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. + project.xml
maven.genapp.templateYes Specifies the template to use when generating the application. - If this property is not defined, the user will be prompted. - - default + If this property is not defined, the user will be prompted with + the default value from property maven.genapp.default.template. default
maven.genapp.template.dirNo 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. - - 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. n/a
maven.genapp.template.repository + 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. + + ${maven.home.local}/template +
+
+
+

+ 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>. +

+ + - - + + - - + + - + + + + + + +
PropertyDescriptionDefaultPrompted
maven.genapp.template.idYes Specifies the id of the application to be generated If this property is not defined, the user will be prompted. - app - appYes
maven.genapp.template.nameYes Specifies the name of the application to be generated If this property is not defined, the user will be prompted. - Example Application - Example ApplicationYes
maven.genapp.template.packageYes Specifies the name of the Java package that code will be generated for. If this property is not defined, the user will be prompted. example.appYes
maven.genapp.template.user - example.app + Specifies the user's account name. ${user.name}No