diff options
author | Claude Brisson <cbrisson@apache.org> | 2019-06-12 00:46:11 +0000 |
---|---|---|
committer | Claude Brisson <cbrisson@apache.org> | 2019-06-12 00:46:11 +0000 |
commit | 5ac474e7b495c78d20151ff337bb8ab1de910aa7 (patch) | |
tree | baac656754b81def940f38ec79e5c5904fa59de5 | |
parent | ab249ab67c062bbf1e413dbfad52e98f38344194 (diff) | |
download | apache-velocity-engine-5ac474e7b495c78d20151ff337bb8ab1de910aa7.tar.gz |
Fixes following Michael's comments:
+ move common plugin versions from child poms to parent one
+ remove duplicate defaultGoal
+ fix and add comments here and there
+ move fetch-grammar-file to initialize phase
+ fix maven-resources-plugin configuration
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/branches/parser_experiments@1861082 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | pom.xml | 10 | ||||
-rw-r--r-- | velocity-custom-parser-example/pom.xml | 30 | ||||
-rw-r--r-- | velocity-engine-core/src/main/parser/Parser.jjt | 2 |
3 files changed, 26 insertions, 16 deletions
@@ -86,6 +86,16 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>3.1.1</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>3.1.0</version> + </plugin> </plugins> </pluginManagement> <plugins> diff --git a/velocity-custom-parser-example/pom.xml b/velocity-custom-parser-example/pom.xml index 7e856060..2eabf75a 100644 --- a/velocity-custom-parser-example/pom.xml +++ b/velocity-custom-parser-example/pom.xml @@ -28,25 +28,30 @@ </parent> <artifactId>velocity-custom-parser-example</artifactId> - <name>Apache Velocity Custom Parser - Example</name> + <name>Apache Velocity Custom Parser Example</name> <description>Custom Parser Example for Apache Velocity</description> <packaging>jar</packaging> <!-- - This plugin demonstrates how to build a custom Velocity parser. - The proposed custom parser replaces '#' with '@' and '@' with '%', + This module demonstrates how to build a custom Velocity parser. + The proposed custom parser replaces '#' with '@' and '@' with '%' so that it's suitable to use with Markdown template files, for instance. The generated parser class is org.apache.velocity.runtime.parser.${parser.name}Parser, - and must be specified at runtime using the Velocity property parser.class : + and must be specified at runtime using the Velocity property parser.class: parser.class = org.apache.velocity.runtime.parser.MyCustomParser + + Please note that: + + + all configurable chars must be specified, even when similar to default ones. + + custom parser package **must** be org.apache.velocity.runtime.parser --> <properties> <!-- whether to display debug logs while parsing --> <parser.debug>false</parser.debug> - <!-- parser name --> + <!-- parser basename --> <parser.name>Custom</parser.name> <!-- character to substitute to '*' --> <parser.char.asterisk>*</parser.char.asterisk> @@ -84,7 +89,6 @@ </dependencies> <build> - <defaultGoal>install</defaultGoal> <plugins> <!-- generate manifest file --> <plugin> @@ -95,11 +99,10 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.1</version> <executions> <execution> <id>fetch-grammar-file</id> - <phase>generate-sources</phase> + <phase>initialize</phase> <goals> <goal>unpack</goal> </goals> @@ -115,13 +118,6 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> - <version>3.1.0</version> - <configuration> - <useDefaultDelimiters>false</useDefaultDelimiters> - <delimiters> - <delimiter>${*}</delimiter> - </delimiters> - </configuration> <executions> <execution> <id>generate-parser-grammar</id> @@ -130,6 +126,10 @@ <goal>copy-resources</goal> </goals> <configuration> + <useDefaultDelimiters>false</useDefaultDelimiters> + <delimiters> + <delimiter>${*}</delimiter> + </delimiters> <resources> <resource> <directory>${project.build.directory}/grammar</directory> diff --git a/velocity-engine-core/src/main/parser/Parser.jjt b/velocity-engine-core/src/main/parser/Parser.jjt index ecfef164..17a26957 100644 --- a/velocity-engine-core/src/main/parser/Parser.jjt +++ b/velocity-engine-core/src/main/parser/Parser.jjt @@ -108,7 +108,7 @@ import org.slf4j.Logger; * @author <a href="hps@intermeta.de">Henning P. Schmiedehausen</a> * @version $Id: $ */ -public class ${parser.name}Parser implements Parser +public class ${parser.name}Parser implements org.apache.velocity.runtime.parser.Parser { /** * Parser debugging flag. |