Author: bentmann
Date: Fri Aug 28 11:32:23 2009
New Revision: 808851

URL: http://svn.apache.org/viewvc?rev=808851&view=rev
Log:
o Prevented leakage of transitive dependencies into plugins

Added:
    maven/shared/trunk/maven-artifact-resolver/src/it/   (with props)
    maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/   
(with props)
    
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties
   (with props)
    
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml  
 (with props)
    
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh
   (with props)
    maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml   (with 
props)
Modified:
    maven/shared/trunk/maven-artifact-resolver/pom.xml

Modified: maven/shared/trunk/maven-artifact-resolver/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-resolver/pom.xml?rev=808851&r1=808850&r2=808851&view=diff
==============================================================================
--- maven/shared/trunk/maven-artifact-resolver/pom.xml (original)
+++ maven/shared/trunk/maven-artifact-resolver/pom.xml Fri Aug 28 11:32:23 2009
@@ -34,27 +34,37 @@
   <description>
     Provides a component for plugins to easily resolve project dependencies.
   </description>
-  
+
+  <!--
+  NOTE: This library is meant to be used by plugins, hence we can consider the 
Maven API to be provided by the
+  runtime environment. Last but not least, using "provided" scope is the 
easiest way to exclude all our transitive
+  dependencies from the plugin class path.
+  -->
+
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact-manager</artifactId>
       <version>2.1.0</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
       <version>2.1.0</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-project</artifactId>
       <version>2.1.0</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
       <version>2.1.0</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
@@ -130,6 +140,29 @@
             </plugin>
           </plugins>
         </pluginManagement>
+        <plugins>
+          <plugin>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <version>1.3</version>
+            <configuration>
+              <debug>true</debug>
+              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+              <preBuildHookScript>setup</preBuildHookScript>
+              <postBuildHookScript>verify</postBuildHookScript>
+              
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+              <settingsFile>src/it/settings.xml</settingsFile>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <goals>
+                  <goal>install</goal>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
       </build>
     </profile>
   </profiles>

Propchange: maven/shared/trunk/maven-artifact-resolver/src/it/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Fri Aug 28 11:32:23 2009
@@ -0,0 +1 @@
+MSHARED-\d+

Propchange: maven/shared/trunk/maven-artifact-resolver/src/it/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Fri Aug 28 11:32:23 2009
@@ -0,0 +1 @@
+MSHARED-\d+

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/
------------------------------------------------------------------------------
    bugtraq:url = http://jira.codehaus.org/browse/%BUGID%

Added: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties?rev=808851&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties
 (added)
+++ 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties
 Fri Aug 28 11:32:23 2009
@@ -0,0 +1 @@
+invoker.goals = validate

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml?rev=808851&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml 
(added)
+++ 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml 
Fri Aug 28 11:32:23 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mar</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <description>
+    Verify that the shared lib does not provide access to non-core APIs like 
wagon-*, commons-* or whatever via its
+    transitive dependencies. In Maven 3.x, this component is meant to be 
filtered out from the plugin realm in favor
+    of a core component with an equivalent API. This dependency replacement is 
only transparent to a plugin if the
+    dependency closure is equivalent, too. Hence, we're aiming at a minimal 
dependency set of the shared component
+    such that Maven 3.x does not need to bother with any legacy libs.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>@project.groupId@</groupId>
+      <artifactId>@project.artifactId@</artifactId>
+      <version>@project.version@</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.0</version>
+        <configuration>
+          <outputFile>target/deps.txt</outputFile>
+        </configuration>
+        <executions>
+          <execution>
+            <id>list-dependencies</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>list</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh?rev=808851&view=auto
==============================================================================
--- 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh
 (added)
+++ 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh
 Fri Aug 28 11:32:23 2009
@@ -0,0 +1,37 @@
+import java.io.*;
+import java.util.*;
+
+List artifacts = new ArrayList();
+
+BufferedReader reader = new BufferedReader( new FileReader( new File( basedir, 
"target/deps.txt" ) ) );
+
+try
+{
+    String line;
+    
+    while ( ( line = reader.readLine() ) != null )
+    {
+        if ( line.startsWith( "  " ) )
+        {
+            String artifact = line.trim();
+            artifact = artifact.substring( 0, artifact.indexOf( ':', 
artifact.indexOf( ':' ) + 1 ) );
+            artifacts.add( artifact );
+        }
+    }
+}
+finally
+{
+    reader.close();
+}
+
+System.out.println( "Checking dependency closure of shared component..." );
+System.out.println( artifacts );
+
+artifacts.remove( "org.apache.maven.shared:maven-artifact-resolver" );
+
+if ( !artifacts.isEmpty() )
+{
+    throw new Exception( "shared component leaks unwanted dependencies into 
plugin class path: " + artifacts );
+}
+
+return true;

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/shared/trunk/maven-artifact-resolver/src/it/minimal-dependencies/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml?rev=808851&view=auto
==============================================================================
--- maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml (added)
+++ maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml Fri Aug 28 
11:32:23 2009
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>

Propchange: maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/shared/trunk/maven-artifact-resolver/src/it/settings.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision


Reply via email to