mirror of https://github.com/apache/archiva.git
[MRM-731]
submitted by Jan Ancajas o fix project properties being left out during cloning of the archivaProject (with unit test) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755846 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
584031f68f
commit
ee7a83da1d
|
@ -65,6 +65,7 @@ public class ArchivaModelCloner
|
||||||
cloned.setPlugins( clonePlugins( model.getPlugins() ) );
|
cloned.setPlugins( clonePlugins( model.getPlugins() ) );
|
||||||
cloned.setReports( cloneReports( model.getReports() ) );
|
cloned.setReports( cloneReports( model.getReports() ) );
|
||||||
cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) );
|
cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) );
|
||||||
|
cloned.setProperties( clone(model.getProperties() ) );
|
||||||
|
|
||||||
return cloned;
|
return cloned;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,67 @@ public class EffectiveProjectModelFilterTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test before and after the properties are evaluated. pom snippet: <maven.version>2.0.5</maven.version>
|
||||||
|
* <wagon.version>1.0-beta-2</wagon.version> <plexus-security.version>1.0-alpha-10-SNAPSHOT</plexus-security.version>
|
||||||
|
*/
|
||||||
|
public void testEffectiveProjectProperty()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
initTestResolverFactory();
|
||||||
|
EffectiveProjectModelFilter filter = lookupEffective();
|
||||||
|
|
||||||
|
String pomFile = "/org/apache/maven/archiva/archiva/1.0-SNAPSHOT/archiva-1.0-SNAPSHOT.pom";
|
||||||
|
ArchivaProjectModel startModel = createArchivaProjectModel( DEFAULT_REPOSITORY + pomFile );
|
||||||
|
|
||||||
|
String plexusSecurityVersion = "1.0-alpha-10-SNAPSHOT";
|
||||||
|
String wagonVersion = "1.0-beta-2";
|
||||||
|
|
||||||
|
boolean passedPlexusVersionChecking = false;
|
||||||
|
boolean passedWagonVersionChecking = false;
|
||||||
|
|
||||||
|
List<Dependency> startDeps = startModel.getDependencyManagement();
|
||||||
|
for ( Dependency startDep : startDeps )
|
||||||
|
{
|
||||||
|
if ( "org.codehaus.plexus.security".equals( startDep.getGroupId() ) )
|
||||||
|
{
|
||||||
|
assertEquals( startDep.getVersion(), "${plexus-security.version}" );
|
||||||
|
}
|
||||||
|
else if ( "org.apache.maven.wagon".equals( startDep.getGroupId() ) )
|
||||||
|
{
|
||||||
|
assertEquals( startDep.getVersion(), "${wagon.version}" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArchivaProjectModel effectiveModel = filter.filter( startModel );
|
||||||
|
|
||||||
|
List<Dependency> effectiveDeps = effectiveModel.getDependencyManagement();
|
||||||
|
for ( Dependency dependency : effectiveDeps )
|
||||||
|
{
|
||||||
|
if ( "org.codehaus.plexus.security".equals( dependency.getGroupId() ) )
|
||||||
|
{
|
||||||
|
assertEquals( dependency.getVersion(), plexusSecurityVersion );
|
||||||
|
|
||||||
|
if ( !passedPlexusVersionChecking )
|
||||||
|
{
|
||||||
|
passedPlexusVersionChecking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( "org.apache.maven.wagon".equals( dependency.getGroupId() ) )
|
||||||
|
{
|
||||||
|
assertEquals( dependency.getVersion(), wagonVersion );
|
||||||
|
|
||||||
|
if ( !passedWagonVersionChecking )
|
||||||
|
{
|
||||||
|
passedWagonVersionChecking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
assertTrue( passedPlexusVersionChecking );
|
||||||
|
assertTrue( passedWagonVersionChecking );
|
||||||
|
}
|
||||||
|
|
||||||
private ProjectModelResolverFactory initTestResolverFactory()
|
private ProjectModelResolverFactory initTestResolverFactory()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue