Maven2 Velocity plugin
----------------------

                 Key: MOJO-1566
                 URL: http://jira.codehaus.org/browse/MOJO-1566
             Project: Mojo
          Issue Type: New Feature
          Components: _Plugin Submission
            Reporter: Gael Lalire


I was searching for a maven plugin using velocity, so I created one.
This plugin uses JAXB to parse a configuration which is deported to a xml 
config file.
By the way, JABX isn't a maven recommendation (instead, I should have use 
Modello...) and needs a JDK5.

The XML Configuration file describes :
- a context : contains maven properties, system properties or litteral values,
- the templates : can be found using the classloader or the file system (below 
${basedir} directory),
- the mergeTemplate : link the context with a template and specify the path to 
the file that will receive the result of the merge,


POM sample :
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-velocity-plugin</artifactId>
        <configuration>
          <velocityConfigurations>
            <fileVelocityConfiguration>
              <path>src/main/config/velocity-configuration.xml</path>
            </fileVelocityConfiguration>
          </velocityConfigurations>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <properties>
    <project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
    <jmsFile.enabled>true</jmsFile.enabled>
  </properties>


XML Configuration file sample :

<velocityConfiguration xmlns="http://www.apache.org/maven/plugin/velocity"; 
xsi:schemaLocation="http://www.apache.org/maven/plugin/velocity 
velocity-configuration.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  defaultTemplateEncoding="UTF-8" 
  defaultOutputEncoding="inherited"
  outputFilePrefix="META-INF">

  <templateMerge outputFile="ejb-jar.xml">
    <templateName name="src/main/templates/ejb-jar.vm" />
    <context>
      <mavenProperty contextKey="bool1" value="jmsFile.enabled" />
    </context>
  </templateMerge>

</velocityConfiguration>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to