title: How to filter resource in Maven, replacing with a dependencies artifactId?
body: <p>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 working, because I was able to drop in <code>${project.build.finalName}</code> and get it replaced.  I found <a href="https://stackoverflow.com/questions/2234124/maven-project-variables-for-dependencies" title="one hint">one hint</a> that the property I'm looking for might be </p>
  
  <pre><code>${project.dependencies[0].artifactId}
  </code></pre>
  
  <p>but that doesn't seem to work.  I'm looking to replace</p>
  
  <pre><code>&lt;fileName&gt;${project.dependencies[0].artifactId}&lt;/fileName&gt;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>&lt;fileName&gt;OtherLibrary&lt;/fileName&gt;
  </code></pre>
  
  <p>Is that possible?</p>
  
  <p>xml, which is in src/main/resources:</p>
  
  <pre><code>&lt;somenode&gt;
    &lt;fileName&gt;${project.dependencies[0].artifactId}&lt;/fileName&gt;
  &lt;/somenode&gt;
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.foo&lt;/groupId&gt;
  &lt;artifactId&gt;Thing&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;Thing&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;build&gt;
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;${basedir}/src/main/resources&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  &lt;/build&gt;
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.pts&lt;/groupId&gt;
          &lt;artifactId&gt;OtherLibrary&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;3.8.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>