构建和原型到Maven,使用JSP的Velocity ParseErrorException

时间:2013-11-22 10:45:52

标签: maven velocity maven-archetype

我正在尝试使用Maven为项目构建一个多模块原型。当我包含我的JSP时,我从Velocity得到一个例外。

[INFO] Parent element not overwritten in /home/gortiz/workspaces/archetype/miPrueba/miPrueba-new-aw/pom.xml
[ERROR] Parser Exception: archetype-resources/__rootArtifactId__-new-aw/src/main/webapp/WEB-INF/jsp/open/login.jsp
[ERROR] org.apache.velocity.runtime.parser.ParseException: Encountered " eq 1}\">\n

我找到了这个网址,但它对我不起作用。 http://yajdb.wordpress.com/2012/08/28/maven-archetype-creation-conflicts-between-jsp-and-velocity-templates/

我的配置文件是:

<modules>
        <module id="${implantation}-new-aw" dir="__rootArtifactId__-new-aw"
            name="${implantation}-new-aw">
            <fileSets>
                <fileSet filtered="true" encoding="UTF-8">
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                </fileSet>
                <fileSet filtered="true" encoding="UTF-8">
                    <directory>src/test/java</directory>
                    <includes>
                        <include>**/*.java</include>
                    </includes>                 
                </fileSet>
                <!-- <fileSet filtered=”true” packaged=”false”>
                <directory>src/main/webapp</directory>
                    <excludes>
                        <exclude>**/**/*.jsp</exclude>
                        <exclude>**/*.xml</exclude>
                    </excludes>
                </fileSet>-->                
                <fileSet filtered="true" encoding="UTF-8">
                    <directory>src/main/webapp</directory>
                    <includes>
                        <include>**/*.xml</include>
                    </includes>
                </fileSet>
                <fileSet filtered="true" packaged="false" encoding="UTF-8">
                    <directory>src/main/webapp</directory>
                    <includes>
                        <include>**/*.jsp</include>
                    </includes>
                </fileSet>                                                          
                <fileSet filtered="true" encoding="UTF-8">
                    <directory>src/main/resources/</directory>
                    <includes>
                        <include>**/**/*.*</include>
                    </includes>                 
                </fileSet>
            </fileSets>
        </module>       
    </modules>

1 个答案:

答案 0 :(得分:1)

在jsp配置中删除或使过滤的属性为false,也为资源提供。

filtered = true ,可以过滤文件集,这意味着所选文件将用作Velocity模板。

filtere = false ,它们可以是非过滤的,这意味着将复制所选文件而不进行修改。
默认值为:false。

<fileSet packaged="false" encoding="UTF-8">
    <directory>src/main/webapp</directory>
    <includes>
        <include>**/*.jsp</include>
    </includes>
</fileSet>