[MNG-4779] NullPointerException thrown during dependency resolution when dependency with range occurs more than once in the dirty tree

[MNG-4781] Can't deploy to Nexus staging repository


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@990771 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-08-30 11:17:36 +00:00
parent 8c13978af5
commit 1cbef71e7b
3 changed files with 5 additions and 15 deletions

View File

@ -19,7 +19,6 @@ package org.apache.maven.repository.internal;
* under the License. * under the License.
*/ */
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
@ -366,18 +365,13 @@ public class DefaultArtifactDescriptorReader
Map<String, String> props = null; Map<String, String> props = null;
if ( system ) if ( system )
{ {
props = Collections.singletonMap( ArtifactProperties.LACKS_DESCRIPTOR, Boolean.TRUE.toString() ); props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
} }
Artifact artifact = Artifact artifact =
new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
dependency.getVersion(), props, stereotype ); dependency.getVersion(), props, stereotype );
if ( system )
{
artifact = artifact.setFile( new File( dependency.getSystemPath() ) );
}
List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() ); List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
{ {

View File

@ -142,7 +142,8 @@ public class RepositoryUtils
Map<String, String> props = null; Map<String, String> props = null;
if ( org.apache.maven.artifact.Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) ) if ( org.apache.maven.artifact.Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
{ {
props = Collections.singletonMap( ArtifactProperties.LACKS_DESCRIPTOR, Boolean.TRUE.toString() ); String localPath = ( artifact.getFile() != null ) ? artifact.getFile().getPath() : "";
props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, localPath );
} }
Artifact result = Artifact result =
@ -270,18 +271,13 @@ public class RepositoryUtils
Map<String, String> props = null; Map<String, String> props = null;
if ( system ) if ( system )
{ {
props = Collections.singletonMap( ArtifactProperties.LACKS_DESCRIPTOR, Boolean.TRUE.toString() ); props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
} }
Artifact artifact = Artifact artifact =
new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
dependency.getVersion(), props, stereotype ); dependency.getVersion(), props, stereotype );
if ( system )
{
artifact = artifact.setFile( new File( dependency.getSystemPath() ) );
}
List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() ); List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
{ {

View File

@ -50,7 +50,7 @@
<cipherVersion>1.4</cipherVersion> <cipherVersion>1.4</cipherVersion>
<modelloVersion>1.4</modelloVersion> <modelloVersion>1.4</modelloVersion>
<jxpathVersion>1.3</jxpathVersion> <jxpathVersion>1.3</jxpathVersion>
<aetherVersion>1.1.1</aetherVersion> <aetherVersion>1.2</aetherVersion>
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile> <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
</properties> </properties>