現在、私はリソースフィルタリングに影響を与える他のファイルのロードでリソースフィルタリングを行う独自のプラグインを開発しています。
プラグイン(実行)メソッドに次のコードがあります。
public void execute() throws MojoExecutionException {
if (StringUtils.isEmpty(encoding) && isFilteringEnabled(getResources())) {
getLog().warn(
"File encoding has not been set, using platform encoding "
+ ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
}
Scope scope = convertToScope(getScope());
getLog().info("Hallo welt. (" + scope + ")");
if (getResources() != null) {
for (Resource item : getResources()) {
getLog().info(" --| Resource: " + item.getFiltering() + "|" + item.getDirectory());
}
}
try {
MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution(
resources, outputDirectory, project, encoding, null,
nonFilteredFileExtensions, mavenSession);
ValueSource valueSource = new ValueSource() {
@Override
public Object getValue(String expression) {
getLog().info("Expression: " + expression);
return "XXX";
}
@Override
public List getFeedback() {
getLog().info("getFeedback()");
return Collections.EMPTY_LIST;
}
@Override
public void clearFeedback() {
// TODO Auto-generated method stub
getLog().info("clearFeedback()");
}
};
mavenResourcesExecution.addFilerWrapperWithEscaping(valueSource,
"\\@", "\\@", "@", false);
mavenResourcesExecution.setUseDefaultFilterWrappers(false);
mavenResourcesFiltering.filterResources(mavenResourcesExecution);
} catch (MavenFilteringException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
しかし、私の統合テストでは、フィルタリングは行われません。私の出力では、getValue()、getFeedback()などの出力が見つかりません。
現在、統合テスト中の出力は次のようになります。
[INFO] Hallo welt. ()
[INFO] --| Resource: true|src/main/resource-files
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[DEBUG] resource with targetPath null
directory src/main/resource-files
excludes []
includes []
[DEBUG] ignoreDelta true
[INFO] Copying 1 resource
[DEBUG] file thisIsTheFirst.properties has a filtered file extension
[DEBUG] filtering ..it\configurationTest\src\main\resource-files\thisIsTheFirst.properties to ...\it\configurationTest\target\classes\thisIsTheFirst.properties
ただし、残念ながら、この場合、getValue()メソッドは呼び出されません。
だから問題は:誰かが私が間違っていることを知っていますか?(完全なソースはここから入手できます。