You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/01/28 22:15:39 UTC
[maven-artifact-transfer] 01/01: mvn4 aggregator
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch mvn4
in repository https://gitbox.apache.org/repos/asf/maven-artifact-transfer.git
commit 2c7902a000b397f702597b2c2c6dfd31df69a846
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Jan 28 23:15:35 2022 +0100
mvn4 aggregator
---
maven-3.0.x/pom.xml | 144 ---------
.../deploy/internal/Maven30ArtifactDeployer.java | 159 ---------
.../install/internal/Maven30ArtifactInstaller.java | 131 --------
.../resolve/internal/Maven30ArtifactResolver.java | 110 -------
.../resolve/internal/Maven30ArtifactResult.java | 48 ---
.../internal/Maven30ArtifactRepositoryAdapter.java | 277 ----------------
.../collection/internal/Maven30CollectResult.java | 68 ----
.../internal/Maven30DependencyCollector.java | 164 ----------
.../internal/Maven30DependencyNodeAdapter.java | 154 ---------
.../internal/Maven30ArtifactRepositoryAdapter.java | 278 ----------------
.../collect/internal/Maven30CollectorResult.java | 85 -----
.../internal/Maven30DependencyCollector.java | 165 ----------
.../internal/Maven30DependencyNodeAdapter.java | 154 ---------
.../resolve/internal/Maven30ArtifactResult.java | 48 ---
.../internal/Maven30DependencyResolver.java | 245 --------------
.../Maven30DependencyResolverException.java | 61 ----
.../metadata/internal/Maven30MetadataBridge.java | 107 ------
.../internal/Maven30RepositoryManager.java | 168 ----------
.../aether/util/artifact/AbstractArtifact.java | 188 -----------
.../aether/util/artifact/DefaultArtifact.java | 360 ---------------------
.../sonatype/aether/util/artifact/SubArtifact.java | 203 ------------
.../internal/Maven30ArtifactInstallerTest.java | 80 -----
.../internal/Maven30RepositoryManagerTest.java | 78 -----
maven-3.1.x/pom.xml | 26 +-
.../internal/Maven31ArtifactRepositoryAdapter.java | 12 +
.../internal/Maven31ArtifactRepositoryAdapter.java | 12 +
maven-artifact-transfer/pom.xml | 2 +-
pom.xml | 14 +-
28 files changed, 44 insertions(+), 3497 deletions(-)
diff --git a/maven-3.0.x/pom.xml b/maven-3.0.x/pom.xml
deleted file mode 100644
index 08f6158..0000000
--- a/maven-3.0.x/pom.xml
+++ /dev/null
@@ -1,144 +0,0 @@
-<?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 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/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-artifact-transfer-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>maven-artifact-transfer-maven-3.0.x</artifactId>
-
- <name>Apache Maven Artifact Transfer Maven 3.0.x provider</name>
-
- <properties>
- <maven30x.version>3.0.5</maven30x.version>
- <sonatypeAether.version>1.13.1</sonatypeAether.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-artifact-transfer-api</artifactId>
- </dependency>
- <!-- Not provided, as it is not present in Maven 3.0.x -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven30x.version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.sonatype.sisu</groupId>
- <artifactId>sisu-inject-plexus</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>${maven30x.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>${maven30x.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>org.eclipse.sisu.plexus</artifactId>
- <version>${sisu.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.sonatype.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${sonatypeAether.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.sonatype.aether</groupId>
- <artifactId>aether-impl</artifactId>
- <version>${sonatypeAether.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.sonatype.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${sonatypeAether.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-annotations</artifactId>
- </dependency>
-
- <!-- TEST -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-metadata</artifactId>
- </plugin>
- <plugin>
- <groupId>org.eclipse.sisu</groupId>
- <artifactId>sisu-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/deploy/internal/Maven30ArtifactDeployer.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/deploy/internal/Maven30ArtifactDeployer.java
deleted file mode 100644
index 2eec2df..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/deploy/internal/Maven30ArtifactDeployer.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.apache.maven.shared.transfer.artifact.deploy.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployerException;
-import org.apache.maven.shared.transfer.metadata.internal.Maven30MetadataBridge;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.deployment.DeployRequest;
-import org.sonatype.aether.deployment.DeploymentException;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.sonatype.aether.util.artifact.SubArtifact;
-
-import java.util.Collection;
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = ArtifactDeployerDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30ArtifactDeployer
- extends DelegateSupport
- implements ArtifactDeployerDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- public Maven30ArtifactDeployer()
- {
- }
-
- public Maven30ArtifactDeployer( RepositorySystem repositorySystem )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- }
-
- @Override
- public void deploy( ProjectBuildingRequest buildingRequest,
- Collection<org.apache.maven.artifact.Artifact> mavenArtifacts )
- throws ArtifactDeployerException
- {
- deploy( buildingRequest, null, mavenArtifacts );
- }
-
- @Override
- public void deploy( ProjectBuildingRequest buildingRequest,
- ArtifactRepository remoteRepository,
- Collection<org.apache.maven.artifact.Artifact> mavenArtifacts )
- throws ArtifactDeployerException
- {
- // prepare request
- DeployRequest request = new DeployRequest();
-
- RemoteRepository defaultRepository = null;
-
- if ( remoteRepository != null )
- {
- defaultRepository = getRemoteRepository( buildingRequest.getRepositorySession(), remoteRepository );
- }
-
- // transform artifacts
- for ( org.apache.maven.artifact.Artifact mavenArtifact : mavenArtifacts )
- {
- Artifact aetherArtifact = RepositoryUtils.toArtifact( mavenArtifact );
- request.addArtifact( aetherArtifact );
-
- RemoteRepository aetherRepository;
- if ( remoteRepository == null )
- {
- aetherRepository = getRemoteRepository( buildingRequest.getRepositorySession(),
- mavenArtifact.getRepository() );
- }
- else
- {
- aetherRepository = defaultRepository;
- }
-
- request.setRepository( aetherRepository );
-
- for ( ArtifactMetadata metadata : mavenArtifact.getMetadataList() )
- {
- if ( metadata instanceof ProjectArtifactMetadata )
- {
- Artifact pomArtifact = new SubArtifact( aetherArtifact, "", "pom" );
- pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
- request.addArtifact( pomArtifact );
- }
- else if ( // metadata instanceof SnapshotArtifactRepositoryMetadata ||
- metadata instanceof ArtifactRepositoryMetadata )
- {
- // eaten, handled by repo system
- }
- else if ( metadata instanceof org.apache.maven.shared.transfer.metadata.ArtifactMetadata )
- {
- org.apache.maven.shared.transfer.metadata.ArtifactMetadata transferMedata =
- (org.apache.maven.shared.transfer.metadata.ArtifactMetadata) metadata;
-
- request.addMetadata( new Maven30MetadataBridge( metadata ).setFile( transferMedata.getFile() ) );
- }
- }
- }
-
- // deploy
- try
- {
- repositorySystem.deploy( buildingRequest.getRepositorySession(), request );
- }
- catch ( DeploymentException e )
- {
- throw new ArtifactDeployerException( e.getMessage(), e );
- }
- }
-
- private RemoteRepository getRemoteRepository( RepositorySystemSession session,
- ArtifactRepository remoteRepository )
- {
- RemoteRepository aetherRepo = RepositoryUtils.toRepo( remoteRepository );
-
- if ( aetherRepo.getAuthentication() == null )
- {
- aetherRepo.setAuthentication( session.getAuthenticationSelector().getAuthentication( aetherRepo ) );
- }
-
- if ( aetherRepo.getProxy() == null )
- {
- aetherRepo.setProxy( session.getProxySelector().getProxy( aetherRepo ) );
- }
-
- return aetherRepo;
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/install/internal/Maven30ArtifactInstaller.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/install/internal/Maven30ArtifactInstaller.java
deleted file mode 100644
index 1f957b7..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/install/internal/Maven30ArtifactInstaller.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.apache.maven.shared.transfer.artifact.install.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.shared.transfer.artifact.install.ArtifactInstallerException;
-import org.apache.maven.shared.transfer.metadata.internal.Maven30MetadataBridge;
-import org.apache.maven.shared.transfer.repository.RepositoryManager;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.installation.InstallRequest;
-import org.sonatype.aether.installation.InstallationException;
-import org.sonatype.aether.util.artifact.SubArtifact;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = ArtifactInstallerDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30ArtifactInstaller
- extends DelegateSupport
- implements ArtifactInstallerDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- @Requirement
- private RepositoryManager repositoryManager;
-
- public Maven30ArtifactInstaller()
- {
- }
-
- public Maven30ArtifactInstaller( RepositorySystem repositorySystem,
- RepositoryManager repositoryManager )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- this.repositoryManager = Objects.requireNonNull( repositoryManager );
- }
-
- @Override
- public void install( ProjectBuildingRequest buildingRequest,
- Collection<org.apache.maven.artifact.Artifact> mavenArtifacts )
- throws ArtifactInstallerException
- {
- install( buildingRequest, null, mavenArtifacts );
- }
-
- @Override
- public void install( ProjectBuildingRequest buildingRequest,
- File localRepository,
- Collection<org.apache.maven.artifact.Artifact> mavenArtifacts )
- throws ArtifactInstallerException
- {
- ProjectBuildingRequest currentBuildingRequest = buildingRequest;
- if ( localRepository != null )
- {
- // update local repo in request
- currentBuildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepository );
- }
- // prepare installRequest
- InstallRequest request = new InstallRequest();
-
- // transform artifacts
- for ( org.apache.maven.artifact.Artifact mavenArtifact : mavenArtifacts )
- {
- Artifact mainArtifact = RepositoryUtils.toArtifact( mavenArtifact );
- request.addArtifact( mainArtifact );
-
- for ( ArtifactMetadata metadata : mavenArtifact.getMetadataList() )
- {
- if ( metadata instanceof ProjectArtifactMetadata )
- {
- Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
- pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
- request.addArtifact( pomArtifact );
- }
- else if ( // metadata instanceof SnapshotArtifactRepositoryMetadata ||
- metadata instanceof ArtifactRepositoryMetadata )
- {
- // eaten, handled by repo system
- }
- else if ( metadata instanceof org.apache.maven.shared.transfer.metadata.ArtifactMetadata )
- {
- org.apache.maven.shared.transfer.metadata.ArtifactMetadata transferMedata =
- (org.apache.maven.shared.transfer.metadata.ArtifactMetadata) metadata;
-
- request.addMetadata( new Maven30MetadataBridge( metadata ).setFile( transferMedata.getFile() ) );
- }
- }
- }
-
- // install
- try
- {
- repositorySystem.install( currentBuildingRequest.getRepositorySession(), request );
- }
- catch ( InstallationException e )
- {
- throw new ArtifactInstallerException( e.getMessage(), e );
- }
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/resolve/internal/Maven30ArtifactResolver.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/resolve/internal/Maven30ArtifactResolver.java
deleted file mode 100644
index 3e2ab1a..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/resolve/internal/Maven30ArtifactResolver.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.maven.shared.transfer.artifact.resolve.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
-import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.resolution.ArtifactDescriptorException;
-import org.sonatype.aether.resolution.ArtifactDescriptorRequest;
-import org.sonatype.aether.resolution.ArtifactDescriptorResult;
-import org.sonatype.aether.resolution.ArtifactRequest;
-import org.sonatype.aether.resolution.ArtifactResolutionException;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = ArtifactResolverDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30ArtifactResolver
- extends DelegateSupport
- implements ArtifactResolverDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- public Maven30ArtifactResolver()
- {
- }
-
- public Maven30ArtifactResolver( RepositorySystem repositorySystem )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- }
-
- @Override
- public org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult resolveArtifact(
- ProjectBuildingRequest buildingRequest,
- org.apache.maven.artifact.Artifact mavenArtifact ) throws ArtifactResolverException
- {
- Artifact aetherArtifact = RepositoryUtils.toArtifact( mavenArtifact );
-
- return resolveArtifact( buildingRequest, aetherArtifact );
- }
-
- @Override
- public org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult resolveArtifact(
- ProjectBuildingRequest buildingRequest,
- ArtifactCoordinate coordinate ) throws ArtifactResolverException
- {
- Artifact aetherArtifact = new DefaultArtifact( coordinate.getGroupId(), coordinate.getArtifactId(),
- coordinate.getClassifier(), coordinate.getExtension(), coordinate.getVersion() );
-
- return resolveArtifact( buildingRequest, aetherArtifact );
- }
-
- private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult resolveArtifact(
- ProjectBuildingRequest buildingRequest,
- Artifact aetherArtifact ) throws ArtifactResolverException
- {
- try
- {
- // use descriptor to respect relocation
- ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest( aetherArtifact,
- RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ),
- null );
-
- ArtifactDescriptorResult descriptorResult = repositorySystem.readArtifactDescriptor(
- buildingRequest.getRepositorySession(),
- descriptorRequest );
-
- ArtifactRequest request = new ArtifactRequest( descriptorResult.getArtifact(),
- RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ),
- null );
-
- return new Maven30ArtifactResult( repositorySystem.resolveArtifact(
- buildingRequest.getRepositorySession(), request ) );
- }
- catch ( ArtifactDescriptorException | ArtifactResolutionException e )
- {
- throw new ArtifactResolverException( e.getMessage(), e );
- }
- }
-
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/resolve/internal/Maven30ArtifactResult.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/resolve/internal/Maven30ArtifactResult.java
deleted file mode 100644
index 240e06e..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/artifact/resolve/internal/Maven30ArtifactResult.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.shared.transfer.artifact.resolve.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.sonatype.aether.resolution.ArtifactResult;
-
-/**
- * {@link org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult} wrapper for {@link ArtifactResult}
- *
- * @author Robert Scholte
- * @since 3.0
- */
-class Maven30ArtifactResult implements org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult
-{
- private final ArtifactResult artifactResult;
-
- /**
- * @param artifactResult {@link ArtifactResult}
- */
- Maven30ArtifactResult( ArtifactResult artifactResult )
- {
- this.artifactResult = artifactResult;
- }
-
- @Override
- public org.apache.maven.artifact.Artifact getArtifact()
- {
- return RepositoryUtils.toArtifact( artifactResult.getArtifact() );
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30ArtifactRepositoryAdapter.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30ArtifactRepositoryAdapter.java
deleted file mode 100644
index 0b6d456..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30ArtifactRepositoryAdapter.java
+++ /dev/null
@@ -1,277 +0,0 @@
-package org.apache.maven.shared.transfer.collection.internal;
-
-/*
- * 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.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.artifact.repository.Authentication;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.repository.Proxy;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.sonatype.aether.repository.RepositoryPolicy;
-
-/**
- * ArtifactRepository wrapper around {@link RemoteRepository}
- *
- * @author Robert Scholte
- *
- */
-class Maven30ArtifactRepositoryAdapter implements ArtifactRepository
-{
- private static final String LS = System.lineSeparator();
- private RemoteRepository remoteRepository;
-
- /**
- * @param remoteRepository {@link RemoteRepository}
- */
- Maven30ArtifactRepositoryAdapter( RemoteRepository remoteRepository )
- {
- this.remoteRepository = remoteRepository;
- }
-
- @Override
- public String pathOf( Artifact artifact )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getUrl()
- {
- return remoteRepository.getUrl();
- }
-
- @Override
- public void setUrl( String url )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getBasedir()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getProtocol()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getId()
- {
- return remoteRepository.getId();
- }
-
- @Override
- public void setId( String id )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ArtifactRepositoryPolicy getSnapshots()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ArtifactRepositoryPolicy getReleases()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ArtifactRepositoryLayout getLayout()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setLayout( ArtifactRepositoryLayout layout )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getKey()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isUniqueVersion()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isBlacklisted()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setBlacklisted( boolean blackListed )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Artifact find( Artifact artifact )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public List<String> findVersions( Artifact artifact )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isProjectAware()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setAuthentication( Authentication authentication )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Authentication getAuthentication()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setProxy( Proxy proxy )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Proxy getProxy()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public List<ArtifactRepository> getMirroredRepositories()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append( " id: " ).append( getId() ).append( LS );
- sb.append( " url: " ).append( getUrl() ).append( LS );
- sb.append( " layout: " ).append( "default" ).append( LS );
-
- RepositoryPolicy snapshotPolicy = remoteRepository.getPolicy( true );
- sb.append( "snapshots: [enabled => " ).append( snapshotPolicy.isEnabled() );
- sb.append( ", update => " ).append( snapshotPolicy.getUpdatePolicy() ).append( "]" ).append( LS );
-
- RepositoryPolicy releasePolicy = remoteRepository.getPolicy( false );
- sb.append( " releases: [enabled => " ).append( releasePolicy.isEnabled() );
- sb.append( ", update => " ).append( releasePolicy.getUpdatePolicy() ).append( "]" ).append( LS );
-
- return sb.toString();
- }
-
- @Override
- public int hashCode()
- {
- return remoteRepository.hashCode();
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null )
- {
- return false;
- }
- if ( getClass() != obj.getClass() )
- {
- return false;
- }
-
- Maven30ArtifactRepositoryAdapter other = (Maven30ArtifactRepositoryAdapter) obj;
- if ( remoteRepository == null )
- {
- if ( other.remoteRepository != null )
- {
- return false;
- }
- }
- else if ( !remoteRepository.equals( other.remoteRepository ) )
- {
- return false;
- }
- return true;
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30CollectResult.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30CollectResult.java
deleted file mode 100644
index c5e6c90..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30CollectResult.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.maven.shared.transfer.collection.internal;
-
-/*
- * 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.List;
-
-import org.apache.maven.shared.transfer.collection.CollectResult;
-import org.apache.maven.shared.transfer.graph.DependencyNode;
-
-
-/**
- * CollectResult wrapper around {@link CollectResult}
- *
- * @author Pim Moerenhout
- *
- */
-class Maven30CollectResult implements CollectResult
-{
- private final org.sonatype.aether.collection.CollectResult collectResult;
-
- /**
- * @param collectResult {@link CollectResult}
- */
- Maven30CollectResult( org.sonatype.aether.collection.CollectResult collectResult )
- {
- this.collectResult = collectResult;
- }
-
- @Override
- public List<Exception> getExceptions()
- {
- return collectResult.getExceptions();
- }
-
- /**
- * Gets the root node of the dependency graph.
- *
- * @return The root node of the dependency graph or {@code null} if none.
- */
- @Override
- public DependencyNode getRoot()
- {
- return new Maven30DependencyNodeAdapter( collectResult.getRoot() );
- }
-
- @Override
- public String toString()
- {
- return String.valueOf( getRoot() );
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30DependencyCollector.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30DependencyCollector.java
deleted file mode 100644
index 7a0674c..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30DependencyCollector.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.apache.maven.shared.transfer.collection.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.transfer.collection.CollectResult;
-import org.apache.maven.shared.transfer.collection.DependencyCollectionException;
-import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.artifact.ArtifactTypeRegistry;
-import org.sonatype.aether.collection.CollectRequest;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = DependencyCollectorDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30DependencyCollector
- extends DelegateSupport
- implements DependencyCollectorDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- @Requirement
- private ArtifactHandlerManager artifactHandlerManager;
-
- public Maven30DependencyCollector()
- {
- }
-
- public Maven30DependencyCollector( RepositorySystem repositorySystem,
- ArtifactHandlerManager artifactHandlerManager )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- this.artifactHandlerManager = Objects.requireNonNull( artifactHandlerManager );
- }
-
- @Override
- public CollectResult collectDependencies( ProjectBuildingRequest buildingRequest,
- org.apache.maven.model.Dependency root )
- throws DependencyCollectionException
- {
- ArtifactTypeRegistry typeRegistry = RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager );
-
- CollectRequest request = new CollectRequest();
- request.setRoot( toDependency( root, typeRegistry ) );
-
- return collectDependencies( buildingRequest, request );
- }
-
- @Override
- public CollectResult collectDependencies( ProjectBuildingRequest buildingRequest,
- DependableCoordinate root )
- throws DependencyCollectionException
- {
- ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( root.getType() );
-
- String extension = artifactHandler != null ? artifactHandler.getExtension() : null;
-
- Artifact aetherArtifact = new DefaultArtifact( root.getGroupId(), root.getArtifactId(), root.getClassifier(),
- extension, root.getVersion() );
-
- CollectRequest request = new CollectRequest();
- request.setRoot( new Dependency( aetherArtifact, null ) );
-
- return collectDependencies( buildingRequest, request );
- }
-
- @Override
- public CollectResult collectDependencies( ProjectBuildingRequest buildingRequest,
- Model root )
- throws DependencyCollectionException
- {
- // Are there examples where packaging and type are NOT in sync
- ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( root.getPackaging() );
-
- String extension = artifactHandler != null ? artifactHandler.getExtension() : null;
-
- Artifact aetherArtifact = new DefaultArtifact( root.getGroupId(), root.getArtifactId(), extension,
- root.getVersion() );
-
- CollectRequest request = new CollectRequest();
- request.setRoot( new Dependency( aetherArtifact, null ) );
-
- ArtifactTypeRegistry typeRegistry = RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager );
-
- List<Dependency> aetherDependencies = new ArrayList<>( root.getDependencies().size() );
- for ( org.apache.maven.model.Dependency mavenDependency : root.getDependencies() )
- {
- aetherDependencies.add( toDependency( mavenDependency, typeRegistry ) );
- }
- request.setDependencies( aetherDependencies );
-
- if ( root.getDependencyManagement() != null )
- {
- List<Dependency> aetherManagerDependencies = new ArrayList<>(
- root.getDependencyManagement().getDependencies().size() );
-
- for ( org.apache.maven.model.Dependency mavenDependency : root.getDependencyManagement().getDependencies() )
- {
- aetherManagerDependencies.add( toDependency( mavenDependency, typeRegistry ) );
- }
-
- request.setManagedDependencies( aetherManagerDependencies );
- }
-
- return collectDependencies( buildingRequest, request );
- }
-
- private CollectResult collectDependencies( ProjectBuildingRequest buildingRequest,
- CollectRequest request )
- throws DependencyCollectionException
- {
- request.setRepositories( RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ) );
-
- try
- {
- return new Maven30CollectResult( repositorySystem.collectDependencies(
- buildingRequest.getRepositorySession(), request ) );
- }
- catch ( org.sonatype.aether.collection.DependencyCollectionException e )
- {
- throw new DependencyCollectionException( e.getMessage(), e );
- }
- }
-
- private static Dependency toDependency( org.apache.maven.model.Dependency mavenDependency,
- ArtifactTypeRegistry typeRegistry )
- {
- return RepositoryUtils.toDependency( mavenDependency, typeRegistry );
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30DependencyNodeAdapter.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30DependencyNodeAdapter.java
deleted file mode 100644
index cee74b9..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven30DependencyNodeAdapter.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.maven.shared.transfer.collection.internal;
-
-/*
- * 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.ArrayList;
-import java.util.List;
-
-import org.apache.maven.RepositoryUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.shared.transfer.graph.DependencyNode;
-import org.apache.maven.shared.transfer.graph.DependencyVisitor;
-import org.sonatype.aether.repository.RemoteRepository;
-
-/**
- * DependencyCollectorNode wrapper around {@link org.sonatype.aether.graph.DependencyNode}
- *
- * @author Pim Moerenhout
- *
- */
-class Maven30DependencyNodeAdapter implements DependencyNode
-{
-
- private org.sonatype.aether.graph.DependencyNode dependencyNode;
-
- /**
- * @param dependencyNode {@link org.sonatype.aether.graph.DependencyNode}
- */
- Maven30DependencyNodeAdapter( org.sonatype.aether.graph.DependencyNode dependencyNode )
- {
- this.dependencyNode = dependencyNode;
- }
-
- @Override
- public Artifact getArtifact()
- {
- return getArtifact( dependencyNode.getDependency().getArtifact() );
- }
-
- @Override
- public List<DependencyNode> getChildren()
- {
- List<org.sonatype.aether.graph.DependencyNode> aetherChildren = dependencyNode.getChildren();
- List<DependencyNode> children = new ArrayList<>( aetherChildren.size() );
- for ( org.sonatype.aether.graph.DependencyNode aetherChild : aetherChildren )
- {
- children.add( new Maven30DependencyNodeAdapter( aetherChild ) );
- }
- return children;
- }
-
- @Override
- public List<ArtifactRepository> getRemoteRepositories()
- {
- List<RemoteRepository> aetherRepositories = dependencyNode.getRepositories();
- List<ArtifactRepository> mavenRepositories = new ArrayList<>( aetherRepositories.size() );
-
- for ( RemoteRepository aetherRepository : aetherRepositories )
- {
- mavenRepositories.add( new Maven30ArtifactRepositoryAdapter( aetherRepository ) );
- }
-
- return mavenRepositories;
- }
-
- @Override
- public Boolean getOptional()
- {
- return dependencyNode.getDependency().isOptional();
- }
-
- @Override
- public String getScope()
- {
- return dependencyNode.getDependency().getScope();
- }
-
- @Override
- public boolean accept( DependencyVisitor visitor )
- {
- if ( visitor.visitEnter( this ) )
- {
- for ( org.sonatype.aether.graph.DependencyNode aetherNode : dependencyNode.getChildren() )
- {
- DependencyNode child = new Maven30DependencyNodeAdapter( aetherNode );
- if ( !child.accept( visitor ) )
- {
- break;
- }
- }
- }
-
- return visitor.visitLeave( this );
- }
-
- @Override
- public int hashCode()
- {
- return dependencyNode.hashCode();
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null )
- {
- return false;
- }
- if ( getClass() != obj.getClass() )
- {
- return false;
- }
-
- Maven30DependencyNodeAdapter other = (Maven30DependencyNodeAdapter) obj;
- if ( dependencyNode == null )
- {
- if ( other.dependencyNode != null )
- {
- return false;
- }
- }
- else if ( !dependencyNode.equals( other.dependencyNode ) )
- {
- return false;
- }
- return true;
- }
-
- private Artifact getArtifact( org.sonatype.aether.artifact.Artifact aetherArtifact )
- {
- return RepositoryUtils.toArtifact( aetherArtifact );
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30ArtifactRepositoryAdapter.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30ArtifactRepositoryAdapter.java
deleted file mode 100644
index a1ba19d..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30ArtifactRepositoryAdapter.java
+++ /dev/null
@@ -1,278 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.collect.internal;
-
-/*
- * 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.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.artifact.repository.Authentication;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.repository.Proxy;
-import org.sonatype.aether.repository.RemoteRepository;
-import org.sonatype.aether.repository.RepositoryPolicy;
-
-/**
- * ArtifactRepository wrapper around {@link RemoteRepository}
- *
- * @author Robert Scholte
- *
- */
-class Maven30ArtifactRepositoryAdapter implements ArtifactRepository
-{
-
- private RemoteRepository remoteRepository;
-
- /**
- * @param remoteRepository {@link RemoteRepository}
- */
- Maven30ArtifactRepositoryAdapter( RemoteRepository remoteRepository )
- {
- this.remoteRepository = remoteRepository;
- }
-
- @Override
- public String pathOf( Artifact artifact )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getUrl()
- {
- return remoteRepository.getUrl();
- }
-
- @Override
- public void setUrl( String url )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getBasedir()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getProtocol()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getId()
- {
- return remoteRepository.getId();
- }
-
- @Override
- public void setId( String id )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ArtifactRepositoryPolicy getSnapshots()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ArtifactRepositoryPolicy getReleases()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ArtifactRepositoryLayout getLayout()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setLayout( ArtifactRepositoryLayout layout )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getKey()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isUniqueVersion()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isBlacklisted()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setBlacklisted( boolean blackListed )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Artifact find( Artifact artifact )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public List<String> findVersions( Artifact artifact )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean isProjectAware()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setAuthentication( Authentication authentication )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Authentication getAuthentication()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setProxy( Proxy proxy )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Proxy getProxy()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public List<ArtifactRepository> getMirroredRepositories()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories )
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append( " id: " ).append( getId() ).append( "\n" );
- sb.append( " url: " ).append( getUrl() ).append( "\n" );
- sb.append( " layout: " ).append( "default" ).append( "\n" );
-
- RepositoryPolicy snapshotPolicy = remoteRepository.getPolicy( true );
- sb.append( "snapshots: [enabled => " ).append( snapshotPolicy.isEnabled() );
- sb.append( ", update => " ).append( snapshotPolicy.getUpdatePolicy() ).append( "]\n" );
-
- RepositoryPolicy releasePolicy = remoteRepository.getPolicy( false );
- sb.append( " releases: [enabled => " ).append( releasePolicy.isEnabled() );
- sb.append( ", update => " ).append( releasePolicy.getUpdatePolicy() ).append( "]\n" );
-
- return sb.toString();
- }
-
-
- @Override
- public int hashCode()
- {
- return remoteRepository.hashCode();
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null )
- {
- return false;
- }
- if ( getClass() != obj.getClass() )
- {
- return false;
- }
-
- Maven30ArtifactRepositoryAdapter other = (Maven30ArtifactRepositoryAdapter) obj;
- if ( remoteRepository == null )
- {
- if ( other.remoteRepository != null )
- {
- return false;
- }
- }
- else if ( !remoteRepository.equals( other.remoteRepository ) )
- {
- return false;
- }
- return true;
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30CollectorResult.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30CollectorResult.java
deleted file mode 100644
index 926bfe6..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30CollectorResult.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.collect.internal;
-
-/*
- * 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.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.shared.transfer.dependencies.collect.CollectorResult;
-import org.sonatype.aether.collection.CollectResult;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.graph.DependencyVisitor;
-import org.sonatype.aether.repository.RemoteRepository;
-
-/**
- * CollectorResult wrapper around {@link CollectResult}
- *
- * @author Robert Scholte
- *
- */
-class Maven30CollectorResult implements CollectorResult
-{
- private final CollectResult collectResult;
-
- /**
- * @param collectResult {@link CollectorResult}
- */
- Maven30CollectorResult( CollectResult collectResult )
- {
- this.collectResult = collectResult;
- }
-
- @Override
- public List<ArtifactRepository> getRemoteRepositories()
- {
- final Set<RemoteRepository> aetherRepositories = new HashSet<>();
-
- DependencyVisitor visitor = new DependencyVisitor()
- {
- @Override
- public boolean visitEnter( DependencyNode node )
- {
- aetherRepositories.addAll( node.getRepositories() );
- return true;
- }
-
- @Override
- public boolean visitLeave( DependencyNode node )
- {
- return true;
- }
- };
-
- collectResult.getRoot().accept( visitor );
-
- List<ArtifactRepository> mavenRepositories = new ArrayList<>( aetherRepositories.size() );
-
- for ( RemoteRepository aetherRepository : aetherRepositories )
- {
- mavenRepositories.add( new Maven30ArtifactRepositoryAdapter( aetherRepository ) );
- }
-
- return mavenRepositories;
- }
-
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30DependencyCollector.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30DependencyCollector.java
deleted file mode 100644
index bbf2628..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30DependencyCollector.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.collect.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
-import org.apache.maven.shared.transfer.dependencies.collect.CollectorResult;
-import org.apache.maven.shared.transfer.dependencies.collect.DependencyCollectorException;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.artifact.ArtifactTypeRegistry;
-import org.sonatype.aether.collection.CollectRequest;
-import org.sonatype.aether.collection.DependencyCollectionException;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = DependencyCollectorDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30DependencyCollector
- extends DelegateSupport
- implements DependencyCollectorDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- @Requirement
- private ArtifactHandlerManager artifactHandlerManager;
-
- public Maven30DependencyCollector()
- {
- }
-
- public Maven30DependencyCollector( RepositorySystem repositorySystem,
- ArtifactHandlerManager artifactHandlerManager )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- this.artifactHandlerManager = Objects.requireNonNull( artifactHandlerManager );
- }
-
- private static Dependency toDependency( org.apache.maven.model.Dependency mavenDependency,
- ArtifactTypeRegistry typeRegistry )
- {
- return RepositoryUtils.toDependency( mavenDependency, typeRegistry );
- }
-
- @Override
- public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest,
- org.apache.maven.model.Dependency root )
- throws DependencyCollectorException
- {
- ArtifactTypeRegistry typeRegistry = RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager );
-
- CollectRequest request = new CollectRequest();
- request.setRoot( toDependency( root, typeRegistry ) );
-
- return collectDependencies( buildingRequest, request );
- }
-
- @Override
- public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest,
- DependableCoordinate root )
- throws DependencyCollectorException
- {
- ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( root.getType() );
-
- String extension = artifactHandler != null ? artifactHandler.getExtension() : null;
-
- Artifact aetherArtifact = new DefaultArtifact( root.getGroupId(), root.getArtifactId(), root.getClassifier(),
- extension, root.getVersion() );
-
- CollectRequest request = new CollectRequest();
- request.setRoot( new Dependency( aetherArtifact, null ) );
-
- return collectDependencies( buildingRequest, request );
- }
-
- @Override
- public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest,
- Model root )
- throws DependencyCollectorException
- {
- // Are there examples where packaging and type are NOT in sync
- ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( root.getPackaging() );
-
- String extension = artifactHandler != null ? artifactHandler.getExtension() : null;
-
- Artifact aetherArtifact = new DefaultArtifact( root.getGroupId(), root.getArtifactId(), extension,
- root.getVersion() );
-
- CollectRequest request = new CollectRequest();
- request.setRoot( new Dependency( aetherArtifact, null ) );
-
- ArtifactTypeRegistry typeRegistry = RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager );
-
- List<Dependency> aetherDependencies = new ArrayList<>( root.getDependencies().size() );
- for ( org.apache.maven.model.Dependency mavenDependency : root.getDependencies() )
- {
- aetherDependencies.add( toDependency( mavenDependency, typeRegistry ) );
- }
- request.setDependencies( aetherDependencies );
-
- if ( root.getDependencyManagement() != null )
- {
- List<Dependency> aetherManagerDependencies = new ArrayList<>(
- root.getDependencyManagement().getDependencies().size() );
-
- for ( org.apache.maven.model.Dependency mavenDependency : root.getDependencyManagement().getDependencies() )
- {
- aetherManagerDependencies.add( toDependency( mavenDependency, typeRegistry ) );
- }
-
- request.setManagedDependencies( aetherManagerDependencies );
- }
-
- return collectDependencies( buildingRequest, request );
- }
-
- private CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest,
- CollectRequest request )
- throws DependencyCollectorException
- {
- request.setRepositories( RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ) );
-
- try
- {
- return new Maven30CollectorResult( repositorySystem.collectDependencies(
- buildingRequest.getRepositorySession(), request ) );
- }
- catch ( DependencyCollectionException e )
- {
- throw new DependencyCollectorException( e.getMessage(), e );
- }
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30DependencyNodeAdapter.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30DependencyNodeAdapter.java
deleted file mode 100644
index 31bc665..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven30DependencyNodeAdapter.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.collect.internal;
-
-/*
- * 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.ArrayList;
-import java.util.List;
-
-import org.apache.maven.RepositoryUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.shared.transfer.graph.DependencyNode;
-import org.apache.maven.shared.transfer.graph.DependencyVisitor;
-import org.sonatype.aether.repository.RemoteRepository;
-
-/**
- * DependencyCollectorNode wrapper around {@link org.sonatype.aether.graph.DependencyNode}
- *
- * @author Pim Moerenhout
- *
- */
-class Maven30DependencyNodeAdapter implements DependencyNode
-{
-
- private org.sonatype.aether.graph.DependencyNode dependencyNode;
-
- /**
- * @param dependencyNode {@link org.sonatype.aether.graph.DependencyNode}
- */
- Maven30DependencyNodeAdapter( org.sonatype.aether.graph.DependencyNode dependencyNode )
- {
- this.dependencyNode = dependencyNode;
- }
-
- @Override
- public Artifact getArtifact()
- {
- return getArtifact( dependencyNode.getDependency().getArtifact() );
- }
-
- @Override
- public List<DependencyNode> getChildren()
- {
- List<org.sonatype.aether.graph.DependencyNode> aetherChildren = dependencyNode.getChildren();
- List<DependencyNode> children = new ArrayList<>( aetherChildren.size() );
- for ( org.sonatype.aether.graph.DependencyNode aetherChild : aetherChildren )
- {
- children.add( new Maven30DependencyNodeAdapter( aetherChild ) );
- }
- return children;
- }
-
- @Override
- public List<ArtifactRepository> getRemoteRepositories()
- {
- List<RemoteRepository> aetherRepositories = dependencyNode.getRepositories();
- List<ArtifactRepository> mavenRepositories = new ArrayList<>( aetherRepositories.size() );
-
- for ( RemoteRepository aetherRepository : aetherRepositories )
- {
- mavenRepositories.add( new Maven30ArtifactRepositoryAdapter( aetherRepository ) );
- }
-
- return mavenRepositories;
- }
-
- @Override
- public Boolean getOptional()
- {
- return dependencyNode.getDependency().isOptional();
- }
-
- @Override
- public String getScope()
- {
- return dependencyNode.getDependency().getScope();
- }
-
- @Override
- public boolean accept( DependencyVisitor visitor )
- {
- if ( visitor.visitEnter( this ) )
- {
- for ( org.sonatype.aether.graph.DependencyNode child : dependencyNode.getChildren() )
- {
- DependencyNode node = new Maven30DependencyNodeAdapter( child );
- if ( !node.accept( visitor ) )
- {
- break;
- }
- }
- }
-
- return visitor.visitLeave( this );
- }
-
- @Override
- public int hashCode()
- {
- return dependencyNode.hashCode();
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null )
- {
- return false;
- }
- if ( getClass() != obj.getClass() )
- {
- return false;
- }
-
- Maven30DependencyNodeAdapter other = (Maven30DependencyNodeAdapter) obj;
- if ( dependencyNode == null )
- {
- if ( other.dependencyNode != null )
- {
- return false;
- }
- }
- else if ( !dependencyNode.equals( other.dependencyNode ) )
- {
- return false;
- }
- return true;
- }
-
- private Artifact getArtifact( org.sonatype.aether.artifact.Artifact aetherArtifact )
- {
- return RepositoryUtils.toArtifact( aetherArtifact );
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30ArtifactResult.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30ArtifactResult.java
deleted file mode 100644
index 2d33053..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30ArtifactResult.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.resolve.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.sonatype.aether.resolution.ArtifactResult;
-
-/**
- * {@link org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult} wrapper for {@link ArtifactResult}
- *
- * @author Robert Scholte
- * @since 3.0
- */
-class Maven30ArtifactResult implements org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult
-{
- private final ArtifactResult artifactResult;
-
- /**
- * @param artifactResult {@link ArtifactResult}
- */
- Maven30ArtifactResult( ArtifactResult artifactResult )
- {
- this.artifactResult = artifactResult;
- }
-
- @Override
- public org.apache.maven.artifact.Artifact getArtifact()
- {
- return RepositoryUtils.toArtifact( artifactResult.getArtifact() );
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30DependencyResolver.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30DependencyResolver.java
deleted file mode 100644
index a540f0b..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30DependencyResolver.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.resolve.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter;
-import org.apache.maven.shared.artifact.filter.resolve.transform.SonatypeAetherFilterTransformer;
-import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
-import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.artifact.ArtifactType;
-import org.sonatype.aether.artifact.ArtifactTypeRegistry;
-import org.sonatype.aether.collection.CollectRequest;
-import org.sonatype.aether.collection.DependencyCollectionException;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.graph.DependencyFilter;
-import org.sonatype.aether.resolution.ArtifactResolutionException;
-import org.sonatype.aether.resolution.ArtifactResult;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.artifact.DefaultArtifactType;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = DependencyResolverDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30DependencyResolver
- extends DelegateSupport
- implements DependencyResolverDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- @Requirement
- private ArtifactHandlerManager artifactHandlerManager;
-
- public Maven30DependencyResolver()
- {
- }
-
- public Maven30DependencyResolver( RepositorySystem repositorySystem,
- ArtifactHandlerManager artifactHandlerManager )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- this.artifactHandlerManager = Objects.requireNonNull( artifactHandlerManager );
- }
-
- /**
- * Based on RepositoryUtils#toDependency(org.apache.maven.model.Dependency, ArtifactTypeRegistry)
- *
- * @param coordinate {@link DependableCoordinate}
- * @param stereotypes {@link org.sonatype.aether.artifact.ArtifactTypeRegistry
- * @return as Aether Dependency
- */
- private static Dependency toDependency( DependableCoordinate coordinate, ArtifactTypeRegistry stereotypes )
- {
- ArtifactType stereotype = stereotypes.get( coordinate.getType() );
- if ( stereotype == null )
- {
- stereotype = new DefaultArtifactType( coordinate.getType() );
- }
-
- Artifact artifact = new DefaultArtifact( coordinate.getGroupId(), coordinate.getArtifactId(),
- coordinate.getClassifier(), null, coordinate.getVersion(), null, stereotype );
-
- return new Dependency( artifact, null );
- }
-
- private static Dependency toDependency( org.apache.maven.model.Dependency mavenDependency,
- ArtifactTypeRegistry typeRegistry )
- {
- return RepositoryUtils.toDependency( mavenDependency, typeRegistry );
- }
-
- @Override
- public Iterable<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult> resolveDependencies(
- ProjectBuildingRequest buildingRequest,
- DependableCoordinate coordinate,
- TransformableFilter dependencyFilter ) throws DependencyResolverException
- {
- ArtifactTypeRegistry typeRegistry = createTypeRegistry();
-
- Dependency aetherRoot = toDependency( coordinate, typeRegistry );
-
- CollectRequest request = new CollectRequest( aetherRoot,
- RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ) );
-
- return resolveDependencies( buildingRequest, dependencyFilter, request );
- }
-
- private ArtifactTypeRegistry createTypeRegistry()
- {
- return RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager );
- }
-
- @Override
- public Iterable<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult> resolveDependencies(
- ProjectBuildingRequest buildingRequest,
- Model model,
- TransformableFilter dependencyFilter ) throws DependencyResolverException
- {
- // Are there examples where packaging and type are NOT in sync
- ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( model.getPackaging() );
-
- String extension = artifactHandler != null ? artifactHandler.getExtension() : null;
-
- Artifact aetherArtifact = new DefaultArtifact( model.getGroupId(), model.getArtifactId(), extension,
- model.getVersion() );
-
- Dependency aetherRoot = new Dependency( aetherArtifact, null );
-
- CollectRequest request = new CollectRequest( aetherRoot,
- RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ) );
-
- request.setDependencies( resolveDependencies( model.getDependencies() ) );
-
- DependencyManagement mavenDependencyManagement = model.getDependencyManagement();
- if ( mavenDependencyManagement != null )
- {
- request.setManagedDependencies( resolveDependencies( mavenDependencyManagement.getDependencies() ) );
- }
-
- return resolveDependencies( buildingRequest, dependencyFilter, request );
- }
-
- /**
- * @param mavenDependencies {@link org.apache.maven.model.Dependency} can be {@code null}.
- * @return List of resolved dependencies.
- * @throws DependencyResolverException in case of a failure of the typeRegistry error.
- */
- private List<Dependency> resolveDependencies( Collection<org.apache.maven.model.Dependency> mavenDependencies )
- {
- if ( mavenDependencies == null )
- {
- return Collections.emptyList();
- }
-
- ArtifactTypeRegistry typeRegistry = createTypeRegistry();
-
- List<Dependency> aetherDependencies = new ArrayList<>( mavenDependencies.size() );
-
- for ( org.apache.maven.model.Dependency mavenDependency : mavenDependencies )
- {
- aetherDependencies.add( toDependency( mavenDependency, typeRegistry ) );
- }
-
- return aetherDependencies;
- }
-
- @Override
- public Iterable<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult> resolveDependencies(
- ProjectBuildingRequest buildingRequest,
- Collection<org.apache.maven.model.Dependency> mavenDependencies,
- Collection<org.apache.maven.model.Dependency> managedMavenDependencies,
- TransformableFilter filter ) throws DependencyResolverException
- {
- List<Dependency> aetherDependencies = resolveDependencies( mavenDependencies );
-
- List<Dependency> aetherManagedDependencies = resolveDependencies( managedMavenDependencies );
-
- CollectRequest request = new CollectRequest( aetherDependencies, aetherManagedDependencies,
- RepositoryUtils.toRepos( buildingRequest.getRemoteRepositories() ) );
-
- return resolveDependencies( buildingRequest, filter, request );
- }
-
- private Iterable<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult> resolveDependencies(
- ProjectBuildingRequest buildingRequest,
- TransformableFilter dependencyFilter,
- CollectRequest request ) throws DependencyResolverException
- {
- try
- {
- DependencyFilter depFilter = null;
- if ( dependencyFilter != null )
- {
- depFilter = dependencyFilter.transform( new SonatypeAetherFilterTransformer() );
- }
-
- final List<ArtifactResult> dependencyResults = repositorySystem.resolveDependencies(
- buildingRequest.getRepositorySession(), request, depFilter );
-
- // Keep it lazy! Often artifactsResults aren't used, so transforming up front is too expensive
- return new Iterable<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult>()
- {
- @Override
- public Iterator<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult> iterator()
- {
- // CHECKSTYLE_OFF: LineLength
- Collection<org.apache.maven.shared.transfer.artifact.resolve.ArtifactResult> artResults = new ArrayList<>(
- dependencyResults.size() );
- // CHECKSTYLE_ON: LineLength
-
- for ( ArtifactResult artifactResult : dependencyResults )
- {
- artResults.add( new Maven30ArtifactResult( artifactResult ) );
- }
-
- return artResults.iterator();
- }
- };
- }
- catch ( ArtifactResolutionException e )
- {
- throw new Maven30DependencyResolverException( e );
- }
- catch ( DependencyCollectionException e )
- {
- throw new Maven30DependencyResolverException( e );
- }
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30DependencyResolverException.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30DependencyResolverException.java
deleted file mode 100644
index 9b5f6fd..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/dependencies/resolve/internal/Maven30DependencyResolverException.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.maven.shared.transfer.dependencies.resolve.internal;
-
-/*
- * 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.List;
-
-import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException;
-import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResult;
-import org.sonatype.aether.collection.DependencyCollectionException;
-import org.sonatype.aether.resolution.ArtifactResolutionException;
-
-/**
- *
- * @author Robert Scholte
- *
- */
-class Maven30DependencyResolverException extends DependencyResolverException
-{
- private DependencyCollectionException dce;
-
- protected Maven30DependencyResolverException( DependencyCollectionException e )
- {
- super( e );
- this.dce = e;
- }
-
- Maven30DependencyResolverException( ArtifactResolutionException e )
- {
- super( e );
- }
-
- @Override
- public DependencyResult getResult()
- {
- return new DependencyResult()
- {
- @Override
- public List<Exception> getCollectorExceptions()
- {
- return dce.getResult().getExceptions();
- }
- };
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/metadata/internal/Maven30MetadataBridge.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/metadata/internal/Maven30MetadataBridge.java
deleted file mode 100644
index fde00a8..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/metadata/internal/Maven30MetadataBridge.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.maven.shared.transfer.metadata.internal;
-
-/*
- * 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 org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.sonatype.aether.metadata.Metadata;
-
-/**
- * A MetadataBridge for Maven 3.0
- *
- * @author Robert Scholte
- *
- */
-public class Maven30MetadataBridge implements Metadata
-{
- private ArtifactMetadata metadata;
-
- private File file;
-
- public Maven30MetadataBridge( ArtifactMetadata metadata )
- {
- this.metadata = metadata;
- }
-
- @Override
- public String getGroupId()
- {
- return emptify( metadata.getGroupId() );
- }
-
- @Override
- public String getArtifactId()
- {
- return metadata.storedInGroupDirectory() ? "" : emptify( metadata.getArtifactId() );
- }
-
- @Override
- public String getVersion()
- {
- return metadata.storedInArtifactVersionDirectory() ? emptify( metadata.getBaseVersion() ) : "";
- }
-
- @Override
- public String getType()
- {
- return metadata.getRemoteFilename();
- }
-
- private String emptify( String string )
- {
- return ( string != null ) ? string : "";
- }
-
- @Override
- public File getFile()
- {
- return file;
- }
-
- @Override
- public Maven30MetadataBridge setFile( File file )
- {
- this.file = file;
- return this;
- }
-
- @Override
- public Nature getNature()
- {
- if ( metadata instanceof RepositoryMetadata )
- {
- switch ( ( (RepositoryMetadata) metadata ).getNature() )
- {
- case RepositoryMetadata.RELEASE_OR_SNAPSHOT:
- return Nature.RELEASE_OR_SNAPSHOT;
- case RepositoryMetadata.SNAPSHOT:
- return Nature.SNAPSHOT;
- default:
- return Nature.RELEASE;
- }
- }
- else
- {
- return Nature.RELEASE;
- }
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/repository/internal/Maven30RepositoryManager.java b/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/repository/internal/Maven30RepositoryManager.java
deleted file mode 100644
index 45c7f64..0000000
--- a/maven-3.0.x/src/main/java/org/apache/maven/shared/transfer/repository/internal/Maven30RepositoryManager.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.apache.maven.shared.transfer.repository.internal;
-
-/*
- * 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.RepositoryUtils;
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.project.DefaultProjectBuildingRequest;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
-import org.apache.maven.shared.transfer.support.DelegateSupport;
-import org.apache.maven.shared.transfer.support.Selector;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.RepositorySystemSession;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.metadata.Metadata;
-import org.sonatype.aether.metadata.Metadata.Nature;
-import org.sonatype.aether.repository.LocalRepository;
-import org.sonatype.aether.repository.LocalRepositoryManager;
-import org.sonatype.aether.util.DefaultRepositoryCache;
-import org.sonatype.aether.util.DefaultRepositorySystemSession;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.metadata.DefaultMetadata;
-
-import java.io.File;
-import java.util.Objects;
-
-/**
- *
- */
-@Component( role = RepositoryManagerDelegate.class, hint = Selector.MAVEN_3_0_X )
-public class Maven30RepositoryManager
- extends DelegateSupport
- implements RepositoryManagerDelegate
-{
- @Requirement
- private RepositorySystem repositorySystem;
-
- public Maven30RepositoryManager()
- {
- }
-
- public Maven30RepositoryManager( RepositorySystem repositorySystem )
- {
- this.repositorySystem = Objects.requireNonNull( repositorySystem );
- }
-
- @Override
- public String getPathForLocalArtifact( ProjectBuildingRequest buildingRequest,
- org.apache.maven.artifact.Artifact mavenArtifact )
- {
- Artifact aetherArtifact = RepositoryUtils.toArtifact( mavenArtifact );
-
- return buildingRequest.getRepositorySession().getLocalRepositoryManager().getPathForLocalArtifact(
- aetherArtifact );
- }
-
- @Override
- public String getPathForLocalArtifact( ProjectBuildingRequest buildingRequest,
- ArtifactCoordinate coordinate )
- {
- Artifact aetherArtifact = toArtifact( coordinate );
-
- // LRM.getPathForLocalArtifact() won't throw an Exception, so translate reflection error to RuntimeException
-
- return buildingRequest.getRepositorySession().getLocalRepositoryManager().getPathForLocalArtifact(
- aetherArtifact );
- }
-
- @Override
- public String getPathForLocalMetadata( ProjectBuildingRequest buildingRequest,
- ArtifactMetadata metadata )
- {
- Metadata aetherMetadata = new DefaultMetadata( metadata.getGroupId(),
- metadata.storedInGroupDirectory() ? null : metadata.getArtifactId(),
- metadata.storedInArtifactVersionDirectory() ? metadata.getBaseVersion() : null, "maven-metadata.xml",
- Nature.RELEASE_OR_SNAPSHOT );
-
- return buildingRequest.getRepositorySession().getLocalRepositoryManager().getPathForLocalMetadata(
- aetherMetadata );
- }
-
- @Override
- public ProjectBuildingRequest setLocalRepositoryBasedir( ProjectBuildingRequest buildingRequest,
- File basedir )
- {
- ProjectBuildingRequest newRequest = new DefaultProjectBuildingRequest( buildingRequest );
-
- RepositorySystemSession session = buildingRequest.getRepositorySession();
-
- // "clone" session and replace localRepository
- DefaultRepositorySystemSession newSession = new DefaultRepositorySystemSession( session );
-
- // Clear cache, since we're using a new local repository
- newSession.setCache( new DefaultRepositoryCache() );
-
- // keep same repositoryType
- String repositoryType = resolveRepositoryType( session.getLocalRepository() );
-
- LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
- new LocalRepository( basedir, repositoryType ) );
-
- newSession.setLocalRepositoryManager( localRepositoryManager );
-
- newRequest.setRepositorySession( newSession );
-
- return newRequest;
- }
-
- @Override
- public File getLocalRepositoryBasedir( ProjectBuildingRequest buildingRequest )
- {
- return buildingRequest.getRepositorySession().getLocalRepository().getBasedir();
- }
-
- /**
- * Aether-1.9+ (i.e. M3.0.2+) expects "default", not "enhanced" as repositoryType
- */
- private String resolveRepositoryType( LocalRepository localRepository )
- {
- String repositoryType;
- if ( "enhanced".equals( localRepository.getContentType() ) )
- {
- repositoryType = "default";
- }
- else
- {
- // this should be "simple"
- repositoryType = localRepository.getContentType();
- }
- return repositoryType;
- }
-
- /**
- * @param coordinate {@link ArtifactCoordinate}
- * @return {@link Artifact}
- */
- private Artifact toArtifact( ArtifactCoordinate coordinate )
- {
- if ( coordinate == null )
- {
- return null;
- }
-
- Artifact result = new DefaultArtifact( coordinate.getGroupId(), coordinate.getArtifactId(),
- coordinate.getClassifier(), coordinate.getExtension(), coordinate.getVersion() );
-
- return result;
- }
-}
diff --git a/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/AbstractArtifact.java b/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/AbstractArtifact.java
deleted file mode 100644
index 1e48f78..0000000
--- a/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/AbstractArtifact.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.sonatype.aether.util.artifact;
-
-/*
- * 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.
- */
-
-/*
- * Copyright (c) 2010 Sonatype, Inc. All rights reserved.
- *
- * This program is licensed to you under the Apache License Version 2.0,
- * and you may not use this file except in compliance with the Apache License Version 2.0.
- * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the Apache License Version 2.0 is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
- */
-
-import org.sonatype.aether.artifact.Artifact;
-
-import java.io.File;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A skeleton class for artifacts that implements {@link Object#equals(Object)}, {@link Object#hashCode()} and
- * {@link Object#toString()}.
- *
- * Note: this is a one-to-one copy of same class from org.sonatype.aether:aether-util:1.13.1 (used in Maven 3.0,5),
- * as Maven 3.0.5 does NOT EXPORT aether util package to plugins.
- *
- * @author Benjamin Bentmann
- */
-public abstract class AbstractArtifact
- implements Artifact
-{
-
- private static final String SNAPSHOT = "SNAPSHOT";
-
- private static final Pattern SNAPSHOT_TIMESTAMP = Pattern.compile( "^(.*-)?([0-9]{8}.[0-9]{6}-[0-9]+)$" );
-
- protected static boolean isSnapshot( String version )
- {
- return version.endsWith( SNAPSHOT ) || SNAPSHOT_TIMESTAMP.matcher( version ).matches();
- }
-
- protected static String toBaseVersion( String version )
- {
- String baseVersion;
-
- if ( version == null )
- {
- baseVersion = version;
- }
- else if ( version.startsWith( "[" ) || version.startsWith( "(" ) )
- {
- baseVersion = version;
- }
- else
- {
- Matcher m = SNAPSHOT_TIMESTAMP.matcher( version );
- if ( m.matches() )
- {
- if ( m.group( 1 ) != null )
- {
- baseVersion = m.group( 1 ) + SNAPSHOT;
- }
- else
- {
- baseVersion = SNAPSHOT;
- }
- }
- else
- {
- baseVersion = version;
- }
- }
-
- return baseVersion;
- }
-
- public Artifact setVersion( String version )
- {
- if ( getVersion().equals( version ) )
- {
- return this;
- }
- return new DefaultArtifact( getGroupId(), getArtifactId(), getClassifier(), getExtension(), version, getFile(),
- getProperties() );
- }
-
- public Artifact setFile( File file )
- {
- if ( eq( getFile(), file ) )
- {
- return this;
- }
- return new DefaultArtifact( getGroupId(), getArtifactId(), getClassifier(), getExtension(), getVersion(), file,
- getProperties() );
- }
-
- public Artifact setProperties( Map<String, String> properties )
- {
- if ( getProperties().equals( properties ) )
- {
- return this;
- }
- return new DefaultArtifact( getGroupId(), getArtifactId(), getClassifier(), getExtension(), getVersion(),
- properties, getFile() );
- }
-
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder( 128 );
- buffer.append( getGroupId() );
- buffer.append( ':' ).append( getArtifactId() );
- buffer.append( ':' ).append( getExtension() );
- if ( getClassifier().length() > 0 )
- {
- buffer.append( ':' ).append( getClassifier() );
- }
- buffer.append( ':' ).append( getVersion() );
- return buffer.toString();
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( obj == this )
- {
- return true;
- }
- else if ( !( obj instanceof Artifact ) )
- {
- return false;
- }
-
- Artifact that = (Artifact) obj;
-
- return getArtifactId().equals( that.getArtifactId() ) && getGroupId().equals( that.getGroupId() )
- && getVersion().equals( that.getVersion() ) && getExtension().equals( that.getExtension() )
- && getClassifier().equals( that.getClassifier() ) && eq( getFile(), that.getFile() )
- && getProperties().equals( that.getProperties() );
- }
-
- private static <T> boolean eq( T s1, T s2 )
- {
- return s1 != null ? s1.equals( s2 ) : s2 == null;
- }
-
- @Override
- public int hashCode()
- {
- int hash = 17;
- hash = hash * 31 + getGroupId().hashCode();
- hash = hash * 31 + getArtifactId().hashCode();
- hash = hash * 31 + getExtension().hashCode();
- hash = hash * 31 + getClassifier().hashCode();
- hash = hash * 31 + getVersion().hashCode();
- hash = hash * 31 + getProperties().hashCode();
- hash = hash * 31 + hash( getFile() );
- return hash;
- }
-
- private static int hash( Object obj )
- {
- return ( obj != null ) ? obj.hashCode() : 0;
- }
-
-}
diff --git a/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/DefaultArtifact.java b/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/DefaultArtifact.java
deleted file mode 100644
index fc02aff..0000000
--- a/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/DefaultArtifact.java
+++ /dev/null
@@ -1,360 +0,0 @@
-package org.sonatype.aether.util.artifact;
-
-/*
- * 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.
- */
-
-/*
- * Copyright (c) 2010 Sonatype, Inc. All rights reserved.
- *
- * This program is licensed to you under the Apache License Version 2.0,
- * and you may not use this file except in compliance with the Apache License Version 2.0.
- * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the Apache License Version 2.0 is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
- */
-
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.artifact.ArtifactType;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A simple artifact.
- *
- * Note: this is a one-to-one copy of same class from org.sonatype.aether:aether-util:1.13.1 (used in Maven 3.0,5),
- * as Maven 3.0.5 does NOT EXPORT aether util package to plugins.
- *
- * @author Benjamin Bentmann
- */
-public final class DefaultArtifact
- extends AbstractArtifact
-{
-
- private final String groupId;
-
- private final String artifactId;
-
- private final String version;
-
- private final String classifier;
-
- private final String extension;
-
- private final File file;
-
- private final Map<String, String> properties;
-
- private String baseVersion;
-
- /**
- * Creates a new artifact with the specified coordinates.
- *
- * @param coords The artifact coordinates in the format
- * {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}, must not be {@code null}.
- */
- public DefaultArtifact( String coords )
- {
- this( coords, Collections.<String, String>emptyMap() );
- }
-
- /**
- * Creates a new artifact with the specified coordinates and properties.
- *
- * @param coords The artifact coordinates in the format
- * {@code <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>}, must not be {@code null}.
- * @param properties The artifact properties, may be {@code null}.
- */
- public DefaultArtifact( String coords, Map<String, String> properties )
- {
- Pattern p = Pattern.compile( "([^: ]+):([^: ]+)(:([^: ]*)(:([^: ]+))?)?:([^: ]+)" );
- Matcher m = p.matcher( coords );
- if ( !m.matches() )
- {
- throw new IllegalArgumentException( "Bad artifact coordinates"
- + ", expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>" );
- }
- groupId = m.group( 1 );
- artifactId = m.group( 2 );
- extension = get( m.group( 4 ), "jar" );
- classifier = get( m.group( 6 ), "" );
- version = m.group( 7 );
- file = null;
- if ( properties != null && !properties.isEmpty() )
- {
- this.properties = new HashMap<String, String>( properties );
- }
- else
- {
- this.properties = Collections.emptyMap();
- }
- }
-
- private static String get( String value, String defaultValue )
- {
- return ( value == null || value.length() <= 0 ) ? defaultValue : value;
- }
-
- /**
- * Creates a new artifact with the specified coordinates.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- */
- public DefaultArtifact( String groupId, String artifactId, String extension, String version )
- {
- this( groupId, artifactId, "", extension, version );
- }
-
- /**
- * Creates a new artifact with the specified coordinates.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- */
- public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version )
- {
- this( groupId, artifactId, classifier, extension, version, null, (File) null );
- }
-
- /**
- * Creates a new artifact with the specified coordinates. The optional artifact type provided to this constructor
- * will be used to determine the artifact's classifier and file extension if the corresponding arguments for this
- * constructor are {@code null}.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- * @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}.
- */
- public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version,
- ArtifactType type )
- {
- this( groupId, artifactId, classifier, extension, version, null, type );
- }
-
- /**
- * Creates a new artifact with the specified coordinates and properties. The optional artifact type provided to this
- * constructor will be used to determine the artifact's classifier and file extension if the corresponding arguments
- * for this constructor are {@code null}. If the artifact type specifies properties, those will get merged with the
- * properties passed directly into the constructor, with the latter properties taking precedence.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- * @param properties The properties of the artifact, may be {@code null}.
- * @param type The artifact type from which to query classifier, file extension and properties, may be {@code null}.
- */
- public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version,
- Map<String, String> properties, ArtifactType type )
- {
- this.groupId = emptify( groupId );
- this.artifactId = emptify( artifactId );
- if ( classifier != null || type == null )
- {
- this.classifier = emptify( classifier );
- }
- else
- {
- this.classifier = emptify( type.getClassifier() );
- }
- if ( extension != null || type == null )
- {
- this.extension = emptify( extension );
- }
- else
- {
- this.extension = emptify( type.getExtension() );
- }
- this.version = emptify( version );
- this.file = null;
- this.properties = merge( properties, ( type != null ) ? type.getProperties() : null );
- }
-
- private static Map<String, String> merge( Map<String, String> dominant, Map<String, String> recessive )
- {
- Map<String, String> properties;
-
- if ( ( dominant == null || dominant.isEmpty() ) && ( recessive == null || recessive.isEmpty() ) )
- {
- properties = Collections.emptyMap();
- }
- else
- {
- properties = new HashMap<String, String>();
- if ( recessive != null )
- {
- properties.putAll( recessive );
- }
- if ( dominant != null )
- {
- properties.putAll( dominant );
- }
- }
-
- return properties;
- }
-
- /**
- * Creates a new artifact with the specified coordinates, properties and file.
- *
- * @param groupId The group identifier of the artifact, may be {@code null}.
- * @param artifactId The artifact identifier of the artifact, may be {@code null}.
- * @param classifier The classifier of the artifact, may be {@code null}.
- * @param extension The file extension of the artifact, may be {@code null}.
- * @param version The version of the artifact, may be {@code null}.
- * @param properties The properties of the artifact, may be {@code null}.
- * @param file The resolved file of the artifact, may be {@code null}.
- */
- public DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version,
- Map<String, String> properties, File file )
- {
- this.groupId = emptify( groupId );
- this.artifactId = emptify( artifactId );
- this.classifier = emptify( classifier );
- this.extension = emptify( extension );
- this.version = emptify( version );
- this.file = file;
- if ( properties != null && !properties.isEmpty() )
- {
- this.properties = new HashMap<String, String>( properties );
- }
- else
- {
- this.properties = Collections.emptyMap();
- }
- }
-
- DefaultArtifact( String groupId, String artifactId, String classifier, String extension, String version, File file,
- Map<String, String> properties )
- {
- // NOTE: This constructor assumes immutability of the provided properties, for internal use only
- this.groupId = emptify( groupId );
- this.artifactId = emptify( artifactId );
- this.classifier = emptify( classifier );
- this.extension = emptify( extension );
- this.version = emptify( version );
- this.file = file;
- this.properties = properties;
- }
-
- private static String emptify( String str )
- {
- return ( str == null ) ? "" : str;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public String getArtifactId()
- {
- return artifactId;
- }
-
- public String getBaseVersion()
- {
- if ( baseVersion == null )
- {
- baseVersion = toBaseVersion( getVersion() );
- }
- return baseVersion;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public Artifact setVersion( String version )
- {
- if ( this.version.equals( version ) || ( version == null && this.version.length() <= 0 ) )
- {
- return this;
- }
- return new DefaultArtifact( groupId, artifactId, classifier, extension, version, file, properties );
- }
-
- public boolean isSnapshot()
- {
- return isSnapshot( getVersion() );
- }
-
- public String getClassifier()
- {
- return classifier;
- }
-
- public String getExtension()
- {
- return extension;
- }
-
- public File getFile()
- {
- return file;
- }
-
- public Artifact setFile( File file )
- {
- if ( ( this.file == null ) ? file == null : this.file.equals( file ) )
- {
- return this;
- }
- return new DefaultArtifact( groupId, artifactId, classifier, extension, version, file, properties );
- }
-
- public String getProperty( String key, String defaultValue )
- {
- String value = properties.get( key );
- return ( value != null ) ? value : defaultValue;
- }
-
- public Map<String, String> getProperties()
- {
- return Collections.unmodifiableMap( properties );
- }
-
- public Artifact setProperties( Map<String, String> properties )
- {
- if ( this.properties.equals( properties ) || ( properties == null && this.properties.isEmpty() ) )
- {
- return this;
- }
- return new DefaultArtifact( groupId, artifactId, classifier, extension, version, properties, file );
- }
-
-}
diff --git a/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/SubArtifact.java b/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/SubArtifact.java
deleted file mode 100644
index b70a5a7..0000000
--- a/maven-3.0.x/src/main/java/org/sonatype/aether/util/artifact/SubArtifact.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package org.sonatype.aether.util.artifact;
-
-/*
- * 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.
- */
-
-/*
- * Copyright (c) 2010 Sonatype, Inc. All rights reserved.
- *
- * This program is licensed to you under the Apache License Version 2.0,
- * and you may not use this file except in compliance with the Apache License Version 2.0.
- * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the Apache License Version 2.0 is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
- */
-
-import org.sonatype.aether.artifact.Artifact;
-
-import java.io.File;
-import java.util.Map;
-
-/**
- * An artifact whose identity is derived from another artifact.
- *
- * Note: this is a one-to-one copy of same class from org.sonatype.aether:aether-util:1.13.1 (used in Maven 3.0,5),
- * as Maven 3.0.5 does NOT EXPORT aether util package to plugins.
- *
- * @author Benjamin Bentmann
- */
-public final class SubArtifact
- extends AbstractArtifact
-{
-
- private final Artifact mainArtifact;
-
- private final String classifier;
-
- private final String extension;
-
- private final File file;
-
- /**
- * Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk
- * character "*" to refer to the corresponding property of the main artifact. For instance, the classifier
- * "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be
- * used to refer to the GPG signature of an artifact.
- *
- * @param mainArtifact The artifact from which to derive the identity, must not be {@code null}.
- * @param classifier The classifier for this artifact, may be {@code null} if none.
- * @param extension The extension for this artifact, may be {@code null} if none.
- */
- public SubArtifact( Artifact mainArtifact, String classifier, String extension )
- {
- this( mainArtifact, classifier, extension, null );
- }
-
- /**
- * Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk
- * character "*" to refer to the corresponding property of the main artifact. For instance, the classifier
- * "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be
- * used to refer to the GPG signature of an artifact.
- *
- * @param mainArtifact The artifact from which to derive the identity, must not be {@code null}.
- * @param classifier The classifier for this artifact, may be {@code null} if none.
- * @param extension The extension for this artifact, may be {@code null} if none.
- * @param file The file for this artifact, may be {@code null} if unresolved.
- */
- public SubArtifact( Artifact mainArtifact, String classifier, String extension, File file )
- {
- if ( mainArtifact == null )
- {
- throw new IllegalArgumentException( "no artifact specified" );
- }
- this.mainArtifact = mainArtifact;
- this.classifier = classifier;
- this.extension = extension;
- this.file = file;
- }
-
- public String getGroupId()
- {
- return mainArtifact.getGroupId();
- }
-
- public String getArtifactId()
- {
- return mainArtifact.getArtifactId();
- }
-
- public String getVersion()
- {
- return mainArtifact.getVersion();
- }
-
- public Artifact setVersion( String version )
- {
- return new DefaultArtifact( getGroupId(), getArtifactId(), getClassifier(), getExtension(), version, getFile(),
- getProperties() );
- }
-
- public String getBaseVersion()
- {
- return mainArtifact.getBaseVersion();
- }
-
- public boolean isSnapshot()
- {
- return mainArtifact.isSnapshot();
- }
-
- public String getClassifier()
- {
- return expand( classifier, mainArtifact.getClassifier() );
- }
-
- public String getExtension()
- {
- return expand( extension, mainArtifact.getExtension() );
- }
-
- public File getFile()
- {
- return file;
- }
-
- public Artifact setFile( File file )
- {
- if ( ( this.file == null ) ? file == null : this.file.equals( file ) )
- {
- return this;
- }
- return new SubArtifact( mainArtifact, classifier, extension, file );
- }
-
- public String getProperty( String key, String defaultValue )
- {
- return mainArtifact.getProperty( key, defaultValue );
- }
-
- public Map<String, String> getProperties()
- {
- return mainArtifact.getProperties();
- }
-
- private static String expand( String pattern, String replacement )
- {
- String result = "";
- if ( pattern != null )
- {
- result = pattern.replace( "*", replacement );
-
- if ( replacement.length() <= 0 )
- {
- if ( pattern.startsWith( "*" ) )
- {
- int i = 0;
- for ( ; i < result.length(); i++ )
- {
- char c = result.charAt( i );
- if ( c != '-' && c != '.' )
- {
- break;
- }
- }
- result = result.substring( i );
- }
- if ( pattern.endsWith( "*" ) )
- {
- int i = result.length() - 1;
- for ( ; i >= 0; i-- )
- {
- char c = result.charAt( i );
- if ( c != '-' && c != '.' )
- {
- break;
- }
- }
- result = result.substring( 0, i + 1 );
- }
- }
- }
- return result;
- }
-
-}
diff --git a/maven-3.0.x/src/test/java/org/apache/maven/shared/transfer/artifact/install/internal/Maven30ArtifactInstallerTest.java b/maven-3.0.x/src/test/java/org/apache/maven/shared/transfer/artifact/install/internal/Maven30ArtifactInstallerTest.java
deleted file mode 100644
index 61ef91f..0000000
--- a/maven-3.0.x/src/test/java/org/apache/maven/shared/transfer/artifact/install/internal/Maven30ArtifactInstallerTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.apache.maven.shared.transfer.artifact.install.internal;
-
-/*
- * 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.util.Arrays;
-import java.util.Collection;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.project.DefaultProjectBuildingRequest;
-import org.apache.maven.repository.internal.MavenRepositorySystemSession;
-import org.apache.maven.shared.transfer.repository.RepositoryManager;
-import org.apache.maven.shared.transfer.repository.internal.Maven30RepositoryManager;
-import org.codehaus.plexus.PlexusTestCase;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
-
-public class Maven30ArtifactInstallerTest extends PlexusTestCase
-{
- private final File localRepo = new File( "target/tests/local-repo" );
-
- private RepositorySystem repositorySystem;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- repositorySystem = lookup( RepositorySystem.class );
- }
-
- public void testInstall() throws Exception
- {
- DefaultProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
- MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
- repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) );
- buildingRequest.setRepositorySession( repositorySession );
-
- RepositoryManager repositoryManager = new Maven30RepositoryManager( repositorySystem );
-
- DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler();
- artifactHandler.setExtension( "EXTENSION" );
-
- File artifactsDirectory = new File( "target/tests/artifacts" );
- artifactsDirectory.mkdirs();
- File tmpFile = File.createTempFile( "test-install", ".jar", artifactsDirectory );
-
- DefaultArtifact artifact = new DefaultArtifact( "GROUPID", "ARTIFACTID", "VERSION", "compile", "jar", null, artifactHandler );
- artifact.setFile( tmpFile );
- DefaultArtifact artifactWithClassifier = new DefaultArtifact( "GROUPID", "ARTIFACTID", "VERSION", "compile", "jar", "CLASSIFIER", artifactHandler );
- artifactWithClassifier.setFile( tmpFile );
-
- Collection<Artifact> mavenArtifacts = Arrays.<Artifact>asList( artifact, artifactWithClassifier );
-
- ArtifactInstallerDelegate installer = new Maven30ArtifactInstaller( repositorySystem, repositoryManager );
- installer.install( buildingRequest, mavenArtifacts );
-
- assertTrue( new File( localRepo, "GROUPID/ARTIFACTID/VERSION/ARTIFACTID-VERSION.EXTENSION" ).exists() );
- assertTrue( new File( localRepo, "GROUPID/ARTIFACTID/VERSION/ARTIFACTID-VERSION-CLASSIFIER.EXTENSION" ).exists() );
- assertTrue( new File( localRepo, "GROUPID/ARTIFACTID/maven-metadata-local.xml" ).exists() ); //??
- }
-}
diff --git a/maven-3.0.x/src/test/java/org/apache/maven/shared/transfer/repository/internal/Maven30RepositoryManagerTest.java b/maven-3.0.x/src/test/java/org/apache/maven/shared/transfer/repository/internal/Maven30RepositoryManagerTest.java
deleted file mode 100644
index ce900c8..0000000
--- a/maven-3.0.x/src/test/java/org/apache/maven/shared/transfer/repository/internal/Maven30RepositoryManagerTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.maven.shared.transfer.repository.internal;
-
-/*
- * 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 org.apache.maven.project.DefaultProjectBuildingRequest;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.repository.internal.MavenRepositorySystemSession;
-import org.codehaus.plexus.PlexusTestCase;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager;
-import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
-
-public class Maven30RepositoryManagerTest extends PlexusTestCase
-{
- private final File localRepo = new File( "target/tests/local-repo" );
-
- private RepositorySystem repositorySystem;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- repositorySystem = lookup( RepositorySystem.class );
- }
-
- public void testSetLocalRepositoryBasedirSimple()
- {
- DefaultProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
- MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
- repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) );
- buildingRequest.setRepositorySession( repositorySession );
-
- File basedir = new File( "NEW/LOCAL/REPO" );
-
- Maven30RepositoryManager repositoryManager =
- new Maven30RepositoryManager( repositorySystem );
-
- ProjectBuildingRequest newBuildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, basedir );
-
- assertEquals( basedir.getAbsoluteFile(), newBuildingRequest.getRepositorySession().getLocalRepository().getBasedir() );
- }
-
- public void testSetLocalRepositoryBasedirEnhanced()
- {
- DefaultProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
- MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
- repositorySession.setLocalRepositoryManager( new EnhancedLocalRepositoryManager( localRepo ) );
- buildingRequest.setRepositorySession( repositorySession );
-
- File basedir = new File( "NEW/LOCAL/REPO" );
-
- Maven30RepositoryManager repositoryManager =
- new Maven30RepositoryManager( repositorySystem );
-
- ProjectBuildingRequest newBuildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, basedir );
-
- assertEquals( basedir.getAbsoluteFile(), newBuildingRequest.getRepositorySession().getLocalRepository().getBasedir() );
- }
-}
diff --git a/maven-3.1.x/pom.xml b/maven-3.1.x/pom.xml
index 911076b..cc45621 100644
--- a/maven-3.1.x/pom.xml
+++ b/maven-3.1.x/pom.xml
@@ -46,7 +46,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
- <version>${maven31x.version}</version>
+ <version>${maven.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -58,13 +58,13 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
- <version>${maven31x.version}</version>
+ <version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
- <version>${maven31x.version}</version>
+ <version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -81,21 +81,19 @@
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-api</artifactId>
- <version>${maven31xEclipseAether.version}</version>
- <scope>provided</scope>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-api</artifactId>
+ <version>${mavenResolver.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-util</artifactId>
- <version>${maven31xEclipseAether.version}</version>
- <scope>provided</scope>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-util</artifactId>
+ <version>${mavenResolver.version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.aether</groupId>
- <artifactId>aether-impl</artifactId>
- <version>${maven31xEclipseAether.version}</version>
+ <groupId>org.apache.maven.resolver</groupId>
+ <artifactId>maven-resolver-impl</artifactId>
+ <version>${mavenResolver.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven31ArtifactRepositoryAdapter.java b/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven31ArtifactRepositoryAdapter.java
index 27461cc..af64f62 100644
--- a/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven31ArtifactRepositoryAdapter.java
+++ b/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/collection/internal/Maven31ArtifactRepositoryAdapter.java
@@ -219,6 +219,18 @@ class Maven31ArtifactRepositoryAdapter implements ArtifactRepository
}
@Override
+ public boolean isBlocked()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setBlocked( boolean blocked )
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public String toString()
{
StringBuilder sb = new StringBuilder();
diff --git a/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven31ArtifactRepositoryAdapter.java b/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven31ArtifactRepositoryAdapter.java
index 6f40e09..b3ab886 100644
--- a/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven31ArtifactRepositoryAdapter.java
+++ b/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/dependencies/collect/internal/Maven31ArtifactRepositoryAdapter.java
@@ -219,6 +219,18 @@ class Maven31ArtifactRepositoryAdapter implements ArtifactRepository
}
@Override
+ public boolean isBlocked()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setBlocked( boolean blocked )
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public String toString()
{
StringBuilder sb = new StringBuilder();
diff --git a/maven-artifact-transfer/pom.xml b/maven-artifact-transfer/pom.xml
index ae7ded5..8cc4795 100644
--- a/maven-artifact-transfer/pom.xml
+++ b/maven-artifact-transfer/pom.xml
@@ -31,7 +31,7 @@
<name>Apache Maven Artifact Transfer</name>
<properties>
- <downstreamMaven.version>3.1.1</downstreamMaven.version>
+ <downstreamMaven.version>4.0.0-alpha-1-SNAPSHOT</downstreamMaven.version>
</properties>
<dependencies>
diff --git a/pom.xml b/pom.xml
index ec14947..22811cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
- <version>34</version>
+ <version>35-SNAPSHOT</version>
<relativePath>../../pom/maven/maven-shared-components/pom.xml</relativePath>
</parent>
@@ -57,26 +57,26 @@
</distributionManagement>
<properties>
- <javaVersion>7</javaVersion>
+ <javaVersion>8</javaVersion>
<project.build.outputTimestamp>2020-12-22T10:32:11Z</project.build.outputTimestamp>
<sisu.version>0.3.5</sisu.version>
<guice.version>3.2.6</guice.version>
<maven.baseVersion>3.1.0</maven.baseVersion>
- <artifactFilters.version>3.1.0</artifactFilters.version>
+ <artifactFilters.version>3.2.1-SNAPSHOT</artifactFilters.version>
<!-- maven-3.0.x runtime -->
<maven30x.version>3.0.5</maven30x.version>
<maven30xSonatypeAether.version>1.13.1</maven30xSonatypeAether.version>
<maven30xSonatypeSisu.version>2.3.0</maven30xSonatypeSisu.version>
<!-- maven 3.1.x runtime -->
- <maven31x.version>3.1.1</maven31x.version>
- <maven31xEclipseAether.version>0.9.0.M2</maven31xEclipseAether.version>
+ <maven.version>4.0.0-alpha-1-SNAPSHOT</maven.version>
+ <mavenResolver.version>1.8.0-SNAPSHOT</mavenResolver.version>
+ <maven31xEclipseAether.version>1.1.0</maven31xEclipseAether.version>
<maven31xEclipseSisu.version>0.3.5</maven31xEclipseSisu.version>
</properties>
<modules>
<module>maven-artifact-transfer-api</module>
- <module>maven-3.0.x</module>
<module>maven-3.1.x</module>
<module>maven-artifact-transfer</module>
</modules>
@@ -217,7 +217,7 @@
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
- <artifactId>java17</artifactId>
+ <artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>