我有一个注释处理器,它生成一个文本文件,包含在编译的jar中。 (注释处理器位于正在编译的同一项目中。)
生成的文件中有一个${project.version}
字符串,我希望将其替换为典型的maven资源过滤。
我如何实现这一目标?
我当前的pom.xml的构建部分是
<build>
<finalName>prodity-commons-spigot</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources/META-INF</directory>
<targetPath>./META-INF</targetPath>
<filtering>false</filtering>
<includes>
<include>services/javax.annotation.processing.Processor</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</execution>
<execution>
<id>compile-project</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:0)
过滤必须为true:
<resources>
<resource>
<directory>${project.basedir}/src/main/resources/META-INF</directory>
<targetPath>./META-INF</targetPath>
<filtering>true</filtering>
<includes>
<include>services/javax.annotation.processing.Processor</include>
</includes>
</resource>
</resources>