From 846c5cf87e0dc29978d2f76a6793f54593541269 Mon Sep 17 00:00:00 2001 From: evenisse Date: Mon, 25 Aug 2003 09:43:14 +0000 Subject: [PATCH] Add template support in genapp plugin. Thanks to Ryan Hoegg (Maven-426). We can add now other template like ejb, webapps... git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113874 13f79535-47bb-0310-9956-ffa450edef68 --- genapp/plugin.jelly | 168 +++++++++++++----- genapp/plugin.properties | 13 ++ genapp/project.properties | 5 + genapp/project.xml | 66 ++++--- .../template-resources}/project.properties | 0 .../template-resources}/project.xml | 18 +- .../src/conf/app.properties | 0 .../template-resources}/src/java/App.java | 0 .../src/test/AbstractTestCase.java | 0 .../template-resources}/src/test/AppTest.java | 0 .../src/test/NaughtyTest.java | 0 .../default/template.properties | 4 + genapp/xdocs/changes.xml | 21 +++ genapp/xdocs/faq.fml | 15 ++ genapp/xdocs/navigation.xml | 1 + genapp/xdocs/properties.xml | 54 +++++- 16 files changed, 284 insertions(+), 81 deletions(-) create mode 100644 genapp/plugin.properties create mode 100644 genapp/project.properties rename genapp/src/plugin-resources/{src/pom => default/template-resources}/project.properties (100%) rename genapp/src/plugin-resources/{src/pom => default/template-resources}/project.xml (88%) rename genapp/src/plugin-resources/{ => default/template-resources}/src/conf/app.properties (100%) rename genapp/src/plugin-resources/{ => default/template-resources}/src/java/App.java (100%) rename genapp/src/plugin-resources/{ => default/template-resources}/src/test/AbstractTestCase.java (100%) rename genapp/src/plugin-resources/{ => default/template-resources}/src/test/AppTest.java (100%) rename genapp/src/plugin-resources/{ => default/template-resources}/src/test/NaughtyTest.java (100%) create mode 100644 genapp/src/plugin-resources/default/template.properties create mode 100644 genapp/xdocs/faq.fml diff --git a/genapp/plugin.jelly b/genapp/plugin.jelly index 51c5818d..89b9811e 100644 --- a/genapp/plugin.jelly +++ b/genapp/plugin.jelly @@ -1,52 +1,138 @@ + xmlns:i="jelly:interaction" + xmlns:ant="jelly:ant" + xmlns:define="jelly:define" + xmlns:u="jelly:util" + xmlns:genapp="genapp"> + + + + + + + + + + + + + + + + + + + + + + + + + + + Unable to locate a template named ${template} + + + + + + + + + + + + + + Found a template in ${maven.genapp.template.dir}, but it was broken. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${maven.genapp.repackage} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Use template.jelly file present in ${maven.genapp.template.dir}. + + + + + - - - - - You must specifiy a package for your application! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + description="Generate Application based on a template"> + diff --git a/genapp/plugin.properties b/genapp/plugin.properties new file mode 100644 index 00000000..c9415205 --- /dev/null +++ b/genapp/plugin.properties @@ -0,0 +1,13 @@ +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.default.id=app +maven.genapp.default.name=Example Application +maven.genapp.default.package=example.app \ No newline at end of file diff --git a/genapp/project.properties b/genapp/project.properties new file mode 100644 index 00000000..8e59598a --- /dev/null +++ b/genapp/project.properties @@ -0,0 +1,5 @@ +# ------------------------------------------------------------------- +# P R O J E C T P R O P E R T I E S +# ------------------------------------------------------------------- +maven.license.licenseFile=${basedir}/../../../LICENSE.txt + diff --git a/genapp/project.xml b/genapp/project.xml index 5c3a396a..e98bd93e 100644 --- a/genapp/project.xml +++ b/genapp/project.xml @@ -2,47 +2,63 @@ ${basedir}/../project.xml - - 3 - - maven-genapp-plugin - - Maven Genapp Plugin - - - 1.0 - - + 2.0-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/ scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/genapp/ http://cvs.apache.org/viewcvs/maven/src/plugins-build/genapp/ - - - - - dIon Gillard - dion - dion@multitask.com.au - Multitask Consulting + Jason van Zyl + jvanzyl + jason@zenplex.com + Zenplex + + Architect + Release Manager + + + + Emmanuel Venisse + evenisse + evenisse@ifrance.com + Fi System Java Developer - - + + + + Ryan Hoegg + rhoegg@isisnetworks.net + + - + + + commons-jelly + commons-jelly-tags-interaction + 20030211.143817 + + root.maven + + + + + + maven-changes-plugin + maven-changelog-plugin + maven-file-activity-plugin + maven-developer-activity-plugin + maven-license-plugin + maven-faq-plugin + diff --git a/genapp/src/plugin-resources/src/pom/project.properties b/genapp/src/plugin-resources/default/template-resources/project.properties similarity index 100% rename from genapp/src/plugin-resources/src/pom/project.properties rename to genapp/src/plugin-resources/default/template-resources/project.properties diff --git a/genapp/src/plugin-resources/src/pom/project.xml b/genapp/src/plugin-resources/default/template-resources/project.xml similarity index 88% rename from genapp/src/plugin-resources/src/pom/project.xml rename to genapp/src/plugin-resources/default/template-resources/project.xml index 7687c413..81dfbfb9 100644 --- a/genapp/src/plugin-resources/src/pom/project.xml +++ b/genapp/src/plugin-resources/default/template-resources/project.xml @@ -5,13 +5,13 @@ 3 - app + @ID@ - Maven example projects + @NAME@ + 1.1, 1.2, 2.0-SNAPSHOT --> 1.0 @@ -53,17 +53,7 @@ - - - Jason van Zyl - jvanzyl - jason@zenplex.com - Zenplex - - Java Developer - - - + diff --git a/genapp/src/plugin-resources/src/conf/app.properties b/genapp/src/plugin-resources/default/template-resources/src/conf/app.properties similarity index 100% rename from genapp/src/plugin-resources/src/conf/app.properties rename to genapp/src/plugin-resources/default/template-resources/src/conf/app.properties diff --git a/genapp/src/plugin-resources/src/java/App.java b/genapp/src/plugin-resources/default/template-resources/src/java/App.java similarity index 100% rename from genapp/src/plugin-resources/src/java/App.java rename to genapp/src/plugin-resources/default/template-resources/src/java/App.java diff --git a/genapp/src/plugin-resources/src/test/AbstractTestCase.java b/genapp/src/plugin-resources/default/template-resources/src/test/AbstractTestCase.java similarity index 100% rename from genapp/src/plugin-resources/src/test/AbstractTestCase.java rename to genapp/src/plugin-resources/default/template-resources/src/test/AbstractTestCase.java diff --git a/genapp/src/plugin-resources/src/test/AppTest.java b/genapp/src/plugin-resources/default/template-resources/src/test/AppTest.java similarity index 100% rename from genapp/src/plugin-resources/src/test/AppTest.java rename to genapp/src/plugin-resources/default/template-resources/src/test/AppTest.java diff --git a/genapp/src/plugin-resources/src/test/NaughtyTest.java b/genapp/src/plugin-resources/default/template-resources/src/test/NaughtyTest.java similarity index 100% rename from genapp/src/plugin-resources/src/test/NaughtyTest.java rename to genapp/src/plugin-resources/default/template-resources/src/test/NaughtyTest.java diff --git a/genapp/src/plugin-resources/default/template.properties b/genapp/src/plugin-resources/default/template.properties new file mode 100644 index 00000000..29c1c265 --- /dev/null +++ b/genapp/src/plugin-resources/default/template.properties @@ -0,0 +1,4 @@ +maven.genapp.repackage=java,test +maven.genapp.filter=project.xml + +maven.genapp.default.package=default.example.app diff --git a/genapp/xdocs/changes.xml b/genapp/xdocs/changes.xml index c764ef8b..0f62da58 100644 --- a/genapp/xdocs/changes.xml +++ b/genapp/xdocs/changes.xml @@ -5,6 +5,27 @@ dIon Gillard + + + Add a taglib for use the generation in other plugins. + + + Changed property names to maven.genapp.* syntax + + + Prompt the user for project id, name, and package. + Don't require command line package specification. + This change added a dependency on jelly:interaction. + + + Added initial application template capability. + Original idea and implementation was submitted + by Brian Ewins in jira(MAVEN-426). Modified his jelly to + use template directories inside plugin-resources. + Added capability for templates to define their + own properties. + + Initial plugin created diff --git a/genapp/xdocs/faq.fml b/genapp/xdocs/faq.fml new file mode 100644 index 00000000..bceac92a --- /dev/null +++ b/genapp/xdocs/faq.fml @@ -0,0 +1,15 @@ + + + + + General + + + How to add a specific script for my template? + + For add a specific script to your template, you should create a template.jelly + file at your template root directory. + + + + \ No newline at end of file diff --git a/genapp/xdocs/navigation.xml b/genapp/xdocs/navigation.xml index dad7dbcb..8785ce0f 100644 --- a/genapp/xdocs/navigation.xml +++ b/genapp/xdocs/navigation.xml @@ -10,6 +10,7 @@ + diff --git a/genapp/xdocs/properties.xml b/genapp/xdocs/properties.xml index a9b96147..986cae78 100644 --- a/genapp/xdocs/properties.xml +++ b/genapp/xdocs/properties.xml @@ -8,14 +8,66 @@
+
Some of these properties are prompted for when the plugin runs, if not already specified.
- + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyOptional?DescriptionDefault
packagemaven.genapp.templateYes + Specifies the template to use when generating the application. + If this property is not defined, the user will be prompted. + + default +
maven.genapp.template.dir No + 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. +
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 +
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 +
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.app