开发者

Maven expression for src/main/resources

开发者 https://www.devze.com 2022-12-18 14:33 出处:网络
How can I specify the main resource directory in Maven as a File? I\'m using ${project.resources[0]}, but that is a org.apache.maven.model.Resource, whereas I need a java.io.File.

How can I specify the main resource directory in Maven as a File? I'm using ${project.resources[0]}, but that is a org.apache.maven.model.Resource, whereas I need a java.io.File.

I need this for 开发者_如何学运维usage in the rpm-maven-plugin:

<mapping>
  <directory>${app.home}/cfg</directory>
  <sources>
    <source>
       <location>${project.resources[0]}</location>
    </source>
   </sources>
</mapping>


Indeed, resources/resource is a List<Resource>. I may be wrong but I think that the best you can get from a resource is a String representing the directory where the resources are stored (which is a relative path to the POM).

${project.build.resources[0].directory}
0

精彩评论

暂无评论...
验证码 换一张
取 消