Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSHARED-994 - fix collect dependencies when artifact has 'war' packaging #7

Merged
merged 1 commit into from Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/it/verbose-war/expected-default.txt
@@ -0,0 +1,29 @@
org.apache.maven.its.dependency-tree:verbose:war: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-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.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
+- org.apache.maven:maven-profile:jar:2.0.4:test
+- org.apache.maven:maven-model:jar:2.0.7:runtime
\- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
+- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
+- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile
+- org.apache.xmlgraphics:batik-css:jar:1.7:compile
+- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
+- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
+- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
+- org.apache.xmlgraphics:batik-parser:jar:1.7:compile
+- org.apache.xmlgraphics:batik-script:jar:1.7:compile
| \- org.apache.xmlgraphics:batik-js:jar:1.7:compile
+- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
+- org.apache.xmlgraphics:batik-util:jar:1.7:compile
+- org.apache.xmlgraphics:batik-xml:jar:1.7:compile
+- xalan:xalan:jar:2.6.0:compile
+- xml-apis:xml-apis:jar:1.3.04:compile
\- xml-apis:xml-apis-ext:jar:1.3.04:compile
93 changes: 93 additions & 0 deletions src/it/verbose-war/expected-verbose.txt
@@ -0,0 +1,93 @@
org.apache.maven.its.dependency-tree:verbose:war: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-model:jar:2.0.5:test - version managed from 2.0.6; scope managed from compile; omitted for conflict with 2.0.7)
| | +- (org.codehaus.plexus:plexus-utils:jar:1.4.1:compile - omitted for duplicate)
| | \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
| +- (org.apache.maven:maven-profile:jar:2.0.6:compile - omitted for conflict with 2.0.4)
| +- (org.apache.maven:maven-model:jar:2.0.5:test - version managed from 2.0.6; scope managed from compile; omitted for conflict with 2.0.7)
| +- org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
| | +- org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
| | | \- (org.codehaus.plexus:plexus-utils:jar:1.4.1:compile - omitted for duplicate)
| | +- (org.codehaus.plexus:plexus-utils:jar:1.4.1:compile - omitted for duplicate)
| | +- (org.apache.maven:maven-artifact:jar:2.0.6:compile - omitted for exclusion by org.apache.maven:maven-project)
| | +- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
| | \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
| | \- (org.codehaus.plexus:plexus-utils:jar:1.0.4:compile - omitted for conflict with 1.4.1)
| +- org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
| | +- (org.codehaus.plexus:plexus-utils:jar:1.4.1:compile - omitted for duplicate)
| | \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
| +- org.codehaus.plexus:plexus-utils:jar:1.4.1:compile
| +- (org.apache.maven:maven-artifact:jar:2.0.6:compile - omitted for exclusion by org.apache.maven:maven-project)
| \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
| +- junit:junit:jar:3.8.1:compile
| +- (org.codehaus.plexus:plexus-utils:jar:1.0.4:compile - omitted for conflict with 1.4.1)
| \- classworlds:classworlds:jar:1.1-alpha-2:compile
+- org.apache.maven:maven-profile:jar:2.0.4:test (scope not updated to compile)
| +- (org.apache.maven:maven-model:jar:2.0.5:test - version managed from 2.0.4; scope managed from compile; omitted for conflict with 2.0.7)
| +- (org.codehaus.plexus:plexus-utils:jar:1.1:test - omitted for conflict with 1.4.1)
| \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:test - omitted for conflict with 1.0-alpha-9-stable-1)
+- org.apache.maven:maven-model:jar:2.0.7:runtime
| \- (org.codehaus.plexus:plexus-utils:jar:1.4.1:runtime - omitted for duplicate)
\- org.apache.xmlgraphics:batik-bridge:jar:1.7:compile
+- org.apache.xmlgraphics:batik-anim:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-dom:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-ext:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-parser:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| +- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
| \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile
| \- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-css:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-ext:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| +- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
| \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-dom:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-css:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-ext:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-xml:jar:1.7:compile - omitted for duplicate)
| +- (xalan:xalan:jar:2.6.0:compile - omitted for duplicate)
| +- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
| \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
| \- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-gvt:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-bridge:jar:1.7:compile - omitted for cycle)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| \- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-parser:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| \- (org.apache.xmlgraphics:batik-xml:jar:1.7:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-script:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-bridge:jar:1.7:compile - omitted for cycle)
| +- (org.apache.xmlgraphics:batik-dom:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-ext:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| +- org.apache.xmlgraphics:batik-js:jar:1.7:compile
| | \- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
| \- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-svg-dom:jar:1.7:compile
| +- (org.apache.xmlgraphics:batik-anim:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-awt-util:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-css:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-dom:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-ext:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-parser:jar:1.7:compile - omitted for duplicate)
| +- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
| +- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for duplicate)
| \- (xml-apis:xml-apis-ext:jar:1.3.04:compile - omitted for duplicate)
+- org.apache.xmlgraphics:batik-util:jar:1.7:compile
+- org.apache.xmlgraphics:batik-xml:jar:1.7:compile
| \- (org.apache.xmlgraphics:batik-util:jar:1.7:compile - omitted for duplicate)
+- xalan:xalan:jar:2.6.0:compile
| \- (xml-apis:xml-apis:jar:1.0.b2:compile - omitted for conflict with 1.3.04)
+- xml-apis:xml-apis:jar:1.3.04:compile
\- xml-apis:xml-apis-ext:jar:1.3.04:compile
20 changes: 20 additions & 0 deletions src/it/verbose-war/invoker.properties
@@ -0,0 +1,20 @@
# 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 validate
# Maven 2 makes wrong resolution
invoker.maven.version = 3.0+
114 changes: 114 additions & 0 deletions src/it/verbose-war/pom.xml
@@ -0,0 +1,114 @@
<?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-tree</groupId>
<artifactId>verbose</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>VerboseTest</name>
<description>
Test verbose dependency-tree with actual Maven version through old dependency:tree 2.4, before the feature was removed.
</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.6</version>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-profile</artifactId>
<version>2.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.7</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.dependency-tree</groupId>
<artifactId>graph-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<id>verbose</id>
<phase>validate</phase>
<configuration>
<outputFile>target/tree-verbose.txt</outputFile>
<verbose>true</verbose>
</configuration>
<goals>
<goal>graph</goal>
</goals>
</execution>
<execution>
<id>default</id>
<phase>validate</phase>
<configuration>
<outputFile>target/tree-default.txt</outputFile>
</configuration>
<goals>
<goal>graph</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
30 changes: 30 additions & 0 deletions src/it/verbose-war/verify.groovy
@@ -0,0 +1,30 @@
/*
* 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 actual = new File( basedir, "target/tree-verbose.txt" ).readLines()
// omitted for cycle not supported anymore, but should probably return
// omitted for exclusion is not supported yet
def expected = new File( basedir, "expected-verbose.txt" ).readLines().findAll{!((it.contains('omitted for cycle')||it.contains('omitted for exclusion')))}

assert actual.equals( expected )

actual = new File( basedir, "target/tree-default.txt" ).readLines()
expected = new File( basedir, "expected-default.txt" ).readLines()

assert actual.equals( expected )
Expand Up @@ -133,7 +133,7 @@ public DependencyNode collectDependencyGraph( ProjectBuildingRequest buildingReq
exceptionHandler );

CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot( new org.eclipse.aether.graph.Dependency( aetherArtifact, "" ) );
collectRequest.setRootArtifact( aetherArtifact );
collectRequest.setRepositories( aetherRepos );

org.eclipse.aether.artifact.ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
Expand Down