Changes for page Custom Project Templates
Last modified by Bastian Triller on 2009/04/11 21:03
From version 45.1
edited by David Avendasora
on 2009/04/11 21:01
on 2009/04/11 21:01
Change comment:
There is no comment for this version
To version 46.1
edited by David Avendasora
on 2009/04/11 20:37
on 2009/04/11 20:37
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -105,9 +105,9 @@ 105 105 106 106 = Using Template Inputs = 107 107 108 -So now that you have template input sdefined, you needto be able to use them. The name used in the "name" attribute of your inputnode will be the name of the variableyou can usein yourtemplate'sfiles. For instance, in the example above, the Velocity variable "servletDeployment" will be bound to the boolean value corresponding to the user's selection, and can be used just like any other velocity variable. The Apache project provides a [[Velocity reference guide>>http://velocity.apache.org/engine/devel/vtl-reference-guide.html]].108 +So now that you have template input defined, you will want to be able to use them. The name use used in the "name" attribute of your input declaration will be the name of the variable in your Velocity context. For instance, in the example above, the Velocity variable "linkToWonderProjects" will be bound to the boolean value corresponding to the user's selection, and can be used just like any other velocity variable. The Apache project provides a [[Velocity reference guide>>http://velocity.apache.org/engine/devel/vtl-reference-guide.html]]. 109 109 110 -As an example, the .classpath file can be modified to automatically add a link to the JavaWOJSPServlet.framework if the user selects "Deploy to Servlet Container" in the the wizard. 110 +As an example, the .classpath file can be modified to automatically add a link to the JavaWOJSPServlet.framework if the user is prompted and selects "Deploy to Servlet Container" in the the new project wizard. 111 111 112 112 {{code value="xml"}} 113 113 ... ... @@ -129,19 +129,6 @@ 129 129 130 130 {{/code}} 131 131 132 -In addition to variables inside of Velocity templates, you can also use template variables in folder and file names. However, because $ is not allowed on some filesystems, we instead surround the variable names with "" (for instance $someVariable would be "someVariable"in the filename or path). As an example, the templateabovehas an input named "basePackage" (of type Package) which,as we learned above,createstwovariables:"basePackage" and "basePackage//folder".Sincewearegoingto beusingthisvariable toname(anddefinethepath)ofafolderinthe Sourcesdirectory, we needto usethe alternateversionofthevariable. Createanew folderin the Sourcesdirectoryof theproject templaetandinsteadof using "{{basePackage_folder}}{{/basePackage_folder}}" asthe file name, we must use "basePackage//folder".132 +In addition to variables inside of Velocity templates, you can also use template variables in folder and file names. However, because $ is not allowed on some filesystems, we instead surround the variable names with "" (for instance $someVariable would be someVariable in the filename or path). As an example, the Wonder Application template has an input named "basePackage" (of type Package), which creates a magic variable named "basePackage//folder" (where the dots are turned into slashes), and the Source folder on the filesystem is named "Wonder Application/Sources///basePackage//folder//". 133 133 134 -= Special Circumstances = 135 - 136 -===== Flagging files to be skipped by Velocity ===== 137 - 138 -If there are files in your template that should not be processed by Velocity as the project is being setup, you will need to end the file name with "binary" which will cause Velocity to strip the "binary" off the file name, but skip processing the contents of the file. Examples of files that you'd want to flag are: 139 - 140 -* EOGenerator Templates 141 -* Custom builder .launch files. 142 - 143 -===== Using keypaths ===== 144 - 145 -* If you need to call a method on a given variable, you need to include the "()" at the end of the method name. An eample is in the build.properties file. In order to get the lowercase version of the project name, you have to call "{{projectName.toLowerCase()}}{{/projectName.toLowerCase()}}" 146 - 147 147 Happy templating