[maven-invoker-plugin] branch MINVOKER-243 created (now 70e384e)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven-invoker-plugin] branch MINVOKER-243 created (now 70e384e)

Robert Scholte-8
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a change to branch MINVOKER-243
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git.


      at 70e384e  [MINVOKER-243] invoker:install doesn't copy transitive dependencies from reactor

This branch includes the following new commits:

     new 70e384e  [MINVOKER-243] invoker:install doesn't copy transitive dependencies from reactor

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Reply | Threaded
Open this post in threaded view
|

[maven-invoker-plugin] 01/01: [MINVOKER-243] invoker:install doesn't copy transitive dependencies from reactor

Robert Scholte-8
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MINVOKER-243
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 70e384e296d9f3c03b637f6f6f204a6af9a6ea5d
Author: rfscholte <[hidden email]>
AuthorDate: Fri Jan 11 14:02:18 2019 +0100

    [MINVOKER-243] invoker:install doesn't copy transitive dependencies from reactor
---
 .../invoker.properties                             | 18 +++++
 .../MINVOKER-243_install-reactor/module-a/pom.xml  | 32 +++++++++
 .../MINVOKER-243_install-reactor/module-b/pom.xml  | 39 +++++++++++
 src/it/MINVOKER-243_install-reactor/plugin/pom.xml | 59 ++++++++++++++++
 src/it/MINVOKER-243_install-reactor/pom.xml        | 80 ++++++++++++++++++++++
 src/it/MINVOKER-243_install-reactor/verify.groovy  | 29 ++++++++
 .../apache/maven/plugins/invoker/InstallMojo.java  | 23 ++++---
 7 files changed, 271 insertions(+), 9 deletions(-)

diff --git a/src/it/MINVOKER-243_install-reactor/invoker.properties b/src/it/MINVOKER-243_install-reactor/invoker.properties
new file mode 100644
index 0000000..e71f103
--- /dev/null
+++ b/src/it/MINVOKER-243_install-reactor/invoker.properties
@@ -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 = clean verify
diff --git a/src/it/MINVOKER-243_install-reactor/module-a/pom.xml b/src/it/MINVOKER-243_install-reactor/module-a/pom.xml
new file mode 100644
index 0000000..6fbab1e
--- /dev/null
+++ b/src/it/MINVOKER-243_install-reactor/module-a/pom.xml
@@ -0,0 +1,32 @@
+<?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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.maven.plugins.invoker</groupId>
+    <artifactId>minvoker251-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>minvoker251-a</artifactId>
+
+</project>
diff --git a/src/it/MINVOKER-243_install-reactor/module-b/pom.xml b/src/it/MINVOKER-243_install-reactor/module-b/pom.xml
new file mode 100644
index 0000000..5eb478b
--- /dev/null
+++ b/src/it/MINVOKER-243_install-reactor/module-b/pom.xml
@@ -0,0 +1,39 @@
+<?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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.maven.plugins.invoker</groupId>
+    <artifactId>minvoker251-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>minvoker251-b</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.invoker</groupId>
+      <artifactId>minvoker251-a</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/src/it/MINVOKER-243_install-reactor/plugin/pom.xml b/src/it/MINVOKER-243_install-reactor/plugin/pom.xml
new file mode 100644
index 0000000..66a42f3
--- /dev/null
+++ b/src/it/MINVOKER-243_install-reactor/plugin/pom.xml
@@ -0,0 +1,59 @@
+<?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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.maven.plugins.invoker</groupId>
+    <artifactId>minvoker251-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>minvoker251-plugin</artifactId>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <configuration>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+        </configuration>
+        <executions>
+          <execution>
+            <id>itests</id>
+            <goals>
+              <goal>install</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.invoker</groupId>
+      <artifactId>minvoker251-b</artifactId>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/src/it/MINVOKER-243_install-reactor/pom.xml b/src/it/MINVOKER-243_install-reactor/pom.xml
new file mode 100644
index 0000000..21881e3
--- /dev/null
+++ b/src/it/MINVOKER-243_install-reactor/pom.xml
@@ -0,0 +1,80 @@
+<?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 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.invoker</groupId>
+  <artifactId>minvoker251-parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <url>https://issues.apache.org/jira/browse/MINVOKER-243</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven.plugins.invoker</groupId>
+        <artifactId>minvoker251-a</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.plugins.invoker</groupId>
+        <artifactId>minvoker251-b</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.maven.plugins.invoker</groupId>
+        <artifactId>minvoker251-plugin</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-invoker-plugin</artifactId>
+          <version>@project.version@</version>
+          <configuration>
+            <properties>
+              <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
+              <https.protocols>${https.protocols}</https.protocols>
+            </properties>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+  
+  <modules>
+    <module>module-a</module>
+    <module>module-b</module>
+    <module>plugin</module>
+  </modules>
+</project>
diff --git a/src/it/MINVOKER-243_install-reactor/verify.groovy b/src/it/MINVOKER-243_install-reactor/verify.groovy
new file mode 100644
index 0000000..3f06315
--- /dev/null
+++ b/src/it/MINVOKER-243_install-reactor/verify.groovy
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+def localRepo = new File(basedir,'plugin/target/local-repo')
+
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-a/1.0-SNAPSHOT/minvoker251-a-1.0-SNAPSHOT.pom').exists()
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-a/1.0-SNAPSHOT/minvoker251-a-1.0-SNAPSHOT.jar').exists()
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-b/1.0-SNAPSHOT/minvoker251-b-1.0-SNAPSHOT.pom').exists()
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-b/1.0-SNAPSHOT/minvoker251-b-1.0-SNAPSHOT.jar').exists()
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-parent/1.0-SNAPSHOT/minvoker251-parent-1.0-SNAPSHOT.pom').exists()
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-plugin/1.0-SNAPSHOT/minvoker251-plugin-1.0-SNAPSHOT.pom').exists()
+assert new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker251-plugin/1.0-SNAPSHOT/minvoker251-plugin-1.0-SNAPSHOT.jar').exists()
+
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java b/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
index 79ace5a..e00fa6b 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
@@ -413,11 +413,9 @@ public class InstallMojo
     private void installProjectDependencies( MavenProject mvnProject, Collection<MavenProject> reactorProjects )
         throws MojoExecutionException
     {
-        // keep track if we have passed mvnProject in reactorProjects
-        boolean foundCurrent = false;
-
         // ... into dependencies that were resolved from reactor projects ...
         Collection<String> dependencyProjects = new LinkedHashSet<String>();
+        collectAllProjectReferences( mvnProject, dependencyProjects );
 
         // index available reactor projects
         Map<String, MavenProject> projects = new HashMap<String, MavenProject>( reactorProjects.size() );
@@ -427,12 +425,6 @@ public class InstallMojo
                 reactorProject.getGroupId() + ':' + reactorProject.getArtifactId() + ':' + reactorProject.getVersion();
 
             projects.put( projectId, reactorProject );
-
-            // only add projects used by the current project
-            if ( isInProjectReferences( project.getProjectReferences().values(), reactorProject ) )
-            {
-                dependencyProjects.add( projectId );
-            }
         }
 
         // group transitive dependencies (even those that don't contribute to the class path like POMs) ...
@@ -476,6 +468,19 @@ public class InstallMojo
             throw new MojoExecutionException( "Failed to install project dependencies: " + mvnProject, e );
         }
     }
+    
+    protected void collectAllProjectReferences( MavenProject project, Collection<String> dependencyProjects )
+    {
+        for ( MavenProject reactorProject : project.getProjectReferences().values() )
+        {
+            String projectId =
+                reactorProject.getGroupId() + ':' + reactorProject.getArtifactId() + ':' + reactorProject.getVersion();
+            if ( dependencyProjects.add( projectId ) )
+            {
+                collectAllProjectReferences( reactorProject, dependencyProjects );
+            }
+        }
+    }
 
     protected boolean isInProjectReferences( Collection<MavenProject> references, MavenProject project )
     {