You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2009/07/28 01:54:07 UTC

svn commit: r798336 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/ main/java/org/apache/maven/plugin/eclipse/writers/ test/java/org/apache/maven/plugin/eclipse/it/ test/java/org/apache/maven/plugin/eclips...

Author: aheritier
Date: Mon Jul 27 23:54:06 2009
New Revision: 798336

URL: http://svn.apache.org/viewvc?rev=798336&view=rev
Log:
issue MECLIPSE-178: symbolic links need to able to be specified in the pom 
http://jira.codehaus.org/browse/MECLIPSE-178
Applied the patch from ashok to not remove links manually added in project
I also modified the eclipse mojo to allow to setup links in the pom and I added new ITs to test it.

Added:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/LinkedResource.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.classpath
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.project
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/pom.xml
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.classpath
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.project
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.classpath
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.project
    maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/pom.xml
Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/testutils/TestEclipseWriterConfig.java

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=798336&r1=798335&r2=798336&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Mon Jul 27 23:54:06 2009
@@ -535,6 +535,39 @@
      * @parameter
      */
     private List sourceIncludes;
+    
+    /**
+     * A list of links to local files in the system.
+     * A configuration like this one in the pom :
+     * 
+     * <plugin>
+     *  <groupId>org.apache.maven.plugins</groupId>
+     *  <artifactId>maven-eclipse-plugin</artifactId>
+     *  <configuration>
+     *   <linkedResources>
+     *    <linkedResource>
+     *     <name>src/test/resources/oracle-ds.xml</name>
+     *     <type>1</type>
+     *     <location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+     *    </linkedResource>
+     *   </linkedResources>
+     *  </configuration>
+     * </plugin>
+     * 
+     * will produce in the .project :
+     * 
+     * <linkedResources>
+     *  <link>
+     *      <name>src/test/resources/oracle-ds.xml</name>
+     *      <type>1</type>
+     *      <location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+     *  </link>
+     * </linkedResources>
+     *
+     * @since 2.8
+     * @parameter
+     */
+    private List linkedResources;
 
     protected final boolean isJavaProject()
     {
@@ -777,6 +810,22 @@
     {
         this.projectNameTemplate = projectNameTemplate;
     }
+    
+    /**
+     * @return the linkedResources
+     */
+    public List getLinkedResources()
+    {
+        return linkedResources;
+    }
+
+    /**
+     * @param linkedResources the linkedResources to set
+     */
+    public void setLinkedResources( List linkedResources )
+    {
+        this.linkedResources = linkedResources;
+    }
 
     /**
      * @see org.apache.maven.plugin.Mojo#execute()
@@ -853,6 +902,11 @@
         {
             verifyClasspathContainerListIsComplete();
         }
+        
+        if ( linkedResources == null ) {
+            linkedResources = new ArrayList();
+        }
+        
         locator.addSearchPath( FileResourceLoader.ID, project.getFile().getParentFile().getAbsolutePath() );
         locator.setOutputDirectory( new File( project.getBuild().getDirectory() ) );
 
@@ -1246,6 +1300,7 @@
         config.setSourceDirs( sourceDirs );
         config.setAddVersionToProjectName( isAddVersionToProjectName() );
         config.setPackaging( packaging );
+        config.setLinkedResources( linkedResources );
 
         collectWarContextRootsFromReactorEarConfiguration( config );
 

Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/LinkedResource.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/LinkedResource.java?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/LinkedResource.java (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/LinkedResource.java Mon Jul 27 23:54:06 2009
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.maven.plugin.eclipse;
+
+import org.codehaus.plexus.util.xml.XMLWriter;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Represents a LinkedResources section in the <code>.project</code> file.
+ * 
+ * @author <a href="mailto:ashoknanw@gmail.com">Ashokkumar Sankaran</a>
+ */
+public class LinkedResource
+{
+    /** Resource name */
+    private String name;
+
+    /** Type */
+    private String type;
+
+    /** Resource location */
+    private String location;
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public String getLocation()
+    {
+        return location;
+    }
+
+    public void setLocation( String location )
+    {
+        this.location = location;
+    }
+
+    /**
+     * Default constructor
+     */
+    public LinkedResource()
+    {
+        super();
+    }
+
+    /**
+     * Creates a LinkedResource from a DOM subtree
+     * <p>
+     * The subtree must represent a &lt;linkedResources&gt; section from an Eclipse .project file
+     * 
+     * @param node DOM node
+     */
+    public LinkedResource( Xpp3Dom node )
+    {
+        Xpp3Dom nameNode = node.getChild( "name" );
+
+        if ( nameNode == null )
+        {
+            throw new IllegalArgumentException( "No name node." );
+        }
+
+        name = nameNode.getValue();
+
+        Xpp3Dom typeNode = node.getChild( "type" );
+
+        if ( typeNode == null )
+        {
+            throw new IllegalArgumentException( "No type node." );
+        }
+
+        type = typeNode.getValue();
+
+        Xpp3Dom locationNode = node.getChild( "location" );
+
+        if ( locationNode == null )
+        {
+            throw new IllegalArgumentException( "No location node." );
+        }
+
+        location = locationNode.getValue();
+    }
+
+    public void print( XMLWriter writer )
+    {
+        writer.startElement( "link" );
+
+        writer.startElement( "name" );
+        writer.writeText( name );
+        writer.endElement(); // name
+
+        writer.startElement( "type" );
+        writer.writeText( type );
+        writer.endElement(); // type
+
+        writer.startElement( "location" );
+        writer.writeText( location );
+        writer.endElement(); // location
+        writer.endElement();// link
+    }
+
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof LinkedResource )
+        {
+            LinkedResource b = (LinkedResource) obj;
+
+            return name.equals( b.name ) && ( type == null ? b.type == null : type.equals( b.type ) )
+                && ( location == null ? b.location == null : location.equals( b.location ) );
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    public int hashCode()
+    {
+        return name.hashCode() + ( type == null ? 0 : 13 * type.hashCode() )
+            + ( location == null ? 0 : 17 * location.hashCode() );
+    }
+}

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java?rev=798336&r1=798335&r2=798336&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java Mon Jul 27 23:54:06 2009
@@ -35,6 +35,7 @@
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.eclipse.BuildCommand;
+import org.apache.maven.plugin.eclipse.LinkedResource;
 import org.apache.maven.plugin.eclipse.Messages;
 import org.apache.maven.plugin.ide.IdeDependency;
 import org.apache.maven.plugin.ide.IdeUtils;
@@ -61,8 +62,12 @@
 
     private static final String ELT_BUILD_COMMAND = "buildCommand"; //$NON-NLS-1$
 
+    private static final String ELT_LINK = "link"; //$NON-NLS-1$
+
     private static final String ELT_BUILD_SPEC = "buildSpec"; //$NON-NLS-1$
 
+    private static final String ELT_LINKED_RESOURCES = "linkedResources"; //$NON-NLS-1$
+
     private static final String ELT_NATURE = "nature"; //$NON-NLS-1$
 
     private static final String ELT_NATURES = "natures"; //$NON-NLS-1$
@@ -80,6 +85,11 @@
     private static final int LINK_TYPE_DIRECTORY = 2;
 
     /**
+     * To Store the link names
+     */
+    ArrayList linkNames = new ArrayList();
+
+    /**
      * @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write()
      */
     public void write()
@@ -88,6 +98,7 @@
 
         Set projectnatures = new LinkedHashSet();
         Set buildCommands = new LinkedHashSet();
+        Set linkedResources = new LinkedHashSet();
 
         File dotProject = new File( config.getEclipseProjectDirectory(), FILE_DOT_PROJECT );
 
@@ -127,6 +138,23 @@
                         }
                     }
                 }
+                // Added the below code to preserve the Symbolic links
+                Xpp3Dom linkedResourcesElement = dom.getChild( ELT_LINKED_RESOURCES );
+                if ( linkedResourcesElement != null )
+                {
+                    Xpp3Dom[] existingLinks = linkedResourcesElement.getChildren( ELT_LINK );
+                    for ( int j = 0; j < existingLinks.length; j++ )
+                    {
+                        Xpp3Dom linkName = existingLinks[j].getChild( ELT_NAME );
+                        if ( linkName != null )
+                        {
+                            // add all the existing symbolic links
+                            linkNames.add( existingLinks[j].getChild( ELT_NAME ).getValue() );
+                            linkedResources.add( new LinkedResource( existingLinks[j] ) );
+                        }
+                    }
+                }
+
             }
             catch ( XmlPullParserException e )
             {
@@ -153,6 +181,11 @@
             buildCommands.add( (BuildCommand) iter.next() );
         }
 
+        for ( Iterator iter = config.getLinkedResources().iterator(); iter.hasNext(); )
+        {
+            linkedResources.add( (LinkedResource) iter.next() );
+        }
+
         Writer w;
 
         try
@@ -229,9 +262,17 @@
 
         boolean addLinks = !config.getProjectBaseDir().equals( config.getEclipseProjectDirectory() );
 
-        if ( addLinks || ( config.isPde() && config.getDepsOrdered().length > 0 ) )
+        if ( addLinks || ( config.isPde() && config.getDepsOrdered().length > 0 ) || linkedResources.size() > 0 )
         {
             writer.startElement( "linkedResources" ); //$NON-NLS-1$
+            // preserve the symbolic links
+            if ( linkedResources.size() > 0 )
+            {
+                for ( Iterator it = linkedResources.iterator(); it.hasNext(); )
+                {
+                    ( (LinkedResource) it.next() ).print( writer );
+                }
+            }
 
             if ( addLinks )
             {
@@ -334,22 +375,27 @@
      */
     private void addLink( XMLWriter writer, String name, String location, int type )
     {
-        writer.startElement( "link" ); //$NON-NLS-1$
+        // Avoid duplicates entries of the link..
+        if ( !linkNames.contains( name ) )
+        {
 
-        writer.startElement( ELT_NAME );
-        writer.writeText( name );
-        writer.endElement(); // name
+            writer.startElement( "link" ); //$NON-NLS-1$
 
-        writer.startElement( "type" ); //$NON-NLS-1$
-        writer.writeText( Integer.toString( type ) );
-        writer.endElement(); // type
+            writer.startElement( ELT_NAME );
+            writer.writeText( name );
+            writer.endElement(); // name
+
+            writer.startElement( "type" ); //$NON-NLS-1$
+            writer.writeText( Integer.toString( type ) );
+            writer.endElement(); // type
 
-        writer.startElement( "location" ); //$NON-NLS-1$
+            writer.startElement( "location" ); //$NON-NLS-1$
 
-        writer.writeText( location );
+            writer.writeText( location );
 
-        writer.endElement(); // location
+            writer.endElement(); // location
 
-        writer.endElement(); // link
+            writer.endElement(); // link
+        }
     }
 }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java?rev=798336&r1=798335&r2=798336&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java Mon Jul 27 23:54:06 2009
@@ -149,6 +149,8 @@
 
     private WorkspaceConfiguration workspaceConfiguration;
 
+    private List linkedResources;
+
     public WorkspaceConfiguration getWorkspaceConfiguration()
     {
         return workspaceConfiguration;
@@ -605,4 +607,20 @@
         this.ajdtVersion = ajdtVersion;
     }
 
+    /**
+     * @return the linkedResources
+     */
+    public List getLinkedResources()
+    {
+        return linkedResources;
+    }
+
+    /**
+     * @param linkedResources the linkedResources to set
+     */
+    public void setLinkedResources( List linkedResources )
+    {
+        this.linkedResources = linkedResources;
+    }
+
 }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java?rev=798336&r1=798335&r2=798336&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java Mon Jul 27 23:54:06 2009
@@ -636,12 +636,34 @@
      * 
      * @throws Exception
      */
-    public void testProject53MECLIPS551()
+    public void testProject53MECLIPSE551()
         throws Exception
     {
         testProject( "project-53-MECLIPSE-551" );
     }
 
+    /**
+     * [MECLIPSE-178] symbolic links need to able to be specified in the pom
+     * 
+     * @throws Exception
+     */
+    public void testProject54MECLIPSE178()
+        throws Exception
+    {
+        testProject( "project-54-MECLIPSE-178" );
+    }
+    
+    /**
+     * [MECLIPSE-178] symbolic links need to able to be specified in the pom
+     * Test the case where a link is already existing in the .project 
+     * @throws Exception
+     */
+    public void testProject55MECLIPSE178()
+        throws Exception
+    {
+        testProject( "project-55-MECLIPSE-178" );
+    }
+    
     public void testJeeSimple()
         throws Exception
     {

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java Mon Jul 27 23:54:06 2009
@@ -0,0 +1,126 @@
+package org.apache.maven.plugin.eclipse.writers;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.eclipse.writers.testutils.TestEclipseWriterConfig;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.tools.easymock.TestFileManager;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.codehaus.plexus.util.xml.XMLWriter;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.jdom.JDOMException;
+import junit.framework.TestCase;
+
+public class EclipseProjectWriterTest extends TestCase {
+	private TestFileManager fileManager = new TestFileManager( "EclipseProjectWriter.unitTest.", "" );
+	public EclipseProjectWriterTest(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+         
+	}
+
+	protected void tearDown() throws Exception {
+		fileManager.cleanUp();
+	}
+
+	public void testWrite_preservingLinkedResources() throws MojoExecutionException, JDOMException, IOException, XmlPullParserException {
+		
+		//create the config and the logger
+		 TestEclipseWriterConfig config = new TestEclipseWriterConfig();
+		 TestLog log = new TestLog();
+		 
+		 //setup the eclipse project
+		 File basedir = fileManager.createTempDir();
+		 config.setProjectBaseDir( basedir );
+		 config.setEclipseProjectDirectory( basedir );
+		 config.setEclipseProjectName( "test-project" );
+		 MavenProject project = new MavenProject();
+		 config.setProject(project);
+         EclipseProjectWriter projectWriter = new EclipseProjectWriter();
+         //create the .project file and start writing the contents
+		 File dotProject = new File( config.getEclipseProjectDirectory(), ".project" );
+		 Writer w = new OutputStreamWriter( new FileOutputStream( dotProject ), "UTF-8" );
+		 XMLWriter writer = new PrettyPrintXMLWriter( w );
+		 
+		 writer.startElement("projectDescription");
+		 
+		 writer.startElement("name");
+		 writer.writeText("test-project");
+		 writer.endElement();//name
+		 
+		 writer.startElement("linkedResources");
+		 writer.startElement("link");
+		 
+		 writer.startElement("name");
+		 writer.writeText("linkTest");
+		 writer.endElement();//name
+		 
+		 writer.startElement("type");
+		 writer.writeText("2");
+		 writer.endElement();//type
+		 
+		 writer.startElement("location");
+		 writer.writeText(basedir+"/dummyName");	
+		 writer.endElement(); //location	
+		
+		 writer.endElement();//link
+		 writer.endElement();//linkedResources
+		 writer.endElement();//projectDescription
+		 
+		 IOUtil.close( w );
+		//parse the file we just created in order to keep manually-added linkedResources
+		 //pre setup
+         Reader reader = null;
+         reader = new InputStreamReader( new FileInputStream( dotProject ), "UTF-8" );
+         Xpp3Dom dom = Xpp3DomBuilder.build( reader );
+         Xpp3Dom linkedResourcesElement = dom.getChild("linkedResources");
+         Xpp3Dom[] existingLinks = linkedResourcesElement.getChildren("link");
+         String existingName = existingLinks[0].getChild("name").getValue();
+         String existingType = existingLinks[0].getChild("type").getValue();
+         String existingLocation = existingLinks[0].getChild("location").getValue();
+         reader.close();
+         //call the projectwriter to write the .project file
+         projectWriter.init( log, config );
+         projectWriter.write();
+         //post check..compare the pre values to make sure the writer preserves the LinkedResources
+         reader = new InputStreamReader( new FileInputStream( dotProject ), "UTF-8" );
+         Xpp3Dom linkedResourcesElement1 = dom.getChild("linkedResources");
+         assertNotNull("No linkedResources present", linkedResourcesElement1);
+         Xpp3Dom[] currentLinks = linkedResourcesElement.getChildren("link");
+         String currentName = existingLinks[0].getChild("name").getValue();
+         String currentType = existingLinks[0].getChild("type").getValue();
+         String currentLocation = existingLinks[0].getChild("location").getValue();
+         assertEquals("link name is not equal", existingName,currentName);
+         assertEquals("link type is not equal", existingType,currentType);
+         assertEquals("link location is not equal", existingLocation,currentLocation);
+         
+         reader.close();
+         
+         
+
+	}
+	  private static final class TestLog
+      extends SystemStreamLog
+  {
+      public boolean isDebugEnabled()
+      {
+          return true;
+      }
+  }
+
+}

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/testutils/TestEclipseWriterConfig.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/testutils/TestEclipseWriterConfig.java?rev=798336&r1=798335&r2=798336&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/testutils/TestEclipseWriterConfig.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/testutils/TestEclipseWriterConfig.java Mon Jul 27 23:54:06 2009
@@ -89,4 +89,16 @@
         return dirs;
     }
 
+    public List getLinkedResources()
+    {
+        List result = super.getLinkedResources();
+
+        if ( result == null )
+        {
+            result = new ArrayList();
+        }
+
+        return result;
+    }
+
 }

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.classpath?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.classpath (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.classpath Mon Jul 27 23:54:06 2009
@@ -0,0 +1,4 @@
+<classpath>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.project
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.project?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.project (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/expected/.project Mon Jul 27 23:54:06 2009
@@ -0,0 +1,20 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-54</name>
+  <comment>Project-54 - Test MECLIPSE-178</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+  <linkedResources>
+    <link>
+      <name>src/test/resources/oracle-ds.xml</name>
+      <type>1</type>
+      <location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+    </link>
+  </linkedResources>
+</projectDescription>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/pom.xml?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-54-MECLIPSE-178/pom.xml Mon Jul 27 23:54:06 2009
@@ -0,0 +1,29 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipse</groupId>
+	<artifactId>maven-eclipse-plugin-test-project-54</artifactId>
+	<packaging>war</packaging>
+	<version>1.0-SNAPSHOT</version>
+	<!-- TODO project name  -->
+	<name>Project-54 - Test MECLIPSE-178</name>
+	<description>Project-54 - Test MECLIPSE-178</description>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>test</version>
+				<configuration>
+					<linkedResources>
+						<linkedResource>
+							<name>src/test/resources/oracle-ds.xml</name>
+							<type>1</type>
+							<location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+						</linkedResource>
+					</linkedResources>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.classpath?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.classpath (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.classpath Mon Jul 27 23:54:06 2009
@@ -0,0 +1,4 @@
+<classpath>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.project
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.project?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.project (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/.project Mon Jul 27 23:54:06 2009
@@ -0,0 +1,20 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-55</name>
+  <comment>Project-55 - Test MECLIPSE-178</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+  <linkedResources>
+    <link>
+      <name>src/test/resources/oracle-ds.xml</name>
+      <type>1</type>
+      <location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+    </link>
+  </linkedResources>
+</projectDescription>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.classpath?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.classpath (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.classpath Mon Jul 27 23:54:06 2009
@@ -0,0 +1,4 @@
+<classpath>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.project
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.project?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.project (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/expected/.project Mon Jul 27 23:54:06 2009
@@ -0,0 +1,25 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-55</name>
+  <comment>Project-55 - Test MECLIPSE-178</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+  <linkedResources>
+    <link>
+      <name>src/test/resources/oracle-ds.xml</name>
+      <type>1</type>
+      <location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+    </link>
+    <link>
+      <name>src/test/resources/mysql-ds.xml</name>
+      <type>1</type>
+      <location>C://jboss/server/default/deploy/mysql-ds.xml</location>
+    </link>
+  </linkedResources>
+</projectDescription>
\ No newline at end of file

Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/pom.xml?rev=798336&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-55-MECLIPSE-178/pom.xml Mon Jul 27 23:54:06 2009
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>eclipse</groupId>
+	<artifactId>maven-eclipse-plugin-test-project-55</artifactId>
+	<packaging>war</packaging>
+	<version>1.0-SNAPSHOT</version>
+	<!-- TODO project name  -->
+	<name>Project-55 - Test MECLIPSE-178</name>
+	<description>Project-55 - Test MECLIPSE-178</description>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>test</version>
+				<configuration>
+					<linkedResources>
+						<linkedResource>
+							<name>src/test/resources/oracle-ds.xml</name>
+							<type>1</type>
+							<location>C://jboss/server/default/deploy/oracle-ds.xml</location>
+						</linkedResource>
+						<linkedResource>
+							<name>src/test/resources/mysql-ds.xml</name>
+							<type>1</type>
+							<location>C://jboss/server/default/deploy/mysql-ds.xml</location>
+						</linkedResource>
+					</linkedResources>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file



Re: svn commit: r798336 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/ main/java/org/apache/maven/plugin/eclipse/writers/ test/java/org/apache/maven/plugin/eclipse/it/ test/java/org/apache/maven/plugin/eclips...

Posted by Benjamin Bentmann <be...@udo.edu>.
Hi Arnaud,

> Author: aheritier
> Date: Mon Jul 27 23:54:06 2009
> New Revision: 798336
> 
> URL: http://svn.apache.org/viewvc?rev=798336&view=rev
> Log:
> issue MECLIPSE-178: symbolic links need to able to be specified in the pom 
> http://jira.codehaus.org/browse/MECLIPSE-178
> Applied the patch from ashok to not remove links manually added in project
> I also modified the eclipse mojo to allow to setup links in the pom and I added new ITs to test it.
> 
> Added:
>     maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/LinkedResource.java
>     maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java

The source files you added were missing the SVN properties like 
eol-style, could you check your SVN client's config [0]?


Benjamin


[0] http://maven.apache.org/developers/committer-environment.html

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