title: Eclipse - make it use a environment variable to point to the local maven repo in the sourcepath attribute in .classpath
body: <p>The Maven plugin for Eclipse is finding relevant source code for one of my project's referenced libraries in my local Maven repository and adding a <code>sourcepath</code> attribute to my <code>.classpath</code> file.</p>
  
  <pre><code>&lt;classpathentry kind="lib" path="lib/core/guava-11.0.1.jar" sourcepath="Users/&lt;my_user&gt;/.m2/repository/com/google/guava/guava/11.0.1/guava-11.0.1-sources.jar"&gt;
      &lt;attributes&gt;
          &lt;attribute name="javadoc_location" value="http://docs.guava-libraries.googlecode.com/git-history/v11.0.1/javadoc/"/&gt;
      &lt;/attributes&gt;
  &lt;/classpathentry&gt;
  </code></pre>
  
  <p>The problem is that I cannot commit the <code>.classpath</code> file because it contains a hardcoded path to my local maven repo. Is there a way to tell Eclipse to output that using a environment variable like M2_HOME? Even if it's not automated, is there any token that I can put in there that will let it resolve the location of the source without the hard-coded path? I tried:</p>
  
  <pre><code>sourcepath="$M2_HOME/com/google/guava/guava/11.0.1/guava-11.0.1-sources.jar"
  </code></pre>
  
  <p>but Eclipse could not resolve the location of the source for this library after I made this change.</p>
  
  <p>Any ideas?</p>