maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r170723 - in /maven/components/trunk/maven-plugins/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java main/java/org/apache/maven/plugin/eclipse/EclipseWriter.java test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java test/projects/project-1/classpath test/projects/project-2/classpath
Date Wed, 18 May 2005 08:23:28 GMT
Author: evenisse
Date: Wed May 18 01:23:27 2005
New Revision: 170723

URL: http://svn.apache.org/viewcvs?rev=170723&view=rev
Log:
MNG-406. Remove hardcoded repository location in generated .classpath. Use M2_REPO as eclipse
variable

Modified:
    maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
    maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseWriter.java
    maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
    maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/classpath
    maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/classpath

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=170723&r1=170722&r2=170723&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
(original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
Wed May 18 01:23:27 2005
@@ -22,10 +22,13 @@
  * SOFTWARE.
  */
 
+import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 
+import java.io.File;
+
 /**
  * A Maven2 plugin which integrates the use of Maven2 with Eclipse.
  *
@@ -47,6 +50,13 @@
      */
     private MavenProject project;
 
+    /**
+     * @parameter expression="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
     public EclipsePlugin()
     {
         eclipseWriter = new EclipseWriter();
@@ -57,6 +67,11 @@
         this.project = project;
     }
 
+    public void setLocalRepository( ArtifactRepository localRepository )
+    {
+        this.localRepository = localRepository;
+    }
+
     public void execute()
         throws MojoExecutionException
     {
@@ -67,6 +82,8 @@
 
         try
         {
+            eclipseWriter.setLocalRepositoryFile( new File ( localRepository.getBasedir()
) );
+
             eclipseWriter.write( project );
         }
         catch ( EclipsePluginException e )

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseWriter.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseWriter.java?rev=170723&r1=170722&r2=170723&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseWriter.java
(original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseWriter.java
Wed May 18 01:23:27 2005
@@ -45,6 +45,13 @@
  */
 public class EclipseWriter
 {
+    private File localRepository;
+
+    public void setLocalRepositoryFile( File localRepository )
+    {
+        this.localRepository = localRepository;
+    }
+
     public void write( MavenProject project )
         throws EclipsePluginException
     {
@@ -330,7 +337,7 @@
 
         writer.addAttribute( "kind", "lib" );
 
-        writer.addAttribute( "path", path.getPath().replace( '\\', '/' ) );
+        writer.addAttribute( "path", "M2_REPO/" + toRelative( localRepository, path.getPath()
) );
 
         writer.endElement();
     }

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?rev=170723&r1=170722&r2=170723&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
(original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
Wed May 18 01:23:27 2005
@@ -85,7 +85,9 @@
         }
 
         plugin.setProject( project );
-        
+
+        plugin.setLocalRepository( localRepository );
+
         plugin.execute();
 
         assertFileEquals( localRepository.getBasedir(), new File( basedir, "project" ), new
File( basedir, ".project" ) );
@@ -128,7 +130,7 @@
 
         while ( (line = reader.readLine()) != null )
         {
-            lines.add( StringUtils.replace( line, "#ArtifactRepositoryPath#", mavenRepo.replace(
'\\', '/' ) ) );
+            lines.add( line );//StringUtils.replace( line, "#ArtifactRepositoryPath#", mavenRepo.replace(
'\\', '/' ) ) );
         }
 
         return lines;

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/classpath
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/classpath?rev=170723&r1=170722&r2=170723&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/classpath
(original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-1/classpath
Wed May 18 01:23:27 2005
@@ -2,5 +2,5 @@
   <classpathentry kind="src" path="src/main/java"/>
   <classpathentry kind="output" path="target/classes"/>
   <classpathentry kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB" sourcepath="JRE_SRC"/>
-  <classpathentry kind="lib" path="#ArtifactRepositoryPath#/maven/jars/maven-core-2.0-SNAPSHOT.jar"/>
+  <classpathentry kind="lib" path="M2_REPO/maven/jars/maven-core-2.0-SNAPSHOT.jar"/>
 </classpath>

Modified: maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/classpath
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/classpath?rev=170723&r1=170722&r2=170723&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/classpath
(original)
+++ maven/components/trunk/maven-plugins/maven-eclipse-plugin/src/test/projects/project-2/classpath
Wed May 18 01:23:27 2005
@@ -5,5 +5,5 @@
   <classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
   <classpathentry kind="output" path="target/classes"/>
   <classpathentry kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB" sourcepath="JRE_SRC"/>
-  <classpathentry kind="lib" path="#ArtifactRepositoryPath#/junit/jars/junit-2.0.jar"/>
+  <classpathentry kind="lib" path="M2_REPO/junit/jars/junit-2.0.jar"/>
 </classpath>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message