You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2011/10/26 19:42:35 UTC

svn commit: r1189335 - in /maven/plugins/trunk/maven-dependency-plugin/src: main/java/org/apache/maven/plugin/dependency/ test/java/org/apache/maven/plugin/dependency/ test/java/org/apache/maven/plugin/dependency/its/ test/resources/its/get/ test/resou...

Author: carlos
Date: Wed Oct 26 17:42:34 2011
New Revision: 1189335

URL: http://svn.apache.org/viewvc?rev=1189335&view=rev
Log:
[MDEP-284] Get Mojo ignores the transitive attribute because of a typo in the parameter declaration. Add IT tests too. Patch by Baptiste Mathus

Added:
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java   (with props)
    maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/
    maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml   (with props)
    maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/
    maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml   (with props)
Modified:
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/GetMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/its/DependencyPluginTest.java

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/GetMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/GetMojo.java?rev=1189335&r1=1189334&r2=1189335&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/GetMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/GetMojo.java Wed Oct 26 17:42:34 2011
@@ -169,7 +169,7 @@ public class GetMojo
 
     /**
      * Download transitively, retrieving the specified artifact and all of its dependencies.
-     * @parameter expression="{$transitive}" default-value=true
+     * @parameter expression="${transitive}" default-value=true
      */
     private boolean transitive = true;
 

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java?rev=1189335&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java Wed Oct 26 17:42:34 2011
@@ -0,0 +1,66 @@
+package org.apache.maven.plugin.dependency;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.maven.plugin.testing.stubs.StubArtifactRepository;
+
+public class TestGetMojo
+    extends AbstractDependencyMojoTestCase
+{
+
+    protected void setUp()
+        throws Exception
+    {
+        // required for mojo lookups to work
+        super.setUp( "markers", false );
+    }
+
+    /**
+     * tests the proper discovery and configuration of the mojo
+     * 
+     * @throws Exception
+     */
+    public void testgetTestEnvironment()
+        throws Exception
+    {
+        File testPom = new File( getBasedir(), "target/test-classes/unit/get-test/plugin-config.xml" );
+        assert testPom.exists();
+        GetMojo mojo = (GetMojo) lookupMojo( "get", testPom );
+
+        assertNotNull( mojo );
+
+        setVariableValueToObject( mojo, "localRepository", new StubArtifactRepository( testDir.getAbsolutePath() ) );
+
+        // Set properties, transitive = default value = true
+        setVariableValueToObject( mojo, "transitive", Boolean.FALSE );
+        setVariableValueToObject( mojo, "repositoryUrl", "http://repo1.maven.org/maven2" );
+        setVariableValueToObject( mojo, "groupId", "org.apache.maven" );
+        setVariableValueToObject( mojo, "artifactId", "maven-model" );
+        setVariableValueToObject( mojo, "version", "2.0.9" );
+
+        mojo.execute();
+
+        // Set properties, transitive = false
+        setVariableValueToObject( mojo, "transitive", Boolean.FALSE );
+        mojo.execute();
+    }
+}

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/its/DependencyPluginTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/its/DependencyPluginTest.java?rev=1189335&r1=1189334&r2=1189335&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/its/DependencyPluginTest.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugin/dependency/its/DependencyPluginTest.java Wed Oct 26 17:42:34 2011
@@ -75,4 +75,15 @@ public class DependencyPluginTest
     {
         // testProject( "resolve", "dependency:resolve" );
     }
+    
+    /**
+     * Test Resolve Mojo. Simple Harness test essentially
+     * 
+     * @throws Exception any exception thrown during test
+     */
+    public void testGet()
+        throws Exception
+    {
+        // testProject( "resolve", "dependency:get" );
+    }
 }

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml?rev=1189335&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml Wed Oct 26 17:42:34 2011
@@ -0,0 +1,62 @@
+<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">
+<!--
+ * 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. 
+ *
+-->
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>test</groupId>
+    <artifactId>maven-dependency-plugin-it-parent</artifactId>
+    <version>1</version>
+  </parent>
+
+  <artifactId>maven-dependency-plugin-it-get</artifactId>
+  <packaging>pom</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+  <!--This must be set so the correct version is used for the IT test -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>get</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>get</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-model</artifactId>
+          <version>2.0.9</version>
+          <repositoryUrl>http://repo1.maven.org/maven2</repositoryUrl>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/its/get/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml?rev=1189335&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml Wed Oct 26 17:42:34 2011
@@ -0,0 +1,41 @@
+<!--
+ * 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. 
+ *
+-->
+<project>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <configuration>
+          <repositoryUrl>http://repo1.maven.org/maven2</repositoryUrl>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-model</artifactId>
+          <version>2.0.9</version>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0.4</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-dependency-plugin/src/test/resources/unit/get-test/plugin-config.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain