我正在使用maven-replacer-plugin和Maven构建系统来扩展模板文件以包含项目的artifactId和版本,但不知何故使用插件似乎出错了,但我无法弄清楚为什么我似乎有一个正确的定义:
我的pom.xml片段:
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>cardshifter-server.template.policy</file>
<outputFile>${project.parent.build.directory}/${project.artifactId}-${project.version}.policy</outputFile>
<replacements>
<replacement>
<token>[artifactId]</token>
<value>${project.artifactId}</value>
</replacement>
<replacement>
<token>[version]</token>
<value>${project.version}</value>
</replacement>
</replacements>
</configuration>
</plugin>
在以下cardshifter-server.template.policy上运行:
grant codeBase "file:./[artifactId]-[version].jar" {
permission java.security.AllPermission;
};
grant {
//mod permissions
};
with artifactId = cardshifter-server和version = 0.4-SNAPSHOT给出了以下输出:
gca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT ca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.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4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTmca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT
};
有谁能解释一下发生了什么?
答案 0 :(得分:2)
对于替换器插件没有经验,但是当多组替换标识符在同一行上时,我遇到了其他类似问题。尝试更改其中一个分隔符,例如@ version @,看看是否有效。