How to filter resource in Maven, replacing with a dependencies artifactId?

后端 未结 2 485
孤独总比滥情好
孤独总比滥情好 2020-12-19 11:32

I\'m trying to build a jar that has an xml file as a resource. I\'d like to apply a filter to that xml to insert the name of a dependency into the xml. The filtering is wo

2条回答
  •  暖寄归人
    2020-12-19 12:03

    The indexed properties will only be available inside plugin configuration due to the way Maven interpolates the POM - so it is available to antrun's replace task, but not the filtering.

    However, accessing dependencies by index is not very robust - it is susceptible to changes in the parent. You might instead use the following in pom.xml:

    
      some-name
    
    ...
    
      your.group.id
      ${fileName}
      ...
    
    

    You can then continue to filter using the property name:

    
      ${fileName}
    
    

提交回复
热议问题