Author: baerrach
Date: Mon Dec 15 21:28:18 2008
New Revision: 726962

URL: http://svn.apache.org/viewvc?rev=726962&view=rev
Log:
[MECLIPSE-326] m2eclipse goal does not respect additionalBuildcommands and 
additionalProjectnatures defined in pom
Submitted by: Holger Joest 

- Applied patch, minor change to test to have an IT suffix so it runs as an IT 
and not unit test.
- Added license header to M2EclipseMojo.java

Added:
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/M2EclipseMojoIT.java
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.classpath
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.project
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/pom.xml
   (with props)
Modified:
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/M2EclipseMojo.java

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/M2EclipseMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/M2EclipseMojo.java?rev=726962&r1=726961&r2=726962&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/M2EclipseMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/M2EclipseMojo.java
 Mon Dec 15 21:28:18 2008
@@ -1,3 +1,21 @@
+/*
+ * 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 java.util.ArrayList;
@@ -29,8 +47,23 @@
         // disable normal dependency resolution; the m2eclipse plugin will 
handle it.
         setResolveDependencies( false );
 
-        setAdditionalProjectnatures( new ArrayList( Collections.singletonList( 
M2ECLIPSE_NATURE ) ) );
-        setAdditionalBuildcommands( new ArrayList( Collections.singletonList( 
M2ECLIPSE_BUILD_COMMAND ) ) );
+        if ( getAdditionalProjectnatures() != null )
+        {
+            getAdditionalProjectnatures().add( M2ECLIPSE_NATURE );
+        }
+        else
+        {
+            setAdditionalProjectnatures( new ArrayList( 
Collections.singletonList( M2ECLIPSE_NATURE ) ) );
+        }
+
+        if ( getAdditionalBuildcommands() != null )
+        {
+            getAdditionalBuildcommands().add( M2ECLIPSE_BUILD_COMMAND );
+        }
+        else
+        {
+            setAdditionalBuildcommands( new ArrayList( 
Collections.singletonList( M2ECLIPSE_BUILD_COMMAND ) ) );
+        }
 
         List classpathContainers = getClasspathContainers();
         if ( classpathContainers == null )

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/M2EclipseMojoIT.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/M2EclipseMojoIT.java?rev=726962&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/M2EclipseMojoIT.java
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/M2EclipseMojoIT.java
 Mon Dec 15 21:28:18 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.it;
+
+import java.util.Properties;
+
+/**
+ * @version $Id:$
+ */
+public class M2EclipseMojoIT
+    extends AbstractEclipsePluginIT
+{
+
+    public void testProject01()
+        throws Exception
+    {
+        testProject( "project-m2eclipse-01", new Properties(), "clean", 
"m2eclipse" );
+    }
+
+}

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/M2EclipseMojoIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.classpath
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.classpath?rev=726962&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.classpath
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.classpath
 Mon Dec 15 21:28:18 2008
@@ -0,0 +1,5 @@
+<classpath>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="con" 
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+</classpath>

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.project
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.project?rev=726962&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.project
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.project
 Mon Dec 15 21:28:18 2008
@@ -0,0 +1,21 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-m2eclipse-01</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.springframework.ide.eclipse.core.springbuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+    <nature>org.springframework.ide.eclipse.core.springnature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
+  </natures>
+</projectDescription>

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/expected/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/pom.xml?rev=726962&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/pom.xml
 Mon Dec 15 21:28:18 2008
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-m2eclipse-01</artifactId>
+  <version>14</version>
+  <name>maven-eclipse-plugin-test-project-m2eclipse-01</name>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <version>test</version>
+        <configuration>
+          <additionalProjectnatures>
+            
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
+          </additionalProjectnatures>
+          <additionalBuildcommands>
+            
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
+          </additionalBuildcommands>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-m2eclipse-01/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to