由于其中一个资源中存在冒号字符 (':'),我无法创建 Maven 原型。我有一个包含该符号的 Spring XML:
<property name="maxSize" value="${ws.client.pool.maxSize:5}"/>
启动原型时出现此错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate
(default-cli) on project standalone-pom:
org.apache.maven.archetype.exception.ArchetypeGenerationFailure: Error merging velocity templates:
Encountered ":5}\"/>\n\t</bean>\n\t\n\t<bean id=\"fooServiceClient\" class=\"org.springframework.aop.framework.ProxyFactoryBean\">\n\t <property name=\"targetSource\" ref=\"fooServiceClientPoolTargetSource\"/>\n\t</bean>\n\n</beans>\n"
at line 15, column 69 of archetype-resources/src/main/resources/spring/library.ws-client.xml
[ERROR] Was expecting one of:
[ERROR] "}" ...
[ERROR] <DOT> ...
[ERROR] "(" ...
[ERROR] -> [Help 1]
[ERROR]
我尝试在原型的 pom 中配置转义字符:
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.0</version>
</plugin>
<!-- Resources configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<escapeString>\</escapeString>
</configuration>
</plugin>
</plugins>
</pluginManagement>
但是它仍然不起作用。在这种情况下:
<property name="maxSize" value="${ws.client.pool.maxSize\:5}"/>
错误如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate
(default-cli) on project standalone-pom: org.apache.maven.archetype.exception.ArchetypeGenerationFailure:
Error merging velocity templates:
Encountered "\\" at line 15, column 69 of archetype-resources/src/main/resources/spring/library.ws-client.xml
[ERROR] Was expecting one of:
[ERROR] "}" ...
[ERROR] <DOT> ...
[ERROR] "(" ...
[ERROR] -> [Help 1]
[ERROR]
关于如何逃脱那个冒号的任何想法?