MNG-4221: putting the repository and compat modules together while completely hide the legacy implementation

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@789541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-06-30 03:04:34 +00:00
parent 979b1b0c04
commit fb1c53d6da
34 changed files with 163 additions and 14 deletions

View File

@ -57,6 +57,12 @@
<version>1.2_Java1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jsecurity</groupId>
<artifactId>jsecurity</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,7 @@
package org.apache.maven.artifact.resolver;
@Deprecated
public interface ArtifactCollector
extends org.apache.maven.repository.legacy.resolver.LegacyArtifactCollector
{
}

View File

@ -24,7 +24,7 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.repository.legacy.resolver.DefaultArtifactCollector;
import org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector;
/**
* Specific problems during resolution that we want to account for:
@ -162,7 +162,7 @@ public class ArtifactResolutionResult
/**
* @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by
* {@link #getVersionRangeViolation(int)} but it's not used like that in
* {@link DefaultArtifactCollector}
* {@link DefaultLegacyArtifactCollector}
*/
public ArtifactResolutionResult addVersionRangeViolation( Exception e )
{

View File

@ -0,0 +1,11 @@
package org.apache.maven.artifact.resolver;
import org.codehaus.plexus.component.annotations.Component;
@Deprecated
@Component(role=ArtifactCollector.class)
public class DefaultArtifactCollector
extends org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector
implements ArtifactCollector
{
}

View File

@ -37,7 +37,6 @@ import org.apache.maven.artifact.repository.metadata.Versioning;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.repository.legacy.WagonManager;
import org.apache.maven.repository.legacy.metadata.ArtifactMetadata;
import org.apache.maven.repository.legacy.resolver.ArtifactCollector;
import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver;
import org.apache.maven.repository.legacy.resolver.transform.ArtifactTransformationManager;
import org.apache.maven.wagon.ResourceDoesNotExistException;

View File

@ -0,0 +1,87 @@
package org.apache.maven.execution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.util.IOUtil;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Describes runtime information about the application.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
@Deprecated
@Component(role=RuntimeInformation.class)
public class DefaultRuntimeInformation
implements RuntimeInformation, Initializable
{
private static final String MAVEN_GROUPID = "org.apache.maven";
private static final String MAVEN_PROPERTIES = "META-INF/maven/" + MAVEN_GROUPID + "/maven-core/pom.properties";
private ArtifactVersion applicationVersion;
public ArtifactVersion getApplicationVersion()
{
return applicationVersion;
}
public void initialize()
throws InitializationException
{
InputStream resourceAsStream = null;
try
{
Properties properties = new Properties();
resourceAsStream = getClass().getClassLoader().getResourceAsStream( MAVEN_PROPERTIES );
if ( resourceAsStream == null )
{
throw new IllegalStateException( "Unable to find Maven properties in classpath: " + MAVEN_PROPERTIES );
}
properties.load( resourceAsStream );
String property = properties.getProperty( "version" );
if ( property == null )
{
throw new InitializationException( "maven-core properties did not include the version" );
}
applicationVersion = new DefaultArtifactVersion( property );
}
catch ( IOException e )
{
throw new InitializationException( "Unable to read properties file from maven-core", e );
}
finally
{
IOUtil.close( resourceAsStream );
}
}
}

View File

@ -0,0 +1,33 @@
package org.apache.maven.execution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.versioning.ArtifactVersion;
/**
* Describes runtime information about the application.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
*/
public interface RuntimeInformation
{
ArtifactVersion getApplicationVersion();
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.repository.legacy;
package org.apache.maven.repository;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -51,6 +51,7 @@ import org.apache.maven.repository.MetadataResolutionRequest;
import org.apache.maven.repository.MetadataResolutionResult;
import org.apache.maven.repository.MirrorBuilder;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.legacy.WagonManager;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.events.TransferListener;

View File

@ -30,7 +30,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.CyclicDependencyException;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.repository.legacy.resolver.DefaultArtifactCollector;
import org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector;
/**
@ -166,7 +166,7 @@ public class MetadataResolutionResult
/**
* @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by
* {@link #getVersionRangeViolation(int)} but it's not used like that in
* {@link DefaultArtifactCollector}
* {@link DefaultLegacyArtifactCollector}
*/
public MetadataResolutionResult addVersionRangeViolation( Exception e )
{

View File

@ -54,9 +54,9 @@ import org.codehaus.plexus.logging.Logger;
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @author Jason van Zyl
*/
@Component(role=ArtifactCollector.class)
public class DefaultArtifactCollector
implements ArtifactCollector
@Component(role=LegacyArtifactCollector.class)
public class DefaultLegacyArtifactCollector
implements LegacyArtifactCollector
{
@Requirement(hint="nearest")
private ConflictResolver defaultConflictResolver;

View File

@ -39,7 +39,7 @@ import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver;
* @version $Id$
*/
@Deprecated
public interface ArtifactCollector
public interface LegacyArtifactCollector
{
ArtifactResolutionResult collect( Set<Artifact> artifacts,

View File

@ -27,6 +27,7 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.repository.LegacyRepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
/**

View File

@ -22,6 +22,7 @@ package org.apache.maven.repository.legacy;
import java.io.File;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.repository.LegacyRepositorySystem;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.PlexusTestCase;

View File

@ -47,7 +47,7 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.repository.legacy.resolver.ArtifactCollector;
import org.apache.maven.repository.legacy.resolver.LegacyArtifactCollector;
import org.codehaus.plexus.PlexusTestCase;
/**
@ -59,7 +59,7 @@ import org.codehaus.plexus.PlexusTestCase;
public class DefaultArtifactCollectorTest
extends PlexusTestCase
{
private ArtifactCollector artifactCollector;
private LegacyArtifactCollector artifactCollector;
private ArtifactFactory artifactFactory;
@ -77,7 +77,7 @@ public class DefaultArtifactCollectorTest
source = new Source();
artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
artifactCollector = (ArtifactCollector) lookup( ArtifactCollector.class );
artifactCollector = (LegacyArtifactCollector) lookup( LegacyArtifactCollector.class );
projectArtifact = createArtifactSpec( "project", "1.0", null );
}

View File

@ -1,8 +1,8 @@
package org.apache.maven.project;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.repository.LegacyRepositorySystem;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.legacy.LegacyRepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;

View File

@ -137,7 +137,10 @@
<module>maven-model-builder</module>
<module>maven-embedder</module>
<module>maven-compat</module>
<!--
While working on the compatibility layer I've merged the code with maven-compat
<module>maven-repository</module>
-->
</modules>
<scm>