mirror of https://github.com/apache/maven.git
[MNG-5840] The fix for parent version validation caused a regression in the parent version range
- With this change we basically unwind MNG-5840 for the rumoured validation in the workspace resolver when dealing with a parent version range. Not ideal but only way for now to retain the version range feature
This commit is contained in:
parent
ec14b8ad4c
commit
bd87258629
|
@ -47,6 +47,10 @@
|
|||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-builder-support</artifactId>
|
||||
|
|
|
@ -20,20 +20,9 @@
|
|||
*/
|
||||
|
||||
|
||||
import static org.apache.maven.model.building.Result.error;
|
||||
import static org.apache.maven.model.building.Result.newResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Dependency;
|
||||
|
@ -73,6 +62,20 @@
|
|||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.apache.maven.model.building.Result.error;
|
||||
import static org.apache.maven.model.building.Result.newResult;
|
||||
|
||||
/**
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
|
@ -921,15 +924,18 @@ private ModelData readParentLocally( Model childModel, ModelSource childSource,
|
|||
}
|
||||
if ( version != null && parent.getVersion() != null && !version.equals( parent.getVersion() ) )
|
||||
{
|
||||
//
|
||||
// If the parent version is a range we will let it through here as we do not have the classes
|
||||
// for determining if the parent is within the range in scope. This may lead to MNG-5840 style
|
||||
// regressions in the range, but without this the parent version range will not work at all.
|
||||
//
|
||||
|
||||
if ( !parent.getVersion().startsWith( "[" ) && !parent.getVersion().startsWith( "(" ) )
|
||||
try
|
||||
{
|
||||
// version skew drop back to resolution from the repository
|
||||
VersionRange parentRange = VersionRange.createFromVersionSpec( parent.getVersion() );
|
||||
if ( !parentRange.containsVersion( new DefaultArtifactVersion( version ) ) )
|
||||
{
|
||||
// version skew drop back to resolution from the repository
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch ( InvalidVersionSpecificationException e )
|
||||
{
|
||||
// invalid version range, so drop back to resolution from the repository
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue