From 2d840d9ffe0ebfe949a09638ebf0d81f4a2c8f21 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 7 Jan 2014 09:28:05 +0000 Subject: use strict matching for model mapper git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1556158 13f79535-47bb-0310-9956-ffa450edef68 --- archiva-modules/plugins/maven2-repository/pom.xml | 3 +++ .../dependency/tree/maven2/TreeDependencyNodeVisitor.java | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'archiva-modules/plugins') diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index 0d04e7ae9..b321f1dbb 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -263,6 +263,9 @@ org.sonatype.aether.util, org.sonatype.aether.util.artifact, org.modelmapper, + org.modelmapper.config, + org.modelmapper.convention, + org.modelmapper.spi, org.apache.archiva.maven2.model, org.sonatype.aether.util.graph.selector, org.apache.archiva.metadata.model.maven2, diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/TreeDependencyNodeVisitor.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/TreeDependencyNodeVisitor.java index 82c8aa873..56ab172d3 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/TreeDependencyNodeVisitor.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/dependency/tree/maven2/TreeDependencyNodeVisitor.java @@ -21,6 +21,7 @@ package org.apache.archiva.dependency.tree.maven2; import org.apache.archiva.maven2.model.Artifact; import org.apache.archiva.maven2.model.TreeEntry; import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; import org.sonatype.aether.graph.DependencyNode; import org.sonatype.aether.graph.DependencyVisitor; @@ -48,8 +49,8 @@ public class TreeDependencyNodeVisitor public boolean visitEnter( DependencyNode dependencyNode ) { - TreeEntry entry = new TreeEntry( - getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) ); + TreeEntry entry = + new TreeEntry( getModelMapper().map( dependencyNode.getDependency().getArtifact(), Artifact.class ) ); entry.getArtifact().setScope( dependencyNode.getDependency().getScope() ); entry.setParent( currentEntry ); currentEntry = entry; @@ -75,6 +76,11 @@ public class TreeDependencyNodeVisitor private static class ModelMapperHolder { private static ModelMapper MODEL_MAPPER = new ModelMapper(); + + static + { + MODEL_MAPPER.getConfiguration().setMatchingStrategy( MatchingStrategies.STRICT ); + } } protected ModelMapper getModelMapper() -- cgit v1.2.3