Maven Build Velocity

1,配置pom.xml

<!-- velocity 模板引擎 -->

<dependency>

<groupId>org.apache.velocity</groupId>

<artifactId>velocity</artifactId>

<version>1.7</version>

</dependency>

<dependency>

<groupId>org.apache.velocity</groupId>

<artifactId>velocity-tools</artifactId>

<version>2.0</version>

</dependency>

<!-- end -->

2,解压velocity-tools.jar

在org.apache.velocity.tools.view包中复制出velocity.properties和tools.xml文件

到WEB-INF目录下,

修改velocity.properties:

input.encoding=UTF-8

output.encoding=UTF-8

将velocity.properties,tools.xml into the WEB-INF directory

3, modify web.xml

<!-- velocity 模板引擎servlet -->

<servlet>

<servlet-name>velocity</servlet-name>

<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>

<init-param>

<param-name>org.apache.velocity.properties</param-name>

<param-value>/WEB-INF/velocity.properties</param-value>

</init-param>

<init-param>

<param-name>org.apache.velocity.toolbox</param-name>

<param-value>/WEB-INF/tools.xml</param-value>

</init-param>

</servlet>

<servlet-mapping>

<servlet-name>velocity</servlet-name>

<url-pattern>*.vm</url-pattern>

</servlet-mapping>

<!-- end -->

After the above configuration is completed, the web container should be able to parse Velocity, but opening the file in eclipse is very ugly, because there is no different color marking different tags like jsp. So we need the next Velocity editing plug-in (veloeclipse)

1. Official online installation address: http://veloeclipse.googlecode.com/svn/trunk/update/ (this seems to be blocked, if you can access it, you can choose online Installation, it seems that there is only version 2.8)

2, I downloaded it from GitHub, there are two versions, one is 3.0.0 and the other is 3.0.1 GitHub address https://github.com/masrawi/veloeclipse

Click to download download zip After decompressing, put the plugins and features in the corresponding directory of eclipse (note that the same version should be selected), after restarting, it should be fine, but this seems to not work in myeclipse (maybe I don't know how to configure it) )

3, with the file I have downloaded http://pan.baidu.com/s/1jG235Z4

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327105891&siteId=291194637