diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java b/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java index b044fc3a28..cfe16fdc32 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/Artifact.java @@ -35,6 +35,9 @@ import org.apache.maven.artifact.versioning.VersionRange; public interface Artifact extends Comparable { + + String RELEASE_VERSION = "RELEASE"; + String LATEST_VERSION = "LATEST"; String SNAPSHOT_VERSION = "SNAPSHOT"; @@ -59,8 +62,6 @@ public interface Artifact String SCOPE_IMPORT = "import"; // Used to import dependencyManagement dependencies - String RELEASE_VERSION = "RELEASE"; - String getGroupId(); String getArtifactId(); diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java index 0e9fbb0a69..74eae68b85 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java @@ -179,6 +179,7 @@ public class DefaultWagonManager if ( artifact.isResolved() ) { + artifact.setRepository( repository ); break; } } diff --git a/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java index 94b6282898..30b4e42ac9 100644 --- a/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java +++ b/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java @@ -46,9 +46,7 @@ public class ReactorArtifactRepository { if ( "pom".equals( artifact.getType() ) ) { - artifact.setFile( project.getFile() ); - - artifact.setResolved( true ); + resolve( artifact, project.getFile() ); } else { @@ -62,9 +60,7 @@ public class ReactorArtifactRepository // If we are running before the packaging phase there is going to be no archive anyway, but if we are running prior to package // we shouldn't even take the archive anyway. - artifact.setFile( projectArtifact.getFile() ); - - artifact.setResolved( true ); + resolve( artifact, projectArtifact.getFile() ); } else if ( isProjectOutputValid( project ) ) { @@ -81,9 +77,7 @@ public class ReactorArtifactRepository if ( classesDir.isDirectory() ) { - artifact.setFile( classesDir ); - - artifact.setResolved( true ); + resolve( artifact, classesDir ); } } } @@ -92,6 +86,15 @@ public class ReactorArtifactRepository return artifact; } + private void resolve( Artifact artifact, File file ) + { + artifact.setFile( file ); + + artifact.setResolved( true ); + + artifact.setRepository( this ); + } + @Override public String getId() { diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index 07ac198740..4032d72d20 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -209,7 +209,9 @@ public class DefaultProjectBuilder "Error resolving project artifact: " + e.getMessage(), e ); } - return build( artifact.getFile(), false, configuration ); + boolean localProject = artifact.getRepository() != null && "reactor".equals( artifact.getRepository().getId() ); + + return build( artifact.getFile(), localProject, configuration ); } /**