Added: maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven30DependencyResolver.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven30DependencyResolver.java?rev=1747984&view=auto ============================================================================== --- maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven30DependencyResolver.java (added) +++ maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven30DependencyResolver.java Sun Jun 12 12:02:29 2016 @@ -0,0 +1,234 @@ +package org.apache.maven.shared.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.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.RepositoryUtils; +import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; +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.dependencies.DependableCoordinate; +import org.apache.maven.shared.dependencies.resolve.DependencyResolver; +import org.apache.maven.shared.dependencies.resolve.DependencyResolverException; +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.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.repository.RemoteRepository; +import org.sonatype.aether.resolution.ArtifactRequest; +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; + +/** + * + */ +@Component( role = DependencyResolver.class, hint = "maven3" ) +public class Maven30DependencyResolver + implements DependencyResolver +{ + @Requirement + private RepositorySystem repositorySystem; + + @Requirement + private ArtifactHandlerManager artifactHandlerManager; + + @Override + // CHECKSTYLE_OFF: LineLength + public Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, + DependableCoordinate coordinate, + TransformableFilter dependencyFilter ) + // CHECKSTYLE_ON: + // LineLength + throws DependencyResolverException + { + ArtifactTypeRegistry typeRegistry = + (ArtifactTypeRegistry) Invoker.invoke( RepositoryUtils.class, "newArtifactTypeRegistry", + ArtifactHandlerManager.class, artifactHandlerManager ); + + Dependency aetherRoot = toDependency( coordinate, typeRegistry ); + + @SuppressWarnings( "unchecked" ) + List<RemoteRepository> aetherRepositories = + (List<RemoteRepository>) Invoker.invoke( RepositoryUtils.class, "toRepos", List.class, + buildingRequest.getRemoteRepositories() ); + + CollectRequest request = new CollectRequest( aetherRoot, aetherRepositories ); + + return resolveDependencies( buildingRequest, aetherRepositories, dependencyFilter, request ); + } + + @Override + // CHECKSTYLE_OFF: LineLength + public Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, + Collection<org.apache.maven.model.Dependency> mavenDependencies, + Collection<org.apache.maven.model.Dependency> managedMavenDependencies, + TransformableFilter filter ) + // CHECKSTYLE_ON: + // LineLength + throws DependencyResolverException + { + ArtifactTypeRegistry typeRegistry = + (ArtifactTypeRegistry) Invoker.invoke( RepositoryUtils.class, "newArtifactTypeRegistry", + ArtifactHandlerManager.class, artifactHandlerManager ); + + final Class<?>[] argClasses = + new Class<?>[] { org.apache.maven.model.Dependency.class, ArtifactTypeRegistry.class }; + + List<Dependency> aetherDependencies = new ArrayList<Dependency>( mavenDependencies.size() ); + + if ( mavenDependencies != null ) + { + aetherDependencies = new ArrayList<Dependency>( mavenDependencies.size() ); + + for ( org.apache.maven.model.Dependency mavenDependency : mavenDependencies ) + { + Object[] args = new Object[] { mavenDependency, typeRegistry }; + + Dependency aetherDependency = + (Dependency) Invoker.invoke( RepositoryUtils.class, "toDependency", argClasses, args ); + + aetherDependencies.add( aetherDependency ); + } + } + + List<Dependency> aetherManagedDependencies = null; + + if ( managedMavenDependencies != null ) + { + aetherManagedDependencies = new ArrayList<Dependency>( managedMavenDependencies.size() ); + + for ( org.apache.maven.model.Dependency mavenDependency : managedMavenDependencies ) + { + Object[] args = new Object[] { mavenDependency, typeRegistry }; + + Dependency aetherDependency = + (Dependency) Invoker.invoke( RepositoryUtils.class, "toDependency", argClasses, args ); + + aetherManagedDependencies.add( aetherDependency ); + } + } + + @SuppressWarnings( "unchecked" ) + List<RemoteRepository> aetherRepositories = + (List<RemoteRepository>) Invoker.invoke( RepositoryUtils.class, "toRepos", List.class, + buildingRequest.getRemoteRepositories() ); + + CollectRequest request = + new CollectRequest( aetherDependencies, aetherManagedDependencies, aetherRepositories ); + + return resolveDependencies( buildingRequest, aetherRepositories, filter, request ); + } + + // CHECKSTYLE_OFF: LineLength + private Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, + List<RemoteRepository> aetherRepositories, + TransformableFilter dependencyFilter, + CollectRequest request ) + throws DependencyResolverException + // CHECKSTYLE_ON :LineLength + { + try + { + DependencyFilter depFilter = null; + if ( dependencyFilter != null ) + { + depFilter = dependencyFilter.transform( new SonatypeAetherFilterTransformer() ); + } + + RepositorySystemSession session = + (RepositorySystemSession) Invoker.invoke( buildingRequest, "getRepositorySession" ); + + List<ArtifactResult> dependencyResults = + repositorySystem.resolveDependencies( session, request, depFilter ); + + Collection<ArtifactRequest> artifactRequests = new ArrayList<ArtifactRequest>( dependencyResults.size() ); + + for ( ArtifactResult artifactResult : dependencyResults ) + { + artifactRequests.add( new ArtifactRequest( artifactResult.getArtifact(), aetherRepositories, null ) ); + } + + final List<ArtifactResult> artifactResults = repositorySystem.resolveArtifacts( session, artifactRequests ); + + // Keep it lazy! Often artifactsResults aren't used, so transforming up front is too expensive + return new Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult>() + { + @Override + public Iterator<org.apache.maven.shared.artifact.resolve.ArtifactResult> iterator() + { + Collection<org.apache.maven.shared.artifact.resolve.ArtifactResult> artResults = + new ArrayList<org.apache.maven.shared.artifact.resolve.ArtifactResult>( artifactResults.size() ); + + for ( ArtifactResult artifactResult : artifactResults ) + { + artResults.add( new Maven30ArtifactResult( artifactResult ) ); + } + + return artResults.iterator(); + } + }; + } + catch ( ArtifactResolutionException e ) + { + throw new DependencyResolverException( e.getMessage(), e ); + } + catch ( DependencyCollectionException e ) + { + throw new DependencyResolverException( e.getMessage(), e ); + } + } + + /** + * Based on RepositoryUtils#toDependency(org.apache.maven.model.Dependency, ArtifactTypeRegistry) + * + * @param coordinate + * @param stereotypes + * @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 ); + } +}
Added: maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31ArtifactResult.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31ArtifactResult.java?rev=1747984&view=auto ============================================================================== --- maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31ArtifactResult.java (added) +++ maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31ArtifactResult.java Sun Jun 12 12:02:29 2016 @@ -0,0 +1,59 @@ +package org.apache.maven.shared.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.shared.dependencies.resolve.DependencyResolverException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.artifact.Artifact; + +/** + * {@link org.apache.maven.shared.artifact.resolve.ArtifactResult} wrapper for {@link ArtifactResult} + * + * @author Robert Scholte + * @since 3.0 + */ +public class Maven31ArtifactResult + implements org.apache.maven.shared.artifact.resolve.ArtifactResult +{ + private final ArtifactResult artifactResult; + + /** + * @param artifactResult {@link ArtifactResult} + */ + public Maven31ArtifactResult( ArtifactResult artifactResult ) + { + this.artifactResult = artifactResult; + } + + @Override + public org.apache.maven.artifact.Artifact getArtifact() + { + try + { + return (org.apache.maven.artifact.Artifact) Invoker.invoke( RepositoryUtils.class, "toArtifact", + Artifact.class, artifactResult.getArtifact() ); + } + catch ( DependencyResolverException e ) + { + throw new RuntimeException( e ); + } + } +} Added: maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31DependencyResolver.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31DependencyResolver.java?rev=1747984&view=auto ============================================================================== --- maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31DependencyResolver.java (added) +++ maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/dependencies/resolve/internal/Maven31DependencyResolver.java Sun Jun 12 12:02:29 2016 @@ -0,0 +1,236 @@ +package org.apache.maven.shared.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 java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.maven.RepositoryUtils; +import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; +import org.apache.maven.project.ProjectBuildingRequest; +import org.apache.maven.shared.artifact.filter.resolve.TransformableFilter; +import org.apache.maven.shared.artifact.filter.resolve.transform.EclipseAetherFilterTransformer; +import org.apache.maven.shared.dependencies.DependableCoordinate; +import org.apache.maven.shared.dependencies.resolve.DependencyResolver; +import org.apache.maven.shared.dependencies.resolve.DependencyResolverException; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.artifact.ArtifactType; +import org.eclipse.aether.artifact.ArtifactTypeRegistry; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.artifact.DefaultArtifactType; +import org.eclipse.aether.collection.CollectRequest; +import org.eclipse.aether.graph.Dependency; +import org.eclipse.aether.graph.DependencyFilter; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.resolution.DependencyRequest; +import org.eclipse.aether.resolution.DependencyResolutionException; +import org.eclipse.aether.resolution.DependencyResult; + +/** + * + */ +@Component( role = DependencyResolver.class, hint = "maven31" ) +public class Maven31DependencyResolver + implements DependencyResolver +{ + @Requirement + private RepositorySystem repositorySystem; + + @Requirement + private ArtifactHandlerManager artifactHandlerManager; + + @Override + // CHECKSTYLE_OFF: LineLength + public Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, + DependableCoordinate coordinate, + TransformableFilter dependencyFilter ) + throws DependencyResolverException + // CHECKSTYLE_ON: LineLength + { + ArtifactTypeRegistry typeRegistry = + (ArtifactTypeRegistry) Invoker.invoke( RepositoryUtils.class, "newArtifactTypeRegistry", + ArtifactHandlerManager.class, artifactHandlerManager ); + + Dependency aetherRoot = toDependency( coordinate, typeRegistry ); + + @SuppressWarnings( "unchecked" ) + List<RemoteRepository> aetherRepositories = + (List<RemoteRepository>) Invoker.invoke( RepositoryUtils.class, "toRepos", List.class, + buildingRequest.getRemoteRepositories() ); + + CollectRequest request = new CollectRequest( aetherRoot, aetherRepositories ); + + return resolveDependencies( buildingRequest, aetherRepositories, dependencyFilter, request ); + } + + @Override + // CHECKSTYLE_OFF: LineLength + public Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, + Collection<org.apache.maven.model.Dependency> mavenDependencies, + Collection<org.apache.maven.model.Dependency> managedMavenDependencies, + TransformableFilter filter ) + throws DependencyResolverException + // CHECKSTYLE_ON: LineLength + { + ArtifactTypeRegistry typeRegistry = + (ArtifactTypeRegistry) Invoker.invoke( RepositoryUtils.class, "newArtifactTypeRegistry", + ArtifactHandlerManager.class, artifactHandlerManager ); + + final Class<?>[] argClasses = + new Class<?>[] { org.apache.maven.model.Dependency.class, ArtifactTypeRegistry.class }; + + List<Dependency> aetherDeps = null; + + if ( mavenDependencies != null ) + { + aetherDeps = new ArrayList<Dependency>( mavenDependencies.size() ); + + for ( org.apache.maven.model.Dependency mavenDependency : mavenDependencies ) + { + Object[] args = new Object[] { mavenDependency, typeRegistry }; + + Dependency aetherDependency = + (Dependency) Invoker.invoke( RepositoryUtils.class, "toDependency", argClasses, args ); + + aetherDeps.add( aetherDependency ); + } + } + + List<Dependency> aetherManagedDependencies = null; + + if ( managedMavenDependencies != null ) + { + aetherManagedDependencies = new ArrayList<Dependency>( managedMavenDependencies.size() ); + + for ( org.apache.maven.model.Dependency mavenDependency : managedMavenDependencies ) + { + Object[] args = new Object[] { mavenDependency, typeRegistry }; + + Dependency aetherDependency = + (Dependency) Invoker.invoke( RepositoryUtils.class, "toDependency", argClasses, args ); + + aetherManagedDependencies.add( aetherDependency ); + } + } + + @SuppressWarnings( "unchecked" ) + List<RemoteRepository> aetherRepos = + (List<RemoteRepository>) Invoker.invoke( RepositoryUtils.class, "toRepos", List.class, + buildingRequest.getRemoteRepositories() ); + + CollectRequest request = new CollectRequest( aetherDeps, aetherManagedDependencies, aetherRepos ); + + return resolveDependencies( buildingRequest, aetherRepos, filter, request ); + } + + // CHECKSTYLE_OFF: LineLength + private Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult> resolveDependencies( ProjectBuildingRequest buildingRequest, + List<RemoteRepository> aetherRepositories, + TransformableFilter dependencyFilter, + CollectRequest request ) + throws DependencyResolverException + // CHECKSTYLE_ON: LineLength + { + try + { + DependencyFilter depFilter = null; + if ( dependencyFilter != null ) + { + depFilter = dependencyFilter.transform( new EclipseAetherFilterTransformer() ); + } + + DependencyRequest depRequest = new DependencyRequest( request, depFilter ); + + RepositorySystemSession session = + (RepositorySystemSession) Invoker.invoke( buildingRequest, "getRepositorySession" ); + + DependencyResult dependencyResults = repositorySystem.resolveDependencies( session, depRequest ); + + Collection<ArtifactRequest> artifactRequests = + new ArrayList<ArtifactRequest>( dependencyResults.getArtifactResults().size() ); + + for ( ArtifactResult artifactResult : dependencyResults.getArtifactResults() ) + { + artifactRequests.add( new ArtifactRequest( artifactResult.getArtifact(), aetherRepositories, null ) ); + } + + final List<ArtifactResult> artifactResults = repositorySystem.resolveArtifacts( session, artifactRequests ); + + // Keep it lazy! Often artifactsResults aren't used, so transforming up front is too expensive + return new Iterable<org.apache.maven.shared.artifact.resolve.ArtifactResult>() + { + @Override + public Iterator<org.apache.maven.shared.artifact.resolve.ArtifactResult> iterator() + { + // CHECKSTYLE_OFF: LineLength + Collection<org.apache.maven.shared.artifact.resolve.ArtifactResult> artResults = + new ArrayList<org.apache.maven.shared.artifact.resolve.ArtifactResult>( artifactResults.size() ); + // CHECKSTYLE_ON: LineLength + + for ( ArtifactResult artifactResult : artifactResults ) + { + artResults.add( new Maven31ArtifactResult( artifactResult ) ); + } + + return artResults.iterator(); + } + }; + } + catch ( ArtifactResolutionException e ) + { + throw new DependencyResolverException( e.getMessage(), e ); + } + catch ( DependencyResolutionException e ) + { + throw new DependencyResolverException( e.getMessage(), e ); + } + } + + /** + * Based on RepositoryUtils#toDependency(org.apache.maven.model.Dependency, ArtifactTypeRegistry) + * + * @param coordinate {@link DependableCoordinate} + * @param stereotypes {@link 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 ); + } +} Added: maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/DefaultProjectCoordinate.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/DefaultProjectCoordinate.java?rev=1747984&view=auto ============================================================================== --- maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/DefaultProjectCoordinate.java (added) +++ maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/DefaultProjectCoordinate.java Sun Jun 12 12:02:29 2016 @@ -0,0 +1,81 @@ +package org.apache.maven.shared.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @author Robert Scholte + * + */ +public class DefaultProjectCoordinate implements ProjectCoordinate +{ + + private String groupId; + + private String artifactId; + + private String version; + + private String packaging; + + @Override + public String getGroupId() + { + return groupId; + } + + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } + + @Override + public String getArtifactId() + { + return artifactId; + } + + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } + + @Override + public String getVersion() + { + return version; + } + + public void setVersion( String version ) + { + this.version = version; + } + + @Override + public String getPackaging() + { + return packaging == null ? "jar" : packaging; + } + + public void setPackaging( String packaging ) + { + this.packaging = packaging; + } +} Added: maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/ProjectCoordinate.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/ProjectCoordinate.java?rev=1747984&view=auto ============================================================================== --- maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/ProjectCoordinate.java (added) +++ maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/project/ProjectCoordinate.java Sun Jun 12 12:02:29 2016 @@ -0,0 +1,52 @@ +package org.apache.maven.shared.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @author Robert Scholte + * + */ +public interface ProjectCoordinate +{ + /** + * + * @return the groupId of the project + */ + String getGroupId(); + + /** + * + * @return the artifactId of the project + */ + String getArtifactId(); + + /** + * + * @return the version of the project, cannot be a range + */ + String getVersion(); + + /** + * + * @return the packaging of the project + */ + String getPackaging(); +} Modified: maven/shared/trunk/maven-artifact-transfer/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java?rev=1747984&r1=1747983&r2=1747984&view=diff ============================================================================== --- maven/shared/trunk/maven-artifact-transfer/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java (original) +++ maven/shared/trunk/maven-artifact-transfer/src/test/java/org/apache/maven/shared/dependency/DefaultDependencyCoordinateTest.java Sun Jun 12 12:02:29 2016 @@ -20,6 +20,7 @@ package org.apache.maven.shared.dependen */ import static org.junit.Assert.assertEquals; +import org.apache.maven.shared.dependencies.DefaultDependableCoordinate; import org.junit.Test; public class DefaultDependencyCoordinateTest @@ -28,7 +29,7 @@ public class DefaultDependencyCoordinate @Test public void testToStringWithoutType() { - DefaultDependencyCoordinate coordinate = new DefaultDependencyCoordinate(); + DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate(); coordinate.setGroupId( "GROUPID" ); coordinate.setArtifactId( "ARTIFACTID" ); coordinate.setVersion( "VERSION" ); @@ -38,7 +39,7 @@ public class DefaultDependencyCoordinate @Test public void testToStringWithClassifier() { - DefaultDependencyCoordinate coordinate = new DefaultDependencyCoordinate(); + DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate(); coordinate.setGroupId( "GROUPID" ); coordinate.setArtifactId( "ARTIFACTID" ); coordinate.setVersion( "VERSION" );
