From cc96c2bc384c0397c2335f23b0af6ff04bd72a1d Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Mon, 3 Oct 2005 03:51:48 +0000 Subject: [PATCH] PR: MNG-1041 don't use active project if it is not the same dependency git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@293225 13f79535-47bb-0310-9956-ffa450edef68 --- .../project/DefaultMavenProjectHelper.java | 17 ++++++++++++++++- .../apache/maven/project/MavenProject.java | 2 +- .../maven/project/MavenProjectHelper.java | 19 +++++++++++++++++-- .../project/artifact/MavenMetadataSource.java | 7 ++++++- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java index 30218198b7..30f09dcfa9 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java @@ -1,5 +1,21 @@ package org.apache.maven.project; +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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 org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.model.Resource; @@ -10,7 +26,6 @@ import java.util.List; public class DefaultMavenProjectHelper implements MavenProjectHelper { - // requirement. private ArtifactFactory artifactFactory; diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java index 2aff0e1c66..b8c9bf28e7 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java @@ -703,7 +703,7 @@ public class MavenProject String type = artifact.getType(); // TODO: utilise type handler - return "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ); + return "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) || "test-jar".equals( type ); } // ---------------------------------------------------------------------- diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProjectHelper.java b/maven-project/src/main/java/org/apache/maven/project/MavenProjectHelper.java index aff2018087..6f80ccd353 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProjectHelper.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProjectHelper.java @@ -1,11 +1,26 @@ package org.apache.maven.project; +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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; import java.util.List; public interface MavenProjectHelper -{ - +{ String ROLE = MavenProjectHelper.class.getName(); void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile ); diff --git a/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java index bb9f4d8c9c..348b5deabe 100644 --- a/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java +++ b/maven-project/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java @@ -318,7 +318,12 @@ public class MavenMetadataSource MavenProject project = (MavenProject) projectReferences.get( refId ); if ( project != null && project.getArtifact() != null ) { - artifact = new ActiveProjectArtifact( project, artifact ); + // TODO: if not matching, we should get the correct artifact from that project (attached) + if ( project.getArtifact().getDependencyConflictId().equals( + artifact.getDependencyConflictId() ) ) + { + artifact = new ActiveProjectArtifact( project, artifact ); + } } }