title: Maven Antrun and Dependencies
body: <p><strong>(See edits below.)</strong></p>
  
  <p>The reason I can't just use the classpath, is because I need to manage some non-java libraries, and I'm compiling a non-java project.</p>
  
  <p>I'm trying to use maven dependencies in an antrun call, following the documentation on the maven site:</p>
  
  <p><a href="http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html" rel="nofollow noreferrer">http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html</a></p>
  
  <p>At the bottom of the page:</p>
  
  <pre><code>&lt;property name="mvn.dependency.jar" 
        refid="maven.dependency.my.group.id:my.artifact.id:classifier:jar.path"/&gt;
  &lt;echo message="My Dependency JAR-Path: ${mvn.dependency.jar}"/&gt; 
  </code></pre>
  
  <p>I can't make this work no matter how I try. I've tried ${} around the refid contents, I've tried colons, periods, etc.. as separators in every way I can think of.</p>
  
  <p>Can anyone tell me what that refid should <em>really</em> look like for some common dependency?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Thanks for your reply. </p>
  
  <p>Using your example SingleShot, I have the following:</p>
  
  <pre><code>&lt;plugins&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
        &lt;execution&gt;
          &lt;id&gt;create-messages&lt;/id&gt;
          &lt;phase&gt;compile&lt;/phase&gt;
          &lt;configuration&gt;
            &lt;tasks&gt;
              &lt;property name="build.compiler" value="extJavac"/&gt;
              &lt;property name="compile_classpath" refid="maven.compile.classpath"/&gt;
              &lt;property name="runtime_classpath" refid="maven.runtime.classpath"/&gt;
              &lt;property name="test_classpath" refid="maven.test.classpath"/&gt;
              &lt;property name="plugin_classpath" refid="maven.plugin.classpath"/&gt;
  
              &lt;property name="log4j.jar" refid="log4j:log4j:jar"/&gt;
              &lt;echo message="Where is the Log4J JAR?: ${log4j.jar}"/&gt;
            &lt;/tasks&gt;
          &lt;/configuration&gt;
          &lt;goals&gt;
            &lt;goal&gt;run&lt;/goal&gt;
          &lt;/goals&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
      &lt;dependencies&gt;
        &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.14&lt;/version&gt;
        &lt;/dependency&gt;
      &lt;/dependencies&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>And here's what I get when run mvn compile:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO] ------------------------------------------------------------------------
  [INFO] Building Chat Component
  [INFO]    task-segment: [compile]
  [INFO] ------------------------------------------------------------------------
  Downloading: http://&lt;redacted&gt;/content/groups/public/log4j/log4j/1.2.14/log4j-1.2.14.pom
  2K downloaded
  Downloading: http://&lt;redacted&gt;/content/groups/public/log4j/log4j/1.2.14/log4j-1.2.14.jar
  358K downloaded
  [INFO] [antrun:run {execution: create-messages}]
  [INFO] Executing tasks
  [INFO] ------------------------------------------------------------------------
  [ERROR] BUILD ERROR
  [INFO] ------------------------------------------------------------------------
  [INFO] Error executing ant tasks
  
  Embedded error: Reference log4j:log4j:jar not found.
  [INFO] ------------------------------------------------------------------------
  [INFO] For more information, run Maven with the -e switch
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 3 seconds
  [INFO] Finished at: Fri Oct 16 14:54:19 PDT 2009
  [INFO] Final Memory: 7M/80M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p><strong>EDIT (2):</strong></p>
  
  <p>Looking at the sourcecode linked I decided to run "mvn -X compile" and grep for "Storing", which turns up a bunch of log output where things are getting stored.</p>
  
  <p>Of interest are the facts that the dependency I'm explicitly specifying isn't showing in the list, and, that when I switch to a key based on one of the entries I <em>do</em> see, I still get the error.</p>