tags:

views:

27

answers:

1

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>
+1  A: 

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}
Pascal Thivent
This works superbly. Thanks.
Robert Munteanu