maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
Subject svn commit: r650178 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/writers/ main/java/org/apache/maven/plugin/ide/ test/resources/projects/project-30/expected/
Date Mon, 21 Apr 2008 15:54:44 GMT
Author: nicolas
Date: Mon Apr 21 08:54:39 2008
New Revision: 650178

URL: http://svn.apache.org/viewvc?rev=650178&view=rev
Log:
MECLIPSE-437 : include java/javax api dependency prior the classpath container

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-30/expected/.classpath

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=650178&r1=650177&r2=650178&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
Mon Apr 21 08:54:39 2008
@@ -324,6 +324,26 @@
         writer.addAttribute( ATTR_PATH, defaultOutput );
         writer.endElement();
 
+        Set addedDependencies = new HashSet();
+        // TODO if (..magic property equals orderDependencies..)
+
+		// ----------------------------------------------------------------------
+        // Java API dependencies that may complete the classpath container so must 
+		// be declared BEFORE so that container access rules don't fail
+        // ----------------------------------------------------------------------
+        IdeDependency[] depsToWrite = config.getDepsOrdered();
+		for ( int j = 0; j < depsToWrite.length; j++ )
+        {
+            IdeDependency dep = depsToWrite[j];
+			if ( dep.isJavaApi() )
+			{
+				String depId =
+                    dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getClassifier()
+ ":" + dep.getVersion();
+				addDependency( writer, dep );
+				addedDependencies.add( depId );
+			}
+		}
+		
         // ----------------------------------------------------------------------
         // Container classpath entries
         // ----------------------------------------------------------------------
@@ -339,9 +359,6 @@
         // ----------------------------------------------------------------------
         // The dependencies
         // ----------------------------------------------------------------------
-        Set addedDependencies = new HashSet();
-        // TODO if (..magic property equals orderDependencies..)
-        IdeDependency[] depsToWrite = config.getDepsOrdered();
         for ( int j = 0; j < depsToWrite.length; j++ )
         {
             IdeDependency dep = depsToWrite[j];

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java?rev=650178&r1=650177&r2=650178&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
Mon Apr 21 08:54:39 2008
@@ -523,6 +523,14 @@
         return isSystemScoped() && !getFile().getAbsolutePath().startsWith( modulesTop.getAbsolutePath()
);
     }
 
+	/**
+	 * @return <tt>true</tt> if this dependency is a Java API
+	 */
+	public boolean isJavaApi()
+	{
+		return groupId.startsWith( "java." ) || groupId.startsWith( "javax." );
+	}
+	
     /**
      * {@inheritDoc}
      */

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-30/expected/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-30/expected/.classpath?rev=650178&r1=650177&r2=650178&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-30/expected/.classpath
(original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-30/expected/.classpath
Mon Apr 21 08:54:39 2008
@@ -1,5 +1,5 @@
 <classpath>
   <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
   <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 </classpath>



Mime
View raw message