任何人都知道如何通过资源插件过滤java文件中引号之外的文本?
我有一个资源过滤器,其分隔符为@,但我只看到 version.designator 已被替换。这让我觉得在java文件中过滤引号之外的文本是一种技巧。
感谢您的帮助
彼得
聚甲醛
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>update Version file from pom</id>
<phase>generate-resources</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<overwrite>true</overwrite>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<outputDirectory>${project.build.sourceDirectory}/</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
来源
public final class Version {
public static final int MAJOR_VERSION = @version.major@;
public static final String DESIGNATOR_VERSION = "@version.designator@";
结果
public final class Version {
public static final int MAJOR_VERSION = @version.major@;
public static final String DESIGNATOR_VERSION = "BETA";