Robert Munteanu
Robert Munteanu

Reputation: 68318

Maven expression for src/main/resources

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>

Upvotes: 2

Views: 389

Answers (1)

Pascal Thivent
Pascal Thivent

Reputation: 570595

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}

Upvotes: 2

Related Questions