title: Integrating ant resource generation targets into a Maven build
body: <p>I'm currently working on a fairly large project that has been migrated from Ant to Maven. There are no problems with the actual build process (it compiles and packages the source code fine).</p>
  
  <p>The problem is that I also have a lot of targets that generate additional resources for the project (compile LessCSS, generate &amp; upload documentation, generate <code>tld</code> files for custom tags and functions etc.). I am not sure how I should handle these tasks. Let's take the target that builds CSS&amp;JS as an example (the others are more or less similar, but not connected). It looks like this (simplified):</p>
  
  <pre><code>&lt;target name="build.css_js"&gt;
      &lt;concat destfile="${webapp.dir}/scripts/main.js"&gt;
          &lt;fileset dir="${webapp.dir}/scripts/src" includes="*.js"/&gt;
      &lt;/concat&gt;
  
      &lt;!-- build css files from less sources --&gt;
      &lt;taskdef name="lesscss" classname="com.asual.lesscss.LessEngineTask" classpathref="libraries" /&gt;
      &lt;lesscss input="${webapp.dir}/syles/src/input.less" output="${webapp.dir}/styles/output.css" /&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>In the <code>pom.xml</code> I have the following plugin set up:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;phase&gt;generate-resources&lt;/phase&gt;
              &lt;configuration&gt;
                 &lt;tasks&gt;
                     &lt;echo message="Hello World from pom.xml"/&gt;
                     &lt;ant target="build.css_js"/&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;/plugin&gt;
  </code></pre>
  
  <p>The dependencies I'm using are no longer in our SVN repository (since they are managed by Maven), so I switched the libraries variable to point to the Maven repo:</p>
  
  <pre><code>&lt;property name="lib.dir" location="${env.HOMEPATH}/.m2/repository" /&gt;
  </code></pre>
  
  <p>This is not good, as that path may be valid only on my machine. I don't know any other way to reference the libraries from the Maven repository and I need them to run the ant targets.</p>
  
  <ul>
  <li>Is my approach ok or is there a better way of doing things?</li>
  <li>How do I get over the library problem?</li>
  <li>Some resources are needed when packaging the project but some are not. <strike>Is there a lifecycle phase that is out of scope for compile/package?</strike> I found the <code>site</code> lifecycle which I think fits my needs. </li>
  <li>Ideally, I should give up on the ant build file altogether, but I'm not sure it's worth the effort of making the scripts run as maven plugins (I currently have no idea how to do that). What do you think about this?</li>
  </ul>
  
  <p>I'm new to Maven so any suggestions are appreciated.</p>