Goo*_*tik 11
这是我做的:
使用antrun插件创建一个临时文件,其中包含列表:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<fileset id="my-fileset" dir="src/main/resources" />
<pathconvert targetos="unix" pathsep=","
property="my-file-list" refid="my-fileset">
<map from="${basedir}\src\main\resources\" to="" />
</pathconvert>
<echo file="${basedir}\target\file-list.txt">${my-file-list}</echo>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
然后使用replacer插件我替换我想要的文件中的列表:
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<executions>
<execution>
<id>replace-file-list</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<ignoreMissingFile>false</ignoreMissingFile>
<file>target/MY_FILE.TXT</file>
<regex>false</regex>
<token>$file-list$</token>
<valueFile>target/file-list.txt</valueFile>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我相信一定有更好的方法,但希望这有助于某人.
| 归档时间: |
|
| 查看次数: |
4084 次 |
| 最近记录: |