mirror of https://github.com/apache/maven.git
[MNG-4221] Push all repository/artifact related code into a legacy module and create a backward compat layer for external consumers
o Refactored code to make maven-compat depend on maven-core, this got ugly regarding some tests which to a high degree depend on a full-blown repository system git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@829934 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e7ef4a045
commit
20f8323b0a
|
@ -183,7 +183,7 @@ END SNIPPET: ant-bootstrap -->
|
|||
<modello file="maven-model-builder/src/main/mdo/profiles.mdo" />
|
||||
<modello file="maven-settings/src/main/mdo/settings.mdo" version="1.1.0" />
|
||||
<modello file="maven-core/src/main/mdo/toolchains.mdo" />
|
||||
<modello file="maven-compat/src/main/mdo/metadata.mdo" />
|
||||
<modello file="maven-core/src/main/mdo/metadata.mdo" />
|
||||
<modello file="maven-compat/src/main/mdo/profiles.mdo" />
|
||||
<modello file="maven-compat/src/main/mdo/paramdoc.mdo" />
|
||||
</target>
|
||||
|
|
|
@ -23,41 +23,9 @@
|
|||
<name>Maven Artifact</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model-builder</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-provider-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>1.2_Java1.3</version>
|
||||
<scope>test</scope>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
||||
|
||||
/**
|
||||
* @author Jason van Zyl
|
||||
|
@ -40,14 +39,14 @@ public class ArtifactNotFoundException
|
|||
.getDependencyTrail() );
|
||||
}
|
||||
|
||||
protected ArtifactNotFoundException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, ResourceDoesNotExistException cause )
|
||||
protected ArtifactNotFoundException( String message, Artifact artifact, List<ArtifactRepository> remoteRepositories, Throwable cause )
|
||||
{
|
||||
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact
|
||||
.getDependencyTrail(), cause );
|
||||
}
|
||||
|
||||
public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, String classifier, List<ArtifactRepository> remoteRepositories,
|
||||
String downloadUrl, List<String> path, ResourceDoesNotExistException cause )
|
||||
String downloadUrl, List<String> path, Throwable cause )
|
||||
{
|
||||
super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, downloadUrl, path ), groupId, artifactId, version, type, classifier, remoteRepositories,
|
||||
null, cause );
|
||||
|
|
|
@ -39,6 +39,18 @@
|
|||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-interpolation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
|
@ -56,11 +68,6 @@
|
|||
<artifactId>wagon-file</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-http-lightweight</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
|
@ -81,7 +88,6 @@
|
|||
<configuration>
|
||||
<version>1.0.0</version>
|
||||
<models>
|
||||
<model>src/main/mdo/metadata.mdo</model>
|
||||
<model>src/main/mdo/profiles.mdo</model>
|
||||
<model>src/main/mdo/paramdoc.mdo</model>
|
||||
</models>
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
@Deprecated
|
||||
public class ManagedVersionMap
|
||||
extends HashMap<String, Artifact>
|
||||
{
|
||||
|
|
|
@ -21,9 +21,7 @@ package org.apache.maven.project;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.maven.artifact.InvalidRepositoryException;
|
||||
import org.apache.maven.project.validation.ModelValidationResult;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
@Deprecated
|
||||
public class InvalidProjectModelException
|
||||
|
@ -68,42 +66,6 @@ public class InvalidProjectModelException
|
|||
this( projectId, message, new File( pomLocation ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated use {@link File} constructor for pomLocation
|
||||
*/
|
||||
public InvalidProjectModelException( String projectId, String pomLocation, String message,
|
||||
InvalidRepositoryException cause )
|
||||
{
|
||||
this( projectId, message, new File( pomLocation ), cause );
|
||||
}
|
||||
|
||||
public InvalidProjectModelException( String projectId, String message, File pomLocation,
|
||||
InvalidRepositoryException cause )
|
||||
{
|
||||
super( projectId, message, pomLocation, cause );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link File} constructor for pomLocation
|
||||
*/
|
||||
public InvalidProjectModelException( String projectId, String pomLocation, String message,
|
||||
XmlPullParserException cause )
|
||||
{
|
||||
this( projectId, message, new File( pomLocation ), cause );
|
||||
}
|
||||
|
||||
public InvalidProjectModelException( String projectId, String message, File pomFile, XmlPullParserException cause )
|
||||
{
|
||||
super( projectId, message, pomFile, cause );
|
||||
}
|
||||
|
||||
// for super-POM building.
|
||||
public InvalidProjectModelException( String projectId, String message, XmlPullParserException cause )
|
||||
{
|
||||
super( projectId, message, cause );
|
||||
}
|
||||
|
||||
public final ModelValidationResult getValidationResult()
|
||||
{
|
||||
return validationResult;
|
|
@ -31,7 +31,7 @@ import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
|
|||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
|
||||
@Component(role = ArtifactMetadataSource.class)
|
||||
@Component(role = ArtifactMetadataSource.class, hint="test")
|
||||
public class TestMetadataSource
|
||||
implements ArtifactMetadataSource
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ 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.legacy.metadata.MetadataResolutionRequest;
|
||||
import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
||||
|
||||
// It would be cool if there was a hook that i could use to setup a test environment.
|
||||
// I want to setup a local/remote repositories for testing but i don't want to have
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
package org.apache.maven.project;
|
||||
|
||||
/*
|
||||
* 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 java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.apache.maven.model.building.ModelBuildingException;
|
||||
import org.apache.maven.model.building.ModelProblem;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
/**
|
||||
* @author Jason van Zyl
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractMavenProjectTestCase
|
||||
extends PlexusTestCase
|
||||
{
|
||||
protected ProjectBuilder projectBuilder;
|
||||
|
||||
protected RepositorySystem repositorySystem;
|
||||
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
if ( getContainer().hasComponent( ProjectBuilder.class, "test" ) )
|
||||
{
|
||||
projectBuilder = lookup( ProjectBuilder.class, "test" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// default over to the main project builder...
|
||||
projectBuilder = lookup( ProjectBuilder.class );
|
||||
}
|
||||
|
||||
repositorySystem = lookup( RepositorySystem.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
projectBuilder = null;
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
protected ProjectBuilder getProjectBuilder()
|
||||
{
|
||||
return projectBuilder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCustomConfigurationName()
|
||||
{
|
||||
String name = AbstractMavenProjectTestCase.class.getName().replace( '.', '/' ) + ".xml";
|
||||
System.out.println( name );
|
||||
return name;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Local repository
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
protected File getLocalRepositoryPath()
|
||||
throws FileNotFoundException, URISyntaxException
|
||||
{
|
||||
File markerFile = getFileForClasspathResource( "local-repo/marker.txt" );
|
||||
|
||||
return markerFile.getAbsoluteFile().getParentFile();
|
||||
}
|
||||
|
||||
protected static File getFileForClasspathResource( String resource )
|
||||
throws FileNotFoundException
|
||||
{
|
||||
ClassLoader cloader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
URL resourceUrl = cloader.getResource( resource );
|
||||
|
||||
if ( resourceUrl == null )
|
||||
{
|
||||
throw new FileNotFoundException( "Unable to find: " + resource );
|
||||
}
|
||||
|
||||
return new File( URI.create( resourceUrl.toString().replaceAll( " ", "%20" ) ) );
|
||||
}
|
||||
|
||||
protected ArtifactRepository getLocalRepository()
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
|
||||
|
||||
ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Project building
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
protected MavenProject getProjectWithDependencies( File pom )
|
||||
throws Exception
|
||||
{
|
||||
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
|
||||
configuration.setLocalRepository( getLocalRepository() );
|
||||
configuration.setRemoteRepositories( Arrays.asList( new ArtifactRepository[] {} ) );
|
||||
configuration.setProcessPlugins( false );
|
||||
configuration.setResolveDependencies( true );
|
||||
|
||||
try
|
||||
{
|
||||
return projectBuilder.build( pom, configuration ).getProject();
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
Throwable cause = e.getCause();
|
||||
if ( cause instanceof ModelBuildingException )
|
||||
{
|
||||
String message = "In: " + pom + "\n\n";
|
||||
for ( ModelProblem problem : ( (ModelBuildingException) cause ).getProblems() )
|
||||
{
|
||||
message += problem + "\n";
|
||||
}
|
||||
System.out.println( message );
|
||||
fail( message );
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
protected MavenProject getProject( File pom )
|
||||
throws Exception
|
||||
{
|
||||
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
|
||||
configuration.setLocalRepository( getLocalRepository() );
|
||||
|
||||
return projectBuilder.build( pom, configuration ).getProject();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package org.apache.maven.project;
|
||||
|
||||
/*
|
||||
* 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 java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.RepositoryRequest;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
||||
import org.apache.maven.lifecycle.LifecycleNotFoundException;
|
||||
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
|
||||
import org.apache.maven.lifecycle.MavenExecutionPlan;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.MojoNotFoundException;
|
||||
import org.apache.maven.plugin.PluginConfigurationException;
|
||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
import org.apache.maven.plugin.PluginManagerException;
|
||||
import org.apache.maven.plugin.PluginNotFoundException;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
/**
|
||||
* A stub implementation that assumes an empty lifecycle to bypass interaction with the plugin manager and to avoid
|
||||
* plugin artifact resolution from repositories.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class EmptyLifecycleExecutor
|
||||
implements LifecycleExecutor
|
||||
{
|
||||
|
||||
public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
|
||||
MojoNotFoundException
|
||||
{
|
||||
return new MavenExecutionPlan( Collections.<MojoExecution> emptyList(), null, null );
|
||||
}
|
||||
|
||||
public void execute( MavenSession session )
|
||||
{
|
||||
}
|
||||
|
||||
public Xpp3Dom getDefaultPluginConfiguration( String groupId, String artifactId, String version, String goal,
|
||||
MavenProject project, ArtifactRepository localRepository )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getLifecyclePhases()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
|
||||
{
|
||||
Set<Plugin> plugins;
|
||||
|
||||
// NOTE: The upper-case packaging name is intentional, that's a special hinting mode used for certain tests
|
||||
if ( "JAR".equals( packaging ) )
|
||||
{
|
||||
plugins = new LinkedHashSet<Plugin>();
|
||||
|
||||
plugins.add( newPlugin( "maven-compiler-plugin", "compile", "testCompile" ) );
|
||||
plugins.add( newPlugin( "maven-resources-plugin", "resources", "testResources" ) );
|
||||
plugins.add( newPlugin( "maven-surefire-plugin", "test" ) );
|
||||
plugins.add( newPlugin( "maven-jar-plugin", "jar" ) );
|
||||
plugins.add( newPlugin( "maven-install-plugin", "install" ) );
|
||||
plugins.add( newPlugin( "maven-deploy-plugin", "deploy" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
plugins = Collections.emptySet();
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
||||
private Plugin newPlugin( String artifactId, String... goals )
|
||||
{
|
||||
Plugin plugin = new Plugin();
|
||||
|
||||
plugin.setGroupId( "org.apache.maven.plugins" );
|
||||
plugin.setArtifactId( artifactId );
|
||||
|
||||
for ( String goal : goals )
|
||||
{
|
||||
PluginExecution pluginExecution = new PluginExecution();
|
||||
pluginExecution.setId( "default-" + goal );
|
||||
pluginExecution.addGoal( goal );
|
||||
plugin.addExecution( pluginExecution );
|
||||
}
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public void populateDefaultConfigurationForPlugins( Collection<Plugin> plugins, RepositoryRequest repositoryRequest )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
}
|
||||
|
||||
public void populateDefaultConfigurationForPlugin( Plugin plugin, RepositoryRequest repositoryRequest )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
}
|
||||
|
||||
public void resolvePluginVersion( Plugin plugin, RepositoryRequest repositoryRequest )
|
||||
throws PluginNotFoundException
|
||||
{
|
||||
}
|
||||
|
||||
public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
|
||||
throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
|
||||
PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
|
||||
LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
|
||||
{
|
||||
}
|
||||
|
||||
public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
|
||||
throws MojoFailureException, MojoExecutionException, PluginConfigurationException, PluginManagerException
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package org.apache.maven.repository;
|
||||
|
||||
/*
|
||||
* 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.Artifact;
|
||||
import org.apache.maven.artifact.handler.ArtifactHandler;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
*/
|
||||
@Component(role=ArtifactRepositoryLayout.class, hint="legacy")
|
||||
public class LegacyRepositoryLayout
|
||||
implements ArtifactRepositoryLayout
|
||||
{
|
||||
private static final String PATH_SEPARATOR = "/";
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return "legacy";
|
||||
}
|
||||
|
||||
public String pathOf( Artifact artifact )
|
||||
{
|
||||
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
|
||||
|
||||
StringBuilder path = new StringBuilder( 128 );
|
||||
|
||||
path.append( artifact.getGroupId() ).append( '/' );
|
||||
path.append( artifactHandler.getDirectory() ).append( '/' );
|
||||
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
|
||||
|
||||
if ( artifact.hasClassifier() )
|
||||
{
|
||||
path.append( '-' ).append( artifact.getClassifier() );
|
||||
}
|
||||
|
||||
if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
|
||||
{
|
||||
path.append( '.' ).append( artifactHandler.getExtension() );
|
||||
}
|
||||
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata,
|
||||
ArtifactRepository repository )
|
||||
{
|
||||
return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
|
||||
}
|
||||
|
||||
private String pathOfRepositoryMetadata( ArtifactMetadata metadata,
|
||||
String filename )
|
||||
{
|
||||
StringBuilder path = new StringBuilder( 128 );
|
||||
|
||||
path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR );
|
||||
|
||||
path.append( filename );
|
||||
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
|
||||
{
|
||||
return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,6 @@ import org.apache.maven.model.Dependency;
|
|||
import org.apache.maven.model.Repository;
|
||||
import org.apache.maven.model.RepositoryPolicy;
|
||||
import org.apache.maven.repository.RepositorySystem;
|
||||
import org.apache.maven.repository.legacy.LegacyRepositorySystem;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
/**
|
Binary file not shown.
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: Dummy Artifact</name>
|
||||
<description>
|
||||
|
||||
</description>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.1</version>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>0.1</version>
|
||||
</versions>
|
||||
<lastUpdated>20091023222756</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
Binary file not shown.
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>b</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: Dummy Artifact</name>
|
||||
<description>
|
||||
|
||||
</description>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<metadata>
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>b</artifactId>
|
||||
<version>0.1</version>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>0.1</version>
|
||||
</versions>
|
||||
<lastUpdated>20091023222817</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue