0

I try to develop a maven plugin with resource filtering. In my code i have this :

Resource file = new Resource();
file.setDirectory(buildDir.getAbsolutePath());
file.addInclude("appcfg.xml");
List<Resource>  listResources = new ArrayList<Resource>();
listResources.add(f);

MavenResourcesExecution mavenResourcesExecution =
         new MavenResourcesExecution ( listeResource, outputDir, project,
                                              encoding, buildFilters,
                                              Collections.<String>emptyList(), mavenSession );


mavenResourcesExecution.setUseDefaultFilterWrappers(true);
mavenResourcesExecution.setInjectProjectBuildFilters(true);

mavenResourcesFiltering.filterResources( mavenResourcesExecution );

When i launch my mojo, appcfg.xml file is copied in the output directory but properties are not replaced by values.

my appcfg.xml is like this :

< test name="${project.groupId}__${project.artifactId}__TU" / >

Could you help me to find where is my mistakes.

thanks

3
  • Why not using the usual resource plugin which supports such kind of filtering already? Special needs ?
    – khmarbaise
    Mar 15, 2013 at 16:10
  • 2
    Ah..You need to activate filtering in the resource like file.setFiltering(true);. Apart from that i would suggest to get the resources via a plugin configuration and not hard coded.
    – khmarbaise
    Mar 15, 2013 at 16:21
  • Thanks khmarbaise, file.setFiltering(true) solved my problem. I need hard coded this because my plugin generate the file on the same phase of filtering Mar 19, 2013 at 9:05

1 Answer 1

0

Thanks khmarbaise, file.setFiltering(true) solved my problem. I need hard coded this because my plugin generate the file on the same phase of filtering

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.