aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2019-11-01 17:05:18 +0000
committerClaude Brisson <cbrisson@apache.org>2019-11-01 17:05:18 +0000
commit8ae9495f039b9141da01330d0c38fec054da07d1 (patch)
tree6376e4a65914eaaab8190c209240e3a351501e79
parent6bb0ea9f1e82ca46b9ac3f0107758ad3bbd39ff8 (diff)
downloadapache-velocity-engine-8ae9495f039b9141da01330d0c38fec054da07d1.tar.gz
[engine] Fix versions issues and README
- fix engine and dependency versions in README and mention the parser customization feature in building section - nicify README links - upgrade surfire plugin version from 2.19.1 to 2.22.1 - upgrade maven-jar-plugin from 3.1.1 to 3.2.2 - add version 1.2 for extra-enforcer-rules - upgrade maven-javadoc-plugin from 3.1.0 to 3.1.1 - upgrade findbugs-maven-plugin from 3.0.4 to 3.0.5 - add a new static class org.apache.velocity.runtime.VelocityEngineVersion.java (see changes in velocity-engine-core/pom.xml) git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1869271 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--README.md29
-rw-r--r--pom.xml17
-rw-r--r--velocity-engine-core/pom.xml55
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java2
-rw-r--r--velocity-engine-core/src/main/resources/org/apache/velocity/runtime/VelocityEngineVersion.java6
-rw-r--r--velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java4
6 files changed, 88 insertions, 25 deletions
diff --git a/README.md b/README.md
index 9f600d35..c51b25e1 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,7 @@
Welcome to Apache Velocity Engine! Apache Velocity is a general purpose
template engine written in Java. For more information about Velocity,
-please look at the HTML documentation on the Velocity web site:
-
- [http://velocity.apache.org/index.html](http://velocity.apache.org/index.html)
+please look at the HTML documentation on the [Velocity web site](http://velocity.apache.org/index.html).
Here's a description of the top level directories:
@@ -16,22 +14,22 @@ Here's a description of the top level directories:
## REQUIREMENTS
-Apache Velocity 2.1 will run with any Java runtime engine v1.8 or greater.
+Apache Velocity 2.2 will run with any Java runtime engine v1.8 or greater.
Building from source requires Java development kit v1.8 or greater and Maven 3 (3.0.5+).
At compile time, Maven should fetch all needed dependencies, which are:
-* commons-lang v3.8.1
-* slf4j-api v1.7.26
+* commons-lang v3.9
+* slf4j-api v1.7.28
plus the following ones, needed for the integrated tests:
-* slf4j-simple v1.7.26
+* slf4j-simple v1.7.28
* junit v4.12
-* hsqldb v2.3.4
+* hsqldb v2.5.0
* commons-io 2.6
At runtime, Velocity only needs:
-* commons-lang v3.8.1+
-* slf4j-api and an slf4j binding, v1.7.26+
+* commons-lang v3.9+
+* slf4j-api and an slf4j binding, v1.7.28+
## BUILDING APACHE VELOCITY
@@ -40,10 +38,8 @@ build it.
Building is easy. All components necessary to build are included or
get downloaded from the internet during the build, except for the Java
- SDK and the Maven build tool. You can find details on how to build
-Velocity online at:
-
-[http://velocity.apache.org/engine/devel/build.html](http://velocity.apache.org/engine/devel/build.html)
+ SDK and the Maven build tool. You can find details online on [how to build
+Velocity](http://velocity.apache.org/engine/devel/build.html).
*IMPORTANT* As the Apache Velocity build process wants to download a
number of jars from the internet, you must be online when you are
@@ -60,6 +56,10 @@ Be sure to update your classpath to include Velocity's .jar
file, or when using a modern servlet container, put it in the
WEB-INF/lib directory.
+## CUSTOMIZING THE PARSER
+
+Since 2.2, it's possible to (build a custom parser)[http://velocity.apache.org/engine/2.2/developer-guide.html#customizing-the-vtl-parser], to change some of the characters used by in the VTL syntax: `*`, `@`, `$` and `#`. Let's say you want to merge some templatized jQuery code full of `$` characters, you can for instance build you own parser which will use the `ยง` character for references instead of `$`.
+
## TRYING THE EXAMPLES
After building Velocity, you can also build the examples that are
@@ -70,3 +70,4 @@ For more information, please see the README.txt in the
velocity-engine-examples/src/etc/ directory.
- The Apache Velocity Team
+
diff --git a/pom.xml b/pom.xml
index bf2ab25d..7e9b199c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,7 +43,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.12</junit.version>
<slf4j.version>1.7.28</slf4j.version>
- <surefire.plugin.version>2.19.1</surefire.plugin.version>
+ <surefire.plugin.version>2.22.1</surefire.plugin.version>
<jira.browse.url>https://issues.apache.org/jira/browse</jira.browse.url>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
@@ -65,17 +65,17 @@
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <version>3.1.1</version>
+ <version>3.1.2</version>
<configuration>
- <archive>
+ <archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
+ </archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
+ <version>3.5.1</version>
<executions>
<execution>
<id>bundle-manifest</id>
@@ -122,6 +122,11 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>extra-enforcer-rules</artifactId>
+ <version>1.2</version>
+ </plugin>
</plugins>
</pluginManagement>
<plugins>
@@ -138,7 +143,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1</version>
<configuration>
<!-- full checking is left disabled
<doclint>html,missing,reference,syntax</doclint>
diff --git a/velocity-engine-core/pom.xml b/velocity-engine-core/pom.xml
index a06956ec..592d1a4b 100644
--- a/velocity-engine-core/pom.xml
+++ b/velocity-engine-core/pom.xml
@@ -66,6 +66,26 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
+ <!-- put engine version in class org.apache.velocity.runtime.VelocityEngineVersion -->
+ <execution>
+ <id>filter-engine-version</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <outputDirectory>${project.build.directory}/generated-sources/version</outputDirectory>
+ </configuration>
+ </execution>
<!-- prepare parser grammar file -->
<execution>
<id>generate-parser-grammar</id>
@@ -75,7 +95,6 @@
</goals>
<configuration>
<useDefaultDelimiters>false</useDefaultDelimiters>
-
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
@@ -200,6 +219,27 @@
</executions>
</plugin>
+ <!-- add VelocityEngineVersion source root -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.0.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/version</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- handle OSGi information -->
<plugin>
<groupId>org.apache.felix</groupId>
@@ -276,8 +316,17 @@
</execution>
</executions>
</plugin>
-
</plugins>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ </resources>
+
</build>
<dependencies>
@@ -321,7 +370,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
- <version>3.0.4</version>
+ <version>3.0.5</version>
<configuration>
<xmlOutput>true</xmlOutput>
<threshold>Low</threshold>
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
index 3049e76e..39f3c0aa 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
@@ -273,7 +273,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
initializing = true;
log.trace("*****************************");
- log.debug("Starting Apache Velocity v2.0");
+ log.debug("Starting Apache Velocity v" + VelocityEngineVersion.VERSION);
log.trace("RuntimeInstance initializing.");
initializeProperties();
diff --git a/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/VelocityEngineVersion.java b/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/VelocityEngineVersion.java
new file mode 100644
index 00000000..e3a2dc8d
--- /dev/null
+++ b/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/VelocityEngineVersion.java
@@ -0,0 +1,6 @@
+package org.apache.velocity.runtime;
+
+public class VelocityEngineVersion
+{
+ public static final String VERSION = "${project.version}";
+}
diff --git a/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java b/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
index 6ea488c8..1842c653 100644
--- a/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
+++ b/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java
@@ -40,11 +40,13 @@ import java.util.Collections;
import java.util.List;
import java.util.Properties;
+import org.apache.velocity.runtime.VelocityEngineVersion;
+
public class VelocityScriptEngineFactory implements ScriptEngineFactory
{
private static final String VELOCITY_NAME = "Velocity";
- private static final String VELOCITY_VERSION = "2.0";
+ private static final String VELOCITY_VERSION = VelocityEngineVersion.VERSION;
private static final String VELOCITY_LANGUAGE = "VTL";
private static List<String> names;