title: Maven 2: Only build artifact if not already installed in local repository
body: <p>How can I achieve in Maven that when executing "mvn install" from the command line will automatically decide to build the artifact (jar/war) only if that artifact has not already been installed in the local repository?</p>
  
  <p>I've already tried with profiles, the problem here is that in the "activation" task I cannot reference my local repository through a Maven property. I cannot hardcode the local repository as that would break my build in a different environment.</p>
  
  <p>I also tried a workaround by touching a file in a previous phase, e.g. initialize and then check for the existence of the file as activation condition, but this doesn't work because the activation condition is evaluated before the initializing is performed.</p>
  
  <p>Any hints or ideas how to solve this problem?</p>
  
  <p>Thanks,
  Peter</p>