[MNG-2943] Avoid using package names used in other artifacts: org.apache.maven

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@543670 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2007-06-02 00:05:35 +00:00
parent 46e5b38635
commit 53acf2858f
11 changed files with 303 additions and 174 deletions

View File

@ -19,8 +19,9 @@ specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>maven</artifactId>
<groupId>org.apache.maven</groupId>
@ -71,4 +72,19 @@ under the License.
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<!-- do not export deprecated packages -->
<Export-Package>!org.apache.maven,*</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,171 +1,70 @@
package org.apache.maven;
/*
* 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
* 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
* 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.
* 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.List;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.model.DeploymentRepository;
import org.apache.maven.model.Repository;
import org.apache.maven.model.RepositoryBase;
import org.apache.maven.model.RepositoryPolicy;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/** @author Jason van Zyl */
/**
* @deprecated use {@link org.apache.maven.project.DefaultMavenTools}
* @author Jason van Zyl
*/
public class DefaultMavenTools
implements MavenTools, Contextualizable
extends org.apache.maven.project.DefaultMavenTools
implements MavenTools
{
private ArtifactRepositoryLayout repositoryLayout;
private ArtifactRepositoryFactory artifactRepositoryFactory;
private PlexusContainer container;
// ----------------------------------------------------------------------------
// Code snagged from ProjectUtils: this will have to be moved somewhere else
// but just trying to collect it all in one place right now.
// ----------------------------------------------------------------------------
private org.apache.maven.project.MavenTools mavenTools;
/**
* @see org.apache.maven.project.MavenTools#buildArtifactRepositories(java.util.List)
*/
public List buildArtifactRepositories( List repositories )
throws InvalidRepositoryException
{
List repos = new ArrayList();
for ( Iterator i = repositories.iterator(); i.hasNext(); )
{
Repository mavenRepo = (Repository) i.next();
ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo );
if ( !repos.contains( artifactRepo ) )
{
repos.add( artifactRepo );
}
}
return repos;
}
public ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
String url = repo.getUrl();
// TODO: make this a map inside the factory instead, so no lookup needed
ArtifactRepositoryLayout layout = getRepositoryLayout( repo );
return artifactRepositoryFactory.createDeploymentArtifactRepository( id, url, layout,
repo.isUniqueVersion() );
}
else
{
return null;
}
return getMavenTools().buildArtifactRepositories( repositories );
}
/**
* @see org.apache.maven.project.MavenTools#buildArtifactRepository(org.apache.maven.model.Repository)
*/
public ArtifactRepository buildArtifactRepository( Repository repo )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
String url = repo.getUrl();
// TODO: make this a map inside the factory instead, so no lookup needed
ArtifactRepositoryLayout layout = getRepositoryLayout( repo );
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshots, releases );
}
else
{
return null;
}
return getMavenTools().buildArtifactRepository( repo );
}
public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( RepositoryPolicy policy )
{
boolean enabled = true;
String updatePolicy = null;
String checksumPolicy = null;
if ( policy != null )
{
enabled = policy.isEnabled();
if ( policy.getUpdatePolicy() != null )
{
updatePolicy = policy.getUpdatePolicy();
}
if ( policy.getChecksumPolicy() != null )
{
checksumPolicy = policy.getChecksumPolicy();
}
}
return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy );
}
private ArtifactRepositoryLayout getRepositoryLayout( RepositoryBase mavenRepo )
/**
* @see org.apache.maven.project.MavenTools#buildDeploymentArtifactRepository(org.apache.maven.model.DeploymentRepository)
*/
public ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo )
throws InvalidRepositoryException
{
String layout = mavenRepo.getLayout();
ArtifactRepositoryLayout repositoryLayout;
try
{
repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
}
catch ( ComponentLookupException e )
{
throw new InvalidRepositoryException( "Cannot find layout implementation corresponding to: \'" + layout +
"\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
}
return repositoryLayout;
return getMavenTools().buildDeploymentArtifactRepository( repo );
}
// ----------------------------------------------------------------------------
// Lifecycle
// ----------------------------------------------------------------------------
public void contextualize( Context context )
throws ContextException
private org.apache.maven.project.MavenTools getMavenTools()
{
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
if ( mavenTools == null )
{
mavenTools = new org.apache.maven.project.DefaultMavenTools();
}
return mavenTools;
}
}

View File

@ -19,30 +19,11 @@ package org.apache.maven;
* under the License.
*/
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.DeploymentRepository;
import org.apache.maven.model.Repository;
import java.util.List;
/**
* @deprecated use {@link org.apache.maven.project.MavenTools}
* @author Jason van Zyl
*/
public interface MavenTools
public interface MavenTools extends org.apache.maven.project.MavenTools
{
String ROLE = MavenTools.class.getName();
// ----------------------------------------------------------------------------
// Methods taken from ProjectUtils
// ----------------------------------------------------------------------------
List buildArtifactRepositories( List repositories )
throws InvalidRepositoryException;
ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo )
throws InvalidRepositoryException;
ArtifactRepository buildArtifactRepository( Repository repo )
throws InvalidRepositoryException;
}

View File

@ -19,7 +19,6 @@ package org.apache.maven.project;
* under the License.
*/
import org.apache.maven.MavenTools;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactStatus;
import org.apache.maven.artifact.ArtifactUtils;

View File

@ -0,0 +1,174 @@
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 org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.model.DeploymentRepository;
import org.apache.maven.model.Repository;
import org.apache.maven.model.RepositoryBase;
import org.apache.maven.model.RepositoryPolicy;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author Jason van Zyl
* @since 2.1
*/
public class DefaultMavenTools
implements MavenTools, Contextualizable
{
private ArtifactRepositoryLayout repositoryLayout;
private ArtifactRepositoryFactory artifactRepositoryFactory;
private PlexusContainer container;
// ----------------------------------------------------------------------------
// Code snagged from ProjectUtils: this will have to be moved somewhere else
// but just trying to collect it all in one place right now.
// ----------------------------------------------------------------------------
public List buildArtifactRepositories( List repositories )
throws InvalidRepositoryException
{
List repos = new ArrayList();
for ( Iterator i = repositories.iterator(); i.hasNext(); )
{
Repository mavenRepo = (Repository) i.next();
ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo );
if ( !repos.contains( artifactRepo ) )
{
repos.add( artifactRepo );
}
}
return repos;
}
public ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
String url = repo.getUrl();
// TODO: make this a map inside the factory instead, so no lookup needed
ArtifactRepositoryLayout layout = getRepositoryLayout( repo );
return artifactRepositoryFactory.createDeploymentArtifactRepository( id, url, layout,
repo.isUniqueVersion() );
}
else
{
return null;
}
}
public ArtifactRepository buildArtifactRepository( Repository repo )
throws InvalidRepositoryException
{
if ( repo != null )
{
String id = repo.getId();
String url = repo.getUrl();
// TODO: make this a map inside the factory instead, so no lookup needed
ArtifactRepositoryLayout layout = getRepositoryLayout( repo );
ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshots, releases );
}
else
{
return null;
}
}
public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( RepositoryPolicy policy )
{
boolean enabled = true;
String updatePolicy = null;
String checksumPolicy = null;
if ( policy != null )
{
enabled = policy.isEnabled();
if ( policy.getUpdatePolicy() != null )
{
updatePolicy = policy.getUpdatePolicy();
}
if ( policy.getChecksumPolicy() != null )
{
checksumPolicy = policy.getChecksumPolicy();
}
}
return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy );
}
private ArtifactRepositoryLayout getRepositoryLayout( RepositoryBase mavenRepo )
throws InvalidRepositoryException
{
String layout = mavenRepo.getLayout();
ArtifactRepositoryLayout repositoryLayout;
try
{
repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
}
catch ( ComponentLookupException e )
{
throw new InvalidRepositoryException( "Cannot find layout implementation corresponding to: \'" + layout +
"\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
}
return repositoryLayout;
}
// ----------------------------------------------------------------------------
// Lifecycle
// ----------------------------------------------------------------------------
public void contextualize( Context context )
throws ContextException
{
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
}

View File

@ -0,0 +1,49 @@
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 org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.DeploymentRepository;
import org.apache.maven.model.Repository;
import java.util.List;
/**
* @author Jason van Zyl
* @since 2.1
*/
public interface MavenTools
{
String ROLE = MavenTools.class.getName();
// ----------------------------------------------------------------------------
// Methods taken from ProjectUtils
// ----------------------------------------------------------------------------
List buildArtifactRepositories( List repositories )
throws InvalidRepositoryException;
ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo )
throws InvalidRepositoryException;
ArtifactRepository buildArtifactRepository( Repository repo )
throws InvalidRepositoryException;
}

View File

@ -19,7 +19,6 @@ package org.apache.maven.project.build.model;
* under the License.
*/
import org.apache.maven.MavenTools;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.factory.ArtifactFactory;
@ -32,6 +31,7 @@ import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.project.MavenTools;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.build.ProjectBuildCache;
import org.apache.maven.project.build.profile.ProfileAdvisor;

View File

@ -19,7 +19,6 @@ package org.apache.maven.project.build.profile;
* under the License.
*/
import org.apache.maven.MavenTools;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.InvalidRepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
@ -32,6 +31,7 @@ import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.profiles.ProfilesConversionUtils;
import org.apache.maven.profiles.ProfilesRoot;
import org.apache.maven.profiles.activation.ProfileActivationException;
import org.apache.maven.project.MavenTools;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.injection.ProfileInjector;
import org.codehaus.plexus.PlexusConstants;

View File

@ -58,7 +58,7 @@ under the License.
<implementation>org.apache.maven.project.build.profile.DefaultProfileAdvisor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
@ -85,7 +85,7 @@ under the License.
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
@ -188,7 +188,7 @@ under the License.
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
</requirements>
</component>
@ -351,9 +351,20 @@ under the License.
</requirements>
</component>
<!-- @deprecated use org.apache.maven.project.MavenTools -->
<component>
<role>org.apache.maven.MavenTools</role>
<implementation>org.apache.maven.DefaultMavenTools</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.project.MavenTools</role>
<implementation>org.apache.maven.project.DefaultMavenTools</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>

View File

@ -44,7 +44,7 @@ under the License.
<implementation>org.apache.maven.project.build.profile.DefaultProfileAdvisor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
@ -117,7 +117,7 @@ under the License.
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
</requirements>
</component>

View File

@ -62,7 +62,7 @@ under the License.
<implementation>org.apache.maven.project.build.profile.DefaultProfileAdvisor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
@ -111,7 +111,7 @@ under the License.
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
<requirement>
<role>org.apache.maven.MavenTools</role>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.context.BuildContextManager</role>