maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1791410 - in /maven/plugins/trunk/maven-dependency-plugin: ./ src/it/projects/tree-multimodule/ src/it/projects/tree-multimodule/module-a/ src/it/projects/tree-multimodule/module-b/ src/main/java/org/apache/maven/plugins/dependency/tree/
Date Fri, 14 Apr 2017 20:34:32 GMT
Author: michaelo
Date: Fri Apr 14 20:34:31 2017
New Revision: 1791410

URL: http://svn.apache.org/viewvc?rev=1791410&view=rev
Log:
[MDEP-409] dependency:tree fails for a multi-module project where one module depends on another
and "mvn install" has not been run yet

Submitted-by: RĂ©da Housni Alaoui <reda.housnialaoui@gmail.com>

This closes #111

Added:
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/expected.txt
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/invoker.properties
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/expected.txt
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/expected.txt
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/test.properties
    maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/verify.bsh
Modified:
    maven/plugins/trunk/maven-dependency-plugin/pom.xml
    maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java

Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=1791410&r1=1791409&r2=1791410&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Fri Apr 14 20:34:31 2017
@@ -305,6 +305,9 @@ under the License.
               -->
               <exclude>src/it/projects/tree/expected.txt</exclude>
               <exclude>src/it/projects/tree-includes/expected.txt</exclude>
+              <exclude>src/it/projects/tree-multimodule/expected.txt</exclude>
+              <exclude>src/it/projects/tree-multimodule/module-a/expected.txt</exclude>
+              <exclude>src/it/projects/tree-multimodule/module-b/expected.txt</exclude>
               <exclude>src/it/projects/tree-verbose/expected.txt</exclude>
             </excludes>
           </configuration>

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/expected.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/expected.txt?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/expected.txt
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/expected.txt
Fri Apr 14 20:34:31 2017
@@ -0,0 +1 @@
+org.apache.maven.its.dependency:tree-multimodule:pom:1.0-SNAPSHOT

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/invoker.properties?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/invoker.properties
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/invoker.properties
Fri Apr 14 20:34:31 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 = ${project.groupId}:${project.artifactId}:${project.version}:tree

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/expected.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/expected.txt?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/expected.txt
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/expected.txt
Fri Apr 14 20:34:31 2017
@@ -0,0 +1,14 @@
+org.apache.maven.its.dependency:tree-multimodule-module-a:jar:1.0-SNAPSHOT
+\- org.apache.maven:maven-project:jar:2.0.6:compile
+   +- org.apache.maven:maven-settings:jar:2.0.6:compile
+   +- org.apache.maven:maven-profile:jar:2.0.6:compile
+   +- org.apache.maven:maven-model:jar:2.0.6:compile
+   +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
+   |  +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
+   |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
+   +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
+   +- org.codehaus.plexus:plexus-utils:jar:1.4.1:compile
+   +- org.apache.maven:maven-artifact:jar:2.0.6:compile
+   \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
+      +- junit:junit:jar:3.8.1:compile
+      \- classworlds:classworlds:jar:1.1-alpha-2:compile

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/pom.xml?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/pom.xml
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-a/pom.xml
Fri Apr 14 20:34:31 2017
@@ -0,0 +1,48 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.its.dependency</groupId>
+    <artifactId>tree-multimodule</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <name>MultimoduleTest Module A</name>
+
+  <artifactId>tree-multimodule-module-a</artifactId>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+
+</project>

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/expected.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/expected.txt?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/expected.txt
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/expected.txt
Fri Apr 14 20:34:31 2017
@@ -0,0 +1,15 @@
+org.apache.maven.its.dependency:tree-multimodule-module-b:jar:1.0-SNAPSHOT
+\- org.apache.maven.its.dependency:tree-multimodule-module-a:jar:1.0-SNAPSHOT:compile
+   \- org.apache.maven:maven-project:jar:2.0.6:compile
+      +- org.apache.maven:maven-settings:jar:2.0.6:compile
+      +- org.apache.maven:maven-profile:jar:2.0.6:compile
+      +- org.apache.maven:maven-model:jar:2.0.6:compile
+      +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
+      |  +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
+      |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
+      +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
+      +- org.codehaus.plexus:plexus-utils:jar:1.4.1:compile
+      +- org.apache.maven:maven-artifact:jar:2.0.6:compile
+      \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
+         +- junit:junit:jar:3.8.1:compile
+         \- classworlds:classworlds:jar:1.1-alpha-2:compile

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/pom.xml?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/pom.xml
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/module-b/pom.xml
Fri Apr 14 20:34:31 2017
@@ -0,0 +1,48 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.maven.its.dependency</groupId>
+    <artifactId>tree-multimodule</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <name>MultimoduleTest Module B</name>
+
+  <artifactId>tree-multimodule-module-b</artifactId>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its.dependency</groupId>
+      <artifactId>tree-multimodule-module-a</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/pom.xml?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/pom.xml (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/pom.xml Fri
Apr 14 20:34:31 2017
@@ -0,0 +1,45 @@
+<?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.its.dependency</groupId>
+  <artifactId>tree-multimodule</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>MultimoduleTest</name>
+  <description>
+    Test dependency:tree on multimodule project
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <modules>
+    <module>module-a</module>
+    <module>module-b</module>
+  </modules>
+
+</project>

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/test.properties?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/test.properties
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/test.properties
Fri Apr 14 20:34:31 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.
+
+outputFile = target/tree.txt

Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/verify.bsh?rev=1791410&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/verify.bsh
(added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/tree-multimodule/verify.bsh
Fri Apr 14 20:34:31 2017
@@ -0,0 +1,63 @@
+/*
+ * 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.*;
+
+import org.codehaus.plexus.util.*;
+
+String actual = FileUtils.fileRead( new File( basedir, "target/tree.txt" ) );
+String expected = FileUtils.fileRead( new File( basedir, "expected.txt" ) );
+
+actual = actual.replaceAll( "[\n\r]+", "\n" );
+expected = expected.replaceAll( "[\n\r]+", "\n" );
+
+System.out.println( "Checking root dependency tree..." );
+
+if ( !actual.equals( expected ) )
+{
+    throw new Exception( "Unexpected root dependency tree" );
+}
+
+actual = FileUtils.fileRead( new File( basedir, "module-a/target/tree.txt" ) );
+expected = FileUtils.fileRead( new File( basedir, "module-a/expected.txt" ) );
+
+actual = actual.replaceAll( "[\n\r]+", "\n" );
+expected = expected.replaceAll( "[\n\r]+", "\n" );
+
+System.out.println( "Checking module-a dependency tree..." );
+
+if ( !actual.equals( expected ) )
+{
+    throw new Exception( "Unexpected module-a dependency tree" );
+}
+
+actual = FileUtils.fileRead( new File( basedir, "module-b/target/tree.txt" ) );
+expected = FileUtils.fileRead( new File( basedir, "module-b/expected.txt" ) );
+
+actual = actual.replaceAll( "[\n\r]+", "\n" );
+expected = expected.replaceAll( "[\n\r]+", "\n" );
+
+System.out.println( "Checking module-b dependency tree..." );
+
+if ( !actual.equals( expected ) )
+{
+    throw new Exception( "Unexpected module-b dependency tree" );
+}
+
+return true;

Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java?rev=1791410&r1=1791409&r2=1791410&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/tree/TreeMojo.java
Fri Apr 14 20:34:31 2017
@@ -67,7 +67,7 @@ import org.apache.maven.shared.dependenc
  * @version $Id$
  * @since 2.0-alpha-5
  */
-@Mojo( name = "tree", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true
)
+@Mojo( name = "tree", requiresDependencyCollection = ResolutionScope.TEST, threadSafe = true
)
 public class TreeMojo
     extends AbstractMojo
 {
@@ -83,6 +83,12 @@ public class TreeMojo
     private MavenSession session;
 
     /**
+     * Contains the full list of projects in the reactor.
+     */
+    @Parameter( defaultValue = "${reactorProjects}", readonly = true, required = true )
+    private List<MavenProject> reactorProjects;
+
+    /**
      * The dependency tree builder to use.
      */
     @Component( hint = "default" )
@@ -234,7 +240,7 @@ public class TreeMojo
             
             // non-verbose mode use dependency graph component, which gives consistent results
with Maven version
             // running
-            rootNode = dependencyGraphBuilder.buildDependencyGraph( buildingRequest, artifactFilter
);
+            rootNode = dependencyGraphBuilder.buildDependencyGraph( buildingRequest, artifactFilter,
reactorProjects );
 
             dependencyTreeString = serializeDependencyTree( rootNode );
 



Mime
View raw message