tbroyer / gwt-maven-archetypes

Apache License 2.0
152 stars 39 forks source link

${module.toLowerCase()} in generated files with default properties #14

Closed a14n closed 12 years ago

a14n commented 12 years ago

I used the default values of properties when executing :

mvn archetype:generate \
   -DarchetypeGroupId=net.ltgt.gwt.archetypes \
   -DarchetypeArtifactId=modular-requestfactory  \
   -DarchetypeVersion=1.0-SNAPSHOT

e.g. :

Confirm properties configuration:
groupId: a14n.test
artifactId: rf
version: 1.0-SNAPSHOT
package: a14n.test.rf
gwt-maven-plugin-version: 2.4.0
gwt-version: 2.4.0
jetty-maven-plugin-version: 8.1.3.v20120416
module: App
module-short-name: ${module.toLowerCase()}

But ${module.toLowerCase()} is not replaced by the good value and is used directly. Thus for instance, I find in client/src/main/java/a14n/test/rf/App.gwt.xml the following content :

[...]
<module rename-to="${module.toLowerCase()}">
[...]
tbroyer commented 12 years ago

Works for me. Which version of Maven are you using? I'm using 3.0.3, and maven-archetype-plugin:2.2:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository missing. Using the one from [net.ltgt.gwt.archetypes:modular-requestfactory:1.0-SNAPSHOT] found in catalog local
Define value for property 'groupId': : a14n.test
Define value for property 'artifactId': : rf
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  a14n.test: : a14n.test.rf
[INFO] Using property: gwt-maven-plugin-version = 2.4.0
[INFO] Using property: gwt-version = 2.4.0
[INFO] Using property: jetty-maven-plugin-version = 8.1.3.v20120416
[INFO] Using property: module = App
Define value for property 'module-short-name':  ${module.toLowerCase()}: : 
Confirm properties configuration:
groupId: a14n.test
artifactId: rf
version: 1.0-SNAPSHOT
package: a14n.test.rf
gwt-maven-plugin-version: 2.4.0
gwt-version: 2.4.0
jetty-maven-plugin-version: 8.1.3.v20120416
module: App
module-short-name: ${module.toLowerCase()}
 Y: : 
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: modular-requestfactory:1.0-SNAPSHOT
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: a14n.test
[INFO] Parameter: artifactId, Value: rf
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: a14n.test.rf
[INFO] Parameter: packageInPathFormat, Value: a14n/test/rf
[INFO] Parameter: gwt-maven-plugin-version, Value: 2.4.0
[INFO] Parameter: module, Value: App
27 mai 2012 02:15:50 org.apache.velocity.runtime.log.JdkLogChute log
INFO: FileResourceLoader : adding path '.'
[INFO] Parameter: module-short-name, Value: app
[INFO] Parameter: groupId, Value: a14n.test
[INFO] Parameter: gwt-version, Value: 2.4.0
[INFO] Parameter: jetty-maven-plugin-version, Value: 8.1.3.v20120416
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: a14n.test.rf
[INFO] Parameter: artifactId, Value: rf
[INFO] Parent element not overwritten in /home/tbr/Projets/gwt/gwt-maven-archetypes/test/rf/client/pom.xml
[INFO] Parent element not overwritten in /home/tbr/Projets/gwt/gwt-maven-archetypes/test/rf/shared/pom.xml
[INFO] Parent element not overwritten in /home/tbr/Projets/gwt/gwt-maven-archetypes/test/rf/server/pom.xml
[INFO] project created from Archetype in dir: /home/tbr/Projets/gwt/gwt-maven-archetypes/test/rf
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.875s
[INFO] Finished at: Sun May 27 02:15:50 CEST 2012
[INFO] Final Memory: 9M/117M
[INFO] ------------------------------------------------------------------------
a14n commented 12 years ago

I'm using Maven 2.2.1 and "maven -X" shows that version 2.0 of maven-archetype-plugin is used.

[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-archetype-plugin:2.0:generate' -->

I wanted to test with version 2.2 of maven-archetype-plugin but I haven't found how (and if it is possible) to force maven-archetype-plugin version.

tbroyer commented 12 years ago

AFAICT, mvn org.apache.maven.plugins:maven-archetype-plugin:2.2:generate instead of mvn archetype:generate.

a14n commented 12 years ago

Shame on me, I didn't remember this way to launch plugin.

Using maven-archetype-plugin:2.2, generation works as expected and ${module.toLowerCase()} is well replaced by rf in my above test.

I also try with maven-archetype-plugin:2.1 but it don't work like with 2.0.

tbroyer commented 12 years ago

OK, will add a note in the README.