You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gb...@apache.org on 2017/07/01 14:02:00 UTC

svn commit: r1800508 - in /maven/plugins/trunk/maven-assembly-plugin/src: it/projects/repositories/massembly-855/ it/projects/repositories/massembly-855/child/ it/projects/repositories/massembly-855/child/src/ it/projects/repositories/massembly-855/chi...

Author: gboue
Date: Sat Jul  1 14:01:59 2017
New Revision: 1800508

URL: http://svn.apache.org/viewvc?rev=1800508&view=rev
Log:
[MASSEMBLY-855] Remote repositories ignored in a multi-module project

All the project repositories (and not just the session) need to be considered when a repository is assembled.

Added:
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.jar   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom   (with props)
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml?rev=1800508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml Sat Jul  1 14:01:59 2017
@@ -0,0 +1,64 @@
+<?xml version='1.0'?>
+
+<!--
+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 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>
+  <parent>
+    <groupId>org.apache.maven.plugin.assembly.test</groupId>
+    <artifactId>massembly-855</artifactId>
+    <version>1</version>
+  </parent>
+  <artifactId>child</artifactId>
+  <packaging>pom</packaging>
+  <properties>
+    <it.repo.url>file://${project.basedir}/../remote-repository</it.repo.url>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.assembly.it</groupId>
+      <artifactId>massembly-855</artifactId>
+      <version>1.0</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <descriptors>
+            <descriptor>src/assembly/repository.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>create-repository</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml?rev=1800508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml Sat Jul  1 14:01:59 2017
@@ -0,0 +1,34 @@
+<?xml version='1.0'?>
+
+<!--
+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.
+-->
+
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+  <id>repository</id>
+  <formats>
+    <format>dir</format>
+  </formats>
+  <repositories>
+    <repository>
+      <includeMetadata>true</includeMetadata>
+      <outputDirectory>maven-repository</outputDirectory>
+    </repository>
+  </repositories>
+</assembly>

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/child/src/assembly/repository.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties?rev=1800508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties Sat Jul  1 14:01:59 2017
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=package

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml?rev=1800508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml Sat Jul  1 14:01:59 2017
@@ -0,0 +1,48 @@
+<?xml version='1.0'?>
+
+<!--
+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 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>
+  <parent>
+    <groupId>org.apache.maven.plugin.assembly.test</groupId>
+    <artifactId>it-project-parent</artifactId>
+    <version>1</version>
+  </parent>
+  <artifactId>massembly-855</artifactId>
+  <packaging>pom</packaging>
+  <description>
+    Tests that repository building works when a custom repository is declared in a parent POM with the Assembly Plugin
+    used in a child POM.
+  </description>
+  <properties>
+    <it.repo.url>file://${project.basedir}/remote-repository</it.repo.url>
+  </properties>
+  <repositories>
+    <repository>
+      <id>it-repo</id>
+      <url>${it.repo.url}</url>
+    </repository>
+  </repositories>
+  <modules>
+    <module>child</module>
+  </modules>
+</project>

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.jar?rev=1800508&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom?rev=1800508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom Sat Jul  1 14:01:59 2017
@@ -0,0 +1,34 @@
+<?xml version='1.0'?>
+
+<!--
+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 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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.assembly.it</groupId>
+  <artifactId>massembly-855</artifactId>
+  <version>1.0</version>
+  <distributionManagement>
+    <repository>
+	  <id>test-repo</id>
+	  <url>file://${project.basedir}/repo</url>
+	</repository>
+  </distributionManagement>
+</project>

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/remote-repository/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh?rev=1800508&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh Sat Jul  1 14:01:59 2017
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+String repoDir = "child/target/child-1-repository/child-1/maven-repository";
+
+File[] filesToCheck = new File[] {
+  new File( basedir, repoDir + "/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.jar" ),
+  new File( basedir, repoDir + "/org/apache/maven/plugins/assembly/it/massembly-855/1.0/massembly-855-1.0.pom" )
+};
+
+for ( File file : filesToCheck )
+{
+  if ( !file.exists() )
+  {
+    System.out.println( "File doesn't exist: " + file );
+    return false;
+  }
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/repositories/massembly-855/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java?rev=1800508&r1=1800507&r2=1800508&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoBuilderConfigSourceWrapper.java Sat Jul  1 14:01:59 2017
@@ -21,6 +21,7 @@ package org.apache.maven.plugins.assembl
 
 import org.apache.maven.plugins.assembly.AssemblerConfigurationSource;
 import org.apache.maven.plugins.assembly.repository.RepositoryBuilderConfigSource;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
 
@@ -47,6 +48,9 @@ public class RepoBuilderConfigSourceWrap
     @Override
     public ProjectBuildingRequest getProjectBuildingRequest()
     {
-        return configSource.getMavenSession().getProjectBuildingRequest();
+        ProjectBuildingRequest pbr =
+            new DefaultProjectBuildingRequest( configSource.getMavenSession().getProjectBuildingRequest() );
+        pbr.setRemoteRepositories( getProject().getRemoteArtifactRepositories() );
+        return pbr;
     }
 }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java?rev=1800508&r1=1800507&r2=1800508&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java Sat Jul  1 14:01:59 2017
@@ -44,6 +44,7 @@ import org.apache.maven.plugins.assembly
 import org.apache.maven.plugins.assembly.model.Repository;
 import org.apache.maven.plugins.assembly.resolved.AssemblyId;
 import org.apache.maven.plugins.assembly.utils.FilterUtils;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.repository.RepositorySystem;
@@ -335,16 +336,18 @@ public class DefaultDependencyResolver
             {
                 try
                 {
+                    ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest( buildingRequest );
+                    pbr.setRemoteRepositories( project.getRemoteArtifactRepositories() );
                     Iterable<ArtifactResult> artifactResults =
-                        dependencyResolver.resolveDependencies( buildingRequest, project.getModel(), scopeFilter );
-                    
+                        dependencyResolver.resolveDependencies( pbr, project.getModel(), scopeFilter );
+
                     dependencyArtifacts = new HashSet<Artifact>();
-                    
+
                     for ( ArtifactResult artifactResult : artifactResults )
                     {
                         dependencyArtifacts.add( artifactResult.getArtifact() );
                     }
-                    
+
                     project.setDependencyArtifacts( dependencyArtifacts );
                 }
                 catch ( final DependencyResolverException e )