diff options
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project')
44 files changed, 0 insertions, 9069 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java deleted file mode 100644 index cf5b0d70..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.graph.DependencyFilter; - -/** - * @author Benjamin Bentmann - */ -public class DefaultDependencyResolutionRequest - implements DependencyResolutionRequest -{ - - private MavenProject project; - - private DependencyFilter filter; - - private RepositorySystemSession session; - - public DefaultDependencyResolutionRequest() - { - // enables default constructor - } - - public DefaultDependencyResolutionRequest( MavenProject project, RepositorySystemSession session ) - { - setMavenProject( project ); - setRepositorySession( session ); - } - - public DependencyFilter getResolutionFilter() - { - return filter; - } - - public MavenProject getMavenProject() - { - return project; - } - - public RepositorySystemSession getRepositorySession() - { - return session; - } - - public DependencyResolutionRequest setResolutionFilter( DependencyFilter filter ) - { - this.filter = filter; - return this; - } - - public DependencyResolutionRequest setMavenProject( MavenProject project ) - { - this.project = project; - return this; - } - - public DependencyResolutionRequest setRepositorySession( RepositorySystemSession repositorySession ) - { - this.session = repositorySession; - return this; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java deleted file mode 100644 index 07c6a2f9..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.DependencyNode; - -/** - * @author Benjamin Bentmann - */ -class DefaultDependencyResolutionResult - implements DependencyResolutionResult -{ - - private DependencyNode root; - - private List<Dependency> dependencies = new ArrayList<Dependency>(); - - private List<Dependency> resolvedDependencies = new ArrayList<Dependency>(); - - private List<Dependency> unresolvedDependencies = new ArrayList<Dependency>(); - - private List<Exception> collectionErrors = new ArrayList<Exception>(); - - private Map<Dependency, List<Exception>> resolutionErrors = new IdentityHashMap<Dependency, List<Exception>>(); - - public DependencyNode getDependencyGraph() - { - return root; - } - - public void setDependencyGraph( DependencyNode root ) - { - this.root = root; - } - - public List<Dependency> getDependencies() - { - return dependencies; - } - - public List<Dependency> getResolvedDependencies() - { - return resolvedDependencies; - } - - public void addResolvedDependency( Dependency dependency ) - { - dependencies.add( dependency ); - resolvedDependencies.add( dependency ); - } - - public List<Dependency> getUnresolvedDependencies() - { - return unresolvedDependencies; - } - - public List<Exception> getCollectionErrors() - { - return collectionErrors; - } - - public void setCollectionErrors( List<Exception> exceptions ) - { - if ( exceptions != null ) - { - this.collectionErrors = exceptions; - } - else - { - this.collectionErrors = new ArrayList<Exception>(); - } - } - - public List<Exception> getResolutionErrors( Dependency dependency ) - { - List<Exception> errors = resolutionErrors.get( dependency ); - return ( errors != null ) ? errors : Collections.<Exception>emptyList(); - } - - public void setResolutionErrors( Dependency dependency, List<Exception> errors ) - { - dependencies.add( dependency ); - unresolvedDependencies.add( dependency ); - resolutionErrors.put( dependency, errors ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java deleted file mode 100644 index 2cce9f6a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; -import org.apache.maven.model.Resource; -import org.apache.maven.project.artifact.AttachedArtifact; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.AbstractLogEnabled; - -@SuppressWarnings( "deprecation" ) -@Component( role = MavenProjectHelper.class ) -public class DefaultMavenProjectHelper - extends AbstractLogEnabled - implements MavenProjectHelper -{ - @Requirement - private ArtifactHandlerManager artifactHandlerManager; - - public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, - File artifactFile ) - { - String type = artifactType; - - ArtifactHandler handler = null; - - if ( type != null ) - { - handler = artifactHandlerManager.getArtifactHandler( artifactType ); - } - - if ( handler == null ) - { - handler = artifactHandlerManager.getArtifactHandler( "jar" ); - } - - Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler ); - - artifact.setFile( artifactFile ); - artifact.setResolved( true ); - - attachArtifact( project, artifact ); - } - - public void attachArtifact( MavenProject project, String artifactType, File artifactFile ) - { - ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( artifactType ); - - Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, handler ); - - artifact.setFile( artifactFile ); - artifact.setResolved( true ); - - attachArtifact( project, artifact ); - } - - public void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier ) - { - Artifact projectArtifact = project.getArtifact(); - - Artifact artifact = - new AttachedArtifact( projectArtifact, projectArtifact.getType(), artifactClassifier, - projectArtifact.getArtifactHandler() ); - - artifact.setFile( artifactFile ); - artifact.setResolved( true ); - - attachArtifact( project, artifact ); - } - - /** - * Add an attached artifact or replace the file for an existing artifact. - * - * @see MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact) - * @param project project reference. - * @param artifact artifact to add or replace. - */ - public void attachArtifact( MavenProject project, Artifact artifact ) - { - project.addAttachedArtifact( artifact ); - } - - public void addResource( MavenProject project, String resourceDirectory, List<String> includes, - List<String> excludes ) - { - Resource resource = new Resource(); - resource.setDirectory( resourceDirectory ); - resource.setIncludes( includes ); - resource.setExcludes( excludes ); - - project.addResource( resource ); - } - - public void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, - List<String> excludes ) - { - Resource resource = new Resource(); - resource.setDirectory( resourceDirectory ); - resource.setIncludes( includes ); - resource.setExcludes( excludes ); - - project.addTestResource( resource ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java deleted file mode 100644 index a5365621..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.model.Model; -import org.apache.maven.model.building.AbstractModelBuildingListener; -import org.apache.maven.model.building.ModelBuildingEvent; -import org.apache.maven.model.building.ModelProblem.Severity; -import org.apache.maven.model.building.ModelProblem.Version; -import org.apache.maven.model.building.ModelProblemCollectorRequest; -import org.apache.maven.plugin.PluginManagerException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; - -/** - * Processes events from the model builder while building the effective model for a {@link MavenProject} instance. - * - * @author Benjamin Bentmann - */ -public class DefaultModelBuildingListener - extends AbstractModelBuildingListener -{ - - private MavenProject project; - - private ProjectBuildingHelper projectBuildingHelper; - - private ProjectBuildingRequest projectBuildingRequest; - - private List<ArtifactRepository> remoteRepositories; - - private List<ArtifactRepository> pluginRepositories; - - public DefaultModelBuildingListener( MavenProject project, ProjectBuildingHelper projectBuildingHelper, - ProjectBuildingRequest projectBuildingRequest ) - { - if ( project == null ) - { - throw new IllegalArgumentException( "project missing" ); - } - this.project = project; - - if ( projectBuildingHelper == null ) - { - throw new IllegalArgumentException( "project building helper missing" ); - } - this.projectBuildingHelper = projectBuildingHelper; - - if ( projectBuildingRequest == null ) - { - throw new IllegalArgumentException( "project building request missing" ); - } - this.projectBuildingRequest = projectBuildingRequest; - this.remoteRepositories = projectBuildingRequest.getRemoteRepositories(); - this.pluginRepositories = projectBuildingRequest.getPluginArtifactRepositories(); - } - - /** - * Gets the project whose model is being built. - * - * @return The project, never {@code null}. - */ - public MavenProject getProject() - { - return project; - } - - @Override - public void buildExtensionsAssembled( ModelBuildingEvent event ) - { - Model model = event.getModel(); - - try - { - pluginRepositories = - projectBuildingHelper.createArtifactRepositories( model.getPluginRepositories(), pluginRepositories, - projectBuildingRequest ); - } - catch ( Exception e ) - { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) - .setMessage( "Invalid plugin repository: " + e.getMessage() ) - .setException( e ) ); - } - project.setPluginArtifactRepositories( pluginRepositories ); - - if ( event.getRequest().isProcessPlugins() ) - { - try - { - ProjectRealmCache.CacheRecord record = - projectBuildingHelper.createProjectRealm( project, model, projectBuildingRequest ); - - project.setClassRealm( record.realm ); - project.setExtensionDependencyFilter( record.extensionArtifactFilter ); - } - catch ( PluginResolutionException e ) - { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) - .setMessage( "Unresolveable build extension: " + e.getMessage() ) - .setException( e ) ); - } - catch ( PluginVersionResolutionException e ) - { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) - .setMessage( "Unresolveable build extension: " + e.getMessage() ) - .setException( e ) ); - } - catch ( PluginManagerException e ) - { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) - .setMessage( "Unresolveable build extension: " + e.getMessage() ) - .setException( e ) ); - } - - projectBuildingHelper.selectProjectRealm( project ); - } - - // build the regular repos after extensions are loaded to allow for custom layouts - try - { - remoteRepositories = - projectBuildingHelper.createArtifactRepositories( model.getRepositories(), remoteRepositories, - projectBuildingRequest ); - } - catch ( Exception e ) - { - event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) - .setMessage( "Invalid artifact repository: " + e.getMessage() ) - .setException( e ) ); - } - project.setRemoteArtifactRepositories( remoteRepositories ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java deleted file mode 100644 index 99edc802..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ /dev/null @@ -1,929 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.model.Build; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.DeploymentRepository; -import org.apache.maven.model.Extension; -import org.apache.maven.model.Model; -import org.apache.maven.model.Parent; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Profile; -import org.apache.maven.model.ReportPlugin; -import org.apache.maven.model.building.DefaultModelBuildingRequest; -import org.apache.maven.model.building.DefaultModelProblem; -import org.apache.maven.model.building.FileModelSource; -import org.apache.maven.model.building.ModelBuilder; -import org.apache.maven.model.building.ModelBuildingException; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelBuildingResult; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.building.ModelProcessor; -import org.apache.maven.model.building.ModelSource; -import org.apache.maven.model.building.StringModelSource; -import org.apache.maven.model.resolution.ModelResolver; -import org.apache.maven.repository.internal.ArtifactDescriptorUtils; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.Os; -import org.codehaus.plexus.util.StringUtils; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.impl.RemoteRepositoryManager; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.repository.WorkspaceRepository; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResult; -import org.eclipse.aether.resolution.VersionRangeRequest; -import org.eclipse.aether.resolution.VersionRangeResolutionException; -import org.eclipse.aether.resolution.VersionRangeResult; - -/** - */ -@Component( role = ProjectBuilder.class ) -public class DefaultProjectBuilder - implements ProjectBuilder -{ - - @Requirement - private Logger logger; - - @Requirement - private ModelBuilder modelBuilder; - - @Requirement - private ModelProcessor modelProcessor; - - @Requirement - private ProjectBuildingHelper projectBuildingHelper; - - @Requirement - private MavenRepositorySystem repositorySystem; - - @Requirement - private org.eclipse.aether.RepositorySystem repoSystem; - - @Requirement - private RemoteRepositoryManager repositoryManager; - - @Requirement - private ProjectDependenciesResolver dependencyResolver; - - // ---------------------------------------------------------------------- - // MavenProjectBuilder Implementation - // ---------------------------------------------------------------------- - - @Override - public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest request ) - throws ProjectBuildingException - { - return build( pomFile, new FileModelSource( pomFile ), new InternalConfig( request, null ) ); - } - - @Override - public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request ) - throws ProjectBuildingException - { - return build( null, modelSource, new InternalConfig( request, null ) ); - } - - private ProjectBuildingResult build( File pomFile, ModelSource modelSource, InternalConfig config ) - throws ProjectBuildingException - { - ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); - - try - { - ProjectBuildingRequest projectBuildingRequest = config.request; - - MavenProject project = projectBuildingRequest.getProject(); - - List<ModelProblem> modelProblems = null; - Throwable error = null; - - if ( project == null ) - { - ModelBuildingRequest request = getModelBuildingRequest( config ); - - project = new MavenProject(); - project.setFile( pomFile ); - - DefaultModelBuildingListener listener = - new DefaultModelBuildingListener( project, projectBuildingHelper, projectBuildingRequest ); - request.setModelBuildingListener( listener ); - - request.setPomFile( pomFile ); - request.setModelSource( modelSource ); - request.setLocationTracking( true ); - - ModelBuildingResult result; - try - { - result = modelBuilder.build( request ); - } - catch ( ModelBuildingException e ) - { - result = e.getResult(); - if ( result == null || result.getEffectiveModel() == null ) - { - throw new ProjectBuildingException( e.getModelId(), e.getMessage(), pomFile, e ); - } - // validation error, continue project building and delay failing to help IDEs - error = e; - } - - modelProblems = result.getProblems(); - - initProject( project, Collections.<String, MavenProject>emptyMap(), result, - new HashMap<File, Boolean>(), projectBuildingRequest ); - } - else if ( projectBuildingRequest.isResolveDependencies() ) - { - projectBuildingHelper.selectProjectRealm( project ); - } - - DependencyResolutionResult resolutionResult = null; - - if ( projectBuildingRequest.isResolveDependencies() ) - { - resolutionResult = resolveDependencies( project, config.session ); - } - - ProjectBuildingResult result = new DefaultProjectBuildingResult( project, modelProblems, resolutionResult ); - - if ( error != null ) - { - ProjectBuildingException e = new ProjectBuildingException( Arrays.asList( result ) ); - e.initCause( error ); - throw e; - } - - return result; - } - finally - { - Thread.currentThread().setContextClassLoader( oldContextClassLoader ); - } - } - - private DependencyResolutionResult resolveDependencies( MavenProject project, RepositorySystemSession session ) - { - DependencyResolutionResult resolutionResult; - - try - { - DefaultDependencyResolutionRequest resolution = new DefaultDependencyResolutionRequest( project, session ); - resolutionResult = dependencyResolver.resolve( resolution ); - } - catch ( DependencyResolutionException e ) - { - resolutionResult = e.getResult(); - } - - Set<Artifact> artifacts = new LinkedHashSet<Artifact>(); - if ( resolutionResult.getDependencyGraph() != null ) - { - RepositoryUtils.toArtifacts( artifacts, resolutionResult.getDependencyGraph().getChildren(), - Collections.singletonList( project.getArtifact().getId() ), null ); - - // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not - LocalRepositoryManager lrm = session.getLocalRepositoryManager(); - for ( Artifact artifact : artifacts ) - { - if ( !artifact.isResolved() ) - { - String path = lrm.getPathForLocalArtifact( RepositoryUtils.toArtifact( artifact ) ); - artifact.setFile( new File( lrm.getRepository().getBasedir(), path ) ); - } - } - } - project.setResolvedArtifacts( artifacts ); - project.setArtifacts( artifacts ); - - return resolutionResult; - } - - private List<String> getProfileIds( List<Profile> profiles ) - { - List<String> ids = new ArrayList<String>( profiles.size() ); - - for ( Profile profile : profiles ) - { - ids.add( profile.getId() ); - } - - return ids; - } - - private ModelBuildingRequest getModelBuildingRequest( InternalConfig config ) - { - ProjectBuildingRequest configuration = config.request; - - ModelBuildingRequest request = new DefaultModelBuildingRequest(); - - RequestTrace trace = RequestTrace.newChild( null, configuration ).newChild( request ); - - ModelResolver resolver = - new ProjectModelResolver( config.session, trace, repoSystem, repositoryManager, config.repositories, - configuration.getRepositoryMerging(), config.modelPool ); - - request.setValidationLevel( configuration.getValidationLevel() ); - request.setProcessPlugins( configuration.isProcessPlugins() ); - request.setProfiles( configuration.getProfiles() ); - request.setActiveProfileIds( configuration.getActiveProfileIds() ); - request.setInactiveProfileIds( configuration.getInactiveProfileIds() ); - request.setSystemProperties( configuration.getSystemProperties() ); - request.setUserProperties( configuration.getUserProperties() ); - request.setBuildStartTime( configuration.getBuildStartTime() ); - request.setModelResolver( resolver ); - request.setModelCache( new ReactorModelCache() ); - - return request; - } - - @Override - public ProjectBuildingResult build( Artifact artifact, ProjectBuildingRequest request ) - throws ProjectBuildingException - { - return build( artifact, false, request ); - } - - @Override - public ProjectBuildingResult build( Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request ) - throws ProjectBuildingException - { - org.eclipse.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact ); - pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact ); - - InternalConfig config = new InternalConfig( request, null ); - - boolean localProject; - - if ( request.isResolveVersionRanges() ) - { - VersionRangeRequest versionRangeRequest = new VersionRangeRequest( pomArtifact, config.repositories, null ); - - try - { - VersionRangeResult versionRangeResult = - repoSystem.resolveVersionRange( config.session, versionRangeRequest ); - - if ( versionRangeResult.getHighestVersion() == null ) - { - throw new ProjectBuildingException( - artifact.getId(), "Error resolving project artifact: No versions matched the requested range", - (Throwable) null ); - - } - - if ( versionRangeResult.getVersionConstraint() != null - && versionRangeResult.getVersionConstraint().getRange() != null - && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null ) - { - throw new ProjectBuildingException( - artifact.getId(), - "Error resolving project artifact: The requested version range does not specify an upper bound", - (Throwable) null ); - - } - - pomArtifact = pomArtifact.setVersion( versionRangeResult.getHighestVersion().toString() ); - } - catch ( VersionRangeResolutionException e ) - { - throw new ProjectBuildingException( - artifact.getId(), "Error resolving project artifact: " + e.getMessage(), e ); - - } - } - - try - { - ArtifactRequest pomRequest = new ArtifactRequest(); - pomRequest.setArtifact( pomArtifact ); - pomRequest.setRepositories( config.repositories ); - ArtifactResult pomResult = repoSystem.resolveArtifact( config.session, pomRequest ); - - pomArtifact = pomResult.getArtifact(); - localProject = pomResult.getRepository() instanceof WorkspaceRepository; - } - catch ( org.eclipse.aether.resolution.ArtifactResolutionException e ) - { - if ( e.getResults().get( 0 ).isMissing() && allowStubModel ) - { - return build( null, createStubModelSource( artifact ), config ); - } - throw new ProjectBuildingException( artifact.getId(), - "Error resolving project artifact: " + e.getMessage(), e ); - } - - File pomFile = pomArtifact.getFile(); - - if ( "pom".equals( artifact.getType() ) ) - { - artifact.selectVersion( pomArtifact.getVersion() ); - artifact.setFile( pomFile ); - artifact.setResolved( true ); - } - - return build( localProject ? pomFile : null, new FileModelSource( pomFile ), config ); - } - - private ModelSource createStubModelSource( Artifact artifact ) - { - StringBuilder buffer = new StringBuilder( 1024 ); - - buffer.append( "<?xml version='1.0'?>" ); - buffer.append( "<project>" ); - buffer.append( "<modelVersion>4.0.0</modelVersion>" ); - buffer.append( "<groupId>" ).append( artifact.getGroupId() ).append( "</groupId>" ); - buffer.append( "<artifactId>" ).append( artifact.getArtifactId() ).append( "</artifactId>" ); - buffer.append( "<version>" ).append( artifact.getBaseVersion() ).append( "</version>" ); - buffer.append( "<packaging>" ).append( artifact.getType() ).append( "</packaging>" ); - buffer.append( "</project>" ); - - return new StringModelSource( buffer, artifact.getId() ); - } - - @Override - public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request ) - throws ProjectBuildingException - { - List<ProjectBuildingResult> results = new ArrayList<ProjectBuildingResult>(); - - List<InterimResult> interimResults = new ArrayList<InterimResult>(); - - ReactorModelPool modelPool = new ReactorModelPool(); - - InternalConfig config = new InternalConfig( request, modelPool ); - - Map<String, MavenProject> projectIndex = new HashMap<String, MavenProject>( 256 ); - - boolean noErrors = - build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive, - config ); - - populateReactorModelPool( modelPool, interimResults ); - - ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); - - try - { - noErrors = - build( results, new ArrayList<MavenProject>(), projectIndex, interimResults, request, - new HashMap<File, Boolean>() ) && noErrors; - } - finally - { - Thread.currentThread().setContextClassLoader( oldContextClassLoader ); - } - - if ( !noErrors ) - { - throw new ProjectBuildingException( results ); - } - - return results; - } - - private boolean build( List<ProjectBuildingResult> results, List<InterimResult> interimResults, - Map<String, MavenProject> projectIndex, List<File> pomFiles, Set<File> aggregatorFiles, - boolean isRoot, boolean recursive, InternalConfig config ) - { - boolean noErrors = true; - - for ( File pomFile : pomFiles ) - { - aggregatorFiles.add( pomFile ); - - if ( !build( results, interimResults, projectIndex, pomFile, aggregatorFiles, isRoot, recursive, config ) ) - { - noErrors = false; - } - - aggregatorFiles.remove( pomFile ); - } - - return noErrors; - } - - private boolean build( List<ProjectBuildingResult> results, List<InterimResult> interimResults, - Map<String, MavenProject> projectIndex, File pomFile, Set<File> aggregatorFiles, - boolean isRoot, boolean recursive, InternalConfig config ) - { - boolean noErrors = true; - - ModelBuildingRequest request = getModelBuildingRequest( config ); - - MavenProject project = new MavenProject(); - - request.setPomFile( pomFile ); - request.setTwoPhaseBuilding( true ); - request.setLocationTracking( true ); - - DefaultModelBuildingListener listener = - new DefaultModelBuildingListener( project, projectBuildingHelper, config.request ); - request.setModelBuildingListener( listener ); - - try - { - ModelBuildingResult result = modelBuilder.build( request ); - - Model model = result.getEffectiveModel(); - - projectIndex.put( result.getModelIds().get( 0 ), project ); - - InterimResult interimResult = new InterimResult( pomFile, request, result, listener, isRoot ); - interimResults.add( interimResult ); - - if ( recursive && !model.getModules().isEmpty() ) - { - File basedir = pomFile.getParentFile(); - - List<File> moduleFiles = new ArrayList<File>(); - - for ( String module : model.getModules() ) - { - if ( StringUtils.isEmpty( module ) ) - { - continue; - } - - module = module.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar ); - - File moduleFile = new File( basedir, module ); - - if ( moduleFile.isDirectory() ) - { - moduleFile = modelProcessor.locatePom( moduleFile ); - } - - if ( !moduleFile.isFile() ) - { - ModelProblem problem = - new DefaultModelProblem( "Child module " + moduleFile + " of " + pomFile - + " does not exist", ModelProblem.Severity.ERROR, ModelProblem.Version.BASE, model, -1, - -1, null ); - result.getProblems().add( problem ); - - noErrors = false; - - continue; - } - - if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) - { - // we don't canonicalize on unix to avoid interfering with symlinks - try - { - moduleFile = moduleFile.getCanonicalFile(); - } - catch ( IOException e ) - { - moduleFile = moduleFile.getAbsoluteFile(); - } - } - else - { - moduleFile = new File( moduleFile.toURI().normalize() ); - } - - if ( aggregatorFiles.contains( moduleFile ) ) - { - StringBuilder buffer = new StringBuilder( 256 ); - for ( File aggregatorFile : aggregatorFiles ) - { - buffer.append( aggregatorFile ).append( " -> " ); - } - buffer.append( moduleFile ); - - ModelProblem problem = - new DefaultModelProblem( "Child module " + moduleFile + " of " + pomFile - + " forms aggregation cycle " + buffer, ModelProblem.Severity.ERROR, - ModelProblem.Version.BASE, model, -1, -1, null ); - result.getProblems().add( problem ); - - noErrors = false; - - continue; - } - - moduleFiles.add( moduleFile ); - } - - interimResult.modules = new ArrayList<InterimResult>(); - - if ( !build( results, interimResult.modules, projectIndex, moduleFiles, aggregatorFiles, false, - recursive, config ) ) - { - noErrors = false; - } - } - } - catch ( ModelBuildingException e ) - { - results.add( new DefaultProjectBuildingResult( e.getModelId(), pomFile, e.getProblems() ) ); - - noErrors = false; - } - - return noErrors; - } - - static class InterimResult - { - - File pomFile; - - ModelBuildingRequest request; - - ModelBuildingResult result; - - DefaultModelBuildingListener listener; - - boolean root; - - List<InterimResult> modules = Collections.emptyList(); - - InterimResult( File pomFile, ModelBuildingRequest request, ModelBuildingResult result, - DefaultModelBuildingListener listener, boolean root ) - { - this.pomFile = pomFile; - this.request = request; - this.result = result; - this.listener = listener; - this.root = root; - } - - } - - private void populateReactorModelPool( ReactorModelPool reactorModelPool, List<InterimResult> interimResults ) - { - for ( InterimResult interimResult : interimResults ) - { - Model model = interimResult.result.getEffectiveModel(); - reactorModelPool.put( model.getGroupId(), model.getArtifactId(), model.getVersion(), model.getPomFile() ); - - populateReactorModelPool( reactorModelPool, interimResult.modules ); - } - } - - private boolean build( List<ProjectBuildingResult> results, List<MavenProject> projects, - Map<String, MavenProject> projectIndex, List<InterimResult> interimResults, - ProjectBuildingRequest request, Map<File, Boolean> profilesXmls ) - { - boolean noErrors = true; - - for ( InterimResult interimResult : interimResults ) - { - try - { - ModelBuildingResult result = modelBuilder.build( interimResult.request, interimResult.result ); - - MavenProject project = interimResult.listener.getProject(); - initProject( project, projectIndex, result, profilesXmls, request ); - - List<MavenProject> modules = new ArrayList<MavenProject>(); - noErrors = - build( results, modules, projectIndex, interimResult.modules, request, profilesXmls ) && noErrors; - - projects.addAll( modules ); - projects.add( project ); - - project.setExecutionRoot( interimResult.root ); - project.setCollectedProjects( modules ); - - results.add( new DefaultProjectBuildingResult( project, result.getProblems(), null ) ); - } - catch ( ModelBuildingException e ) - { - results.add( new DefaultProjectBuildingResult( e.getModelId(), interimResult.pomFile, - e.getProblems() ) ); - - noErrors = false; - } - } - - return noErrors; - } - - private void initProject( MavenProject project, Map<String, MavenProject> projects, ModelBuildingResult result, - Map<File, Boolean> profilesXmls, ProjectBuildingRequest projectBuildingRequest ) - { - Model model = result.getEffectiveModel(); - - project.setModel( model ); - project.setOriginalModel( result.getRawModel() ); - project.setFile( model.getPomFile() ); - Parent p = model.getParent(); - if ( p != null ) - { - project.setParentArtifact( repositorySystem.createProjectArtifact( p.getGroupId(), p.getArtifactId(), - p.getVersion() ) ); - // org.apache.maven.its.mng4834:parent:0.1 - String parentModelId = result.getModelIds().get( 1 ); - File parentPomFile = result.getRawModel( parentModelId ).getPomFile(); - MavenProject parent = projects.get( parentModelId ); - if ( parent == null ) - { - // - // At this point the DefaultModelBuildingListener has fired and it populates the - // remote repositories with those found in the pom.xml, along with the existing externally - // defined repositories. - // - projectBuildingRequest.setRemoteRepositories( project.getRemoteArtifactRepositories() ); - if ( parentPomFile != null ) - { - project.setParentFile( parentPomFile ); - try - { - parent = build( parentPomFile, projectBuildingRequest ).getProject(); - } - catch ( ProjectBuildingException e ) - { - // MNG-4488 where let invalid parents slide on by - logger.warn( "Failed to build parent project for " + project.getId() ); - } - } - else - { - Artifact parentArtifact = project.getParentArtifact(); - try - { - parent = build( parentArtifact, projectBuildingRequest ).getProject(); - } - catch ( ProjectBuildingException e ) - { - // MNG-4488 where let invalid parents slide on by - logger.warn( "Failed to build parent project for " + project.getId() ); - } - } - } - project.setParent( parent ); - } - - Artifact projectArtifact = - repositorySystem.createArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, - project.getPackaging() ); - project.setArtifact( projectArtifact ); - - if ( project.getFile() != null ) - { - Build build = project.getBuild(); - project.addScriptSourceRoot( build.getScriptSourceDirectory() ); - project.addCompileSourceRoot( build.getSourceDirectory() ); - project.addTestCompileSourceRoot( build.getTestSourceDirectory() ); - } - - List<Profile> activeProfiles = new ArrayList<Profile>(); - activeProfiles.addAll( result.getActivePomProfiles( result.getModelIds().get( 0 ) ) ); - activeProfiles.addAll( result.getActiveExternalProfiles() ); - project.setActiveProfiles( activeProfiles ); - - project.setInjectedProfileIds( "external", getProfileIds( result.getActiveExternalProfiles() ) ); - for ( String modelId : result.getModelIds() ) - { - project.setInjectedProfileIds( modelId, getProfileIds( result.getActivePomProfiles( modelId ) ) ); - } - - String modelId = findProfilesXml( result, profilesXmls ); - if ( modelId != null ) - { - ModelProblem problem = - new DefaultModelProblem( "Detected profiles.xml alongside " + modelId - + ", this file is no longer supported and was ignored" + ", please use the settings.xml instead", - ModelProblem.Severity.WARNING, ModelProblem.Version.V30, model, -1, -1, null ); - result.getProblems().add( problem ); - } - - // - // All the parts that were taken out of MavenProject for Maven 4.0.0 - // - - project.setProjectBuildingRequest( projectBuildingRequest ); - - // pluginArtifacts - Set<Artifact> pluginArtifacts = new HashSet<Artifact>(); - for ( Plugin plugin : project.getBuildPlugins() ) - { - Artifact artifact = repositorySystem.createPluginArtifact( plugin ); - - if ( artifact != null ) - { - pluginArtifacts.add( artifact ); - } - } - project.setPluginArtifacts( pluginArtifacts ); - - // reportArtifacts - Set<Artifact> reportArtifacts = new HashSet<Artifact>(); - for ( ReportPlugin report : project.getReportPlugins() ) - { - Plugin pp = new Plugin(); - pp.setGroupId( report.getGroupId() ); - pp.setArtifactId( report.getArtifactId() ); - pp.setVersion( report.getVersion() ); - - Artifact artifact = repositorySystem.createPluginArtifact( pp ); - - if ( artifact != null ) - { - reportArtifacts.add( artifact ); - } - } - project.setReportArtifacts( reportArtifacts ); - - // extensionArtifacts - Set<Artifact> extensionArtifacts = new HashSet<Artifact>(); - List<Extension> extensions = project.getBuildExtensions(); - if ( extensions != null ) - { - for ( Extension ext : extensions ) - { - String version; - if ( StringUtils.isEmpty( ext.getVersion() ) ) - { - version = "RELEASE"; - } - else - { - version = ext.getVersion(); - } - - Artifact artifact = - repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" ); - - if ( artifact != null ) - { - extensionArtifacts.add( artifact ); - } - } - } - project.setExtensionArtifacts( extensionArtifacts ); - - // managedVersionMap - Map<String, Artifact> map = null; - if ( repositorySystem != null ) - { - List<Dependency> deps; - DependencyManagement dependencyManagement = project.getDependencyManagement(); - if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) - && ( deps.size() > 0 ) ) - { - map = new HashMap<String, Artifact>(); - for ( Dependency d : dependencyManagement.getDependencies() ) - { - Artifact artifact = repositorySystem.createDependencyArtifact( d ); - - if ( artifact != null ) - { - map.put( d.getManagementKey(), artifact ); - } - } - } - else - { - map = Collections.emptyMap(); - } - } - project.setManagedVersionMap( map ); - - // release artifact repository - if ( project.getDistributionManagement() != null - && project.getDistributionManagement().getRepository() != null ) - { - try - { - DeploymentRepository r = project.getDistributionManagement().getRepository(); - if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) ) - { - ArtifactRepository repo = repositorySystem.buildArtifactRepository( r ); - repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(), - Arrays.asList( repo ) ); - repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(), - Arrays.asList( repo ) ); - project.setReleaseArtifactRepository( repo ); - } - } - catch ( InvalidRepositoryException e ) - { - throw new IllegalStateException( "Failed to create release distribution repository for " - + project.getId(), e ); - } - } - - // snapshot artifact repository - if ( project.getDistributionManagement() != null - && project.getDistributionManagement().getSnapshotRepository() != null ) - { - try - { - DeploymentRepository r = project.getDistributionManagement().getSnapshotRepository(); - if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) ) - { - ArtifactRepository repo = repositorySystem.buildArtifactRepository( r ); - repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(), - Arrays.asList( repo ) ); - repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(), - Arrays.asList( repo ) ); - project.setSnapshotArtifactRepository( repo ); - } - } - catch ( InvalidRepositoryException e ) - { - throw new IllegalStateException( "Failed to create snapshot distribution repository for " - + project.getId(), e ); - } - } - } - - private String findProfilesXml( ModelBuildingResult result, Map<File, Boolean> profilesXmls ) - { - for ( String modelId : result.getModelIds() ) - { - Model model = result.getRawModel( modelId ); - - File basedir = model.getProjectDirectory(); - if ( basedir == null ) - { - break; - } - - Boolean profilesXml = profilesXmls.get( basedir ); - if ( profilesXml == null ) - { - profilesXml = new File( basedir, "profiles.xml" ).exists(); - profilesXmls.put( basedir, profilesXml ); - } - if ( profilesXml ) - { - return modelId; - } - } - - return null; - } - - class InternalConfig - { - - public final ProjectBuildingRequest request; - - public final RepositorySystemSession session; - - public final List<RemoteRepository> repositories; - - public final ReactorModelPool modelPool; - - InternalConfig( ProjectBuildingRequest request, ReactorModelPool modelPool ) - { - this.request = request; - this.modelPool = modelPool; - session = - LegacyLocalRepositoryManager.overlay( request.getLocalRepository(), request.getRepositorySession(), - repoSystem ); - repositories = RepositoryUtils.toRepos( request.getRemoteRepositories() ); - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java deleted file mode 100644 index aea8fdbe..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.classrealm.ClassRealmManager; -import org.apache.maven.model.Build; -import org.apache.maven.model.Extension; -import org.apache.maven.model.Model; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Repository; -import org.apache.maven.plugin.ExtensionRealmCache; -import org.apache.maven.plugin.MavenPluginManager; -import org.apache.maven.plugin.PluginManagerException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.classworlds.realm.ClassRealm; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; -import org.eclipse.aether.graph.DependencyFilter; -import org.eclipse.aether.util.filter.ExclusionsDependencyFilter; - -/** - * Assists the project builder. <strong>Warning:</strong> This is an internal utility class that is only public for - * technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without - * prior notice. - * - * @author Benjamin Bentmann - */ -@Component( role = ProjectBuildingHelper.class ) -public class DefaultProjectBuildingHelper - implements ProjectBuildingHelper -{ - - @Requirement - private Logger logger; - - @Requirement - private PlexusContainer container; - - @Requirement - private ClassRealmManager classRealmManager; - - @Requirement - private ProjectRealmCache projectRealmCache; - - @Requirement - private RepositorySystem repositorySystem; - - @Requirement - private MavenPluginManager pluginManager; - - public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories, - List<ArtifactRepository> externalRepositories, - ProjectBuildingRequest request ) - throws InvalidRepositoryException - { - List<ArtifactRepository> internalRepositories = new ArrayList<ArtifactRepository>(); - - for ( Repository repository : pomRepositories ) - { - internalRepositories.add( repositorySystem.buildArtifactRepository( repository ) ); - } - - repositorySystem.injectMirror( request.getRepositorySession(), internalRepositories ); - - repositorySystem.injectProxy( request.getRepositorySession(), internalRepositories ); - - repositorySystem.injectAuthentication( request.getRepositorySession(), internalRepositories ); - - List<ArtifactRepository> dominantRepositories; - List<ArtifactRepository> recessiveRepositories; - - if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( request.getRepositoryMerging() ) ) - { - dominantRepositories = externalRepositories; - recessiveRepositories = internalRepositories; - } - else - { - dominantRepositories = internalRepositories; - recessiveRepositories = externalRepositories; - } - - List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>(); - Collection<String> repoIds = new HashSet<String>(); - - if ( dominantRepositories != null ) - { - for ( ArtifactRepository repository : dominantRepositories ) - { - repoIds.add( repository.getId() ); - artifactRepositories.add( repository ); - } - } - - if ( recessiveRepositories != null ) - { - for ( ArtifactRepository repository : recessiveRepositories ) - { - if ( repoIds.add( repository.getId() ) ) - { - artifactRepositories.add( repository ); - } - } - } - - artifactRepositories = repositorySystem.getEffectiveRepositories( artifactRepositories ); - - return artifactRepositories; - } - - public synchronized ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model, - ProjectBuildingRequest request ) - throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException - { - ClassRealm projectRealm; - - List<Plugin> extensionPlugins = new ArrayList<Plugin>(); - - Build build = model.getBuild(); - - if ( build != null ) - { - for ( Extension extension : build.getExtensions() ) - { - Plugin plugin = new Plugin(); - plugin.setGroupId( extension.getGroupId() ); - plugin.setArtifactId( extension.getArtifactId() ); - plugin.setVersion( extension.getVersion() ); - extensionPlugins.add( plugin ); - } - - for ( Plugin plugin : build.getPlugins() ) - { - if ( plugin.isExtensions() ) - { - extensionPlugins.add( plugin ); - } - } - } - - if ( extensionPlugins.isEmpty() ) - { - if ( logger.isDebugEnabled() ) - { - logger.debug( "Extension realms for project " + model.getId() + ": (none)" ); - } - - return new ProjectRealmCache.CacheRecord( null, null ); - } - - List<ClassRealm> extensionRealms = new ArrayList<ClassRealm>(); - - Map<ClassRealm, List<String>> exportedPackages = new HashMap<ClassRealm, List<String>>(); - - Map<ClassRealm, List<String>> exportedArtifacts = new HashMap<ClassRealm, List<String>>(); - - List<Artifact> publicArtifacts = new ArrayList<Artifact>(); - - for ( Plugin plugin : extensionPlugins ) - { - ExtensionRealmCache.CacheRecord recordRealm = - pluginManager.setupExtensionsRealm( project, plugin, request.getRepositorySession() ); - - final ClassRealm extensionRealm = recordRealm.realm; - final ExtensionDescriptor extensionDescriptor = recordRealm.desciptor; - final List<Artifact> artifacts = recordRealm.artifacts; - - extensionRealms.add( extensionRealm ); - if ( extensionDescriptor != null ) - { - exportedPackages.put( extensionRealm, extensionDescriptor.getExportedPackages() ); - exportedArtifacts.put( extensionRealm, extensionDescriptor.getExportedArtifacts() ); - } - - if ( !plugin.isExtensions() && artifacts.size() == 2 && artifacts.get( 0 ).getFile() != null - && "plexus-utils".equals( artifacts.get( 1 ).getArtifactId() ) ) - { - /* - * This is purely for backward-compat with 2.x where <extensions> consisting of a single artifact where - * loaded into the core and hence available to plugins, in contrast to bigger extensions that were - * loaded into a dedicated realm which is invisible to plugins (MNG-2749). - */ - publicArtifacts.add( artifacts.get( 0 ) ); - } - } - - if ( logger.isDebugEnabled() ) - { - logger.debug( "Extension realms for project " + model.getId() + ": " + extensionRealms ); - } - - ProjectRealmCache.Key projectRealmKey = projectRealmCache.createKey( extensionRealms ); - - ProjectRealmCache.CacheRecord record = projectRealmCache.get( projectRealmKey ); - - if ( record == null ) - { - projectRealm = classRealmManager.createProjectRealm( model, toAetherArtifacts( publicArtifacts ) ); - - Set<String> exclusions = new LinkedHashSet<String>(); - - for ( ClassRealm extensionRealm : extensionRealms ) - { - List<String> excludes = exportedArtifacts.get( extensionRealm ); - - if ( excludes != null ) - { - exclusions.addAll( excludes ); - } - - List<String> exports = exportedPackages.get( extensionRealm ); - - if ( exports == null || exports.isEmpty() ) - { - /* - * Most existing extensions don't define exported packages, i.e. no classes are to be exposed to - * plugins, yet the components provided by the extension (e.g. artifact handlers) must be - * accessible, i.e. we still must import the extension realm into the project realm. - */ - exports = Arrays.asList( extensionRealm.getId() ); - } - - for ( String export : exports ) - { - projectRealm.importFrom( extensionRealm, export ); - } - } - - DependencyFilter extensionArtifactFilter = null; - if ( !exclusions.isEmpty() ) - { - extensionArtifactFilter = new ExclusionsDependencyFilter( exclusions ); - } - - record = projectRealmCache.put( projectRealmKey, projectRealm, extensionArtifactFilter ); - } - - projectRealmCache.register( project, projectRealmKey, record ); - - return record; - } - - public void selectProjectRealm( MavenProject project ) - { - ClassLoader projectRealm = project.getClassRealm(); - - if ( projectRealm == null ) - { - projectRealm = classRealmManager.getCoreRealm(); - } - - Thread.currentThread().setContextClassLoader( projectRealm ); - } - - private List<org.eclipse.aether.artifact.Artifact> toAetherArtifacts( final List<Artifact> pluginArtifacts ) - { - return new ArrayList<org.eclipse.aether.artifact.Artifact>( RepositoryUtils.toArtifacts( pluginArtifacts ) ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java deleted file mode 100644 index 185e4ca7..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java +++ /dev/null @@ -1,339 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.model.Profile; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.eclipse.aether.RepositorySystemSession; - -public class DefaultProjectBuildingRequest - implements ProjectBuildingRequest -{ - - private RepositorySystemSession repositorySession; - - private ArtifactRepository localRepository; - - private List<ArtifactRepository> remoteRepositories; - - private List<ArtifactRepository> pluginArtifactRepositories; - - private MavenProject project; - - private int validationLevel = ModelBuildingRequest.VALIDATION_LEVEL_STRICT; - - private boolean processPlugins; - - private List<Profile> profiles; - - private List<String> activeProfileIds; - - private List<String> inactiveProfileIds; - - private Properties systemProperties; - - private Properties userProperties; - - private Date buildStartTime; - - private boolean resolveDependencies; - - private boolean resolveVersionRanges; - - private RepositoryMerging repositoryMerging = RepositoryMerging.POM_DOMINANT; - - public DefaultProjectBuildingRequest() - { - processPlugins = true; - profiles = new ArrayList<Profile>(); - activeProfileIds = new ArrayList<String>(); - inactiveProfileIds = new ArrayList<String>(); - systemProperties = new Properties(); - userProperties = new Properties(); - remoteRepositories = new ArrayList<ArtifactRepository>(); - pluginArtifactRepositories = new ArrayList<ArtifactRepository>(); - } - - public DefaultProjectBuildingRequest( ProjectBuildingRequest request ) - { - this(); - setProcessPlugins( request.isProcessPlugins() ); - setProfiles( request.getProfiles() ); - setActiveProfileIds( request.getActiveProfileIds() ); - setInactiveProfileIds( request.getInactiveProfileIds() ); - setSystemProperties( request.getSystemProperties() ); - setUserProperties( request.getUserProperties() ); - setRemoteRepositories( request.getRemoteRepositories() ); - setPluginArtifactRepositories( request.getPluginArtifactRepositories() ); - setRepositorySession( request.getRepositorySession() ); - setLocalRepository( request.getLocalRepository() ); - setBuildStartTime( request.getBuildStartTime() ); - setProject( request.getProject() ); - setResolveDependencies( request.isResolveDependencies() ); - setValidationLevel( request.getValidationLevel() ); - } - - public MavenProject getProject() - { - return project; - } - - public void setProject( MavenProject mavenProject ) - { - this.project = mavenProject; - } - - public ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository ) - { - this.localRepository = localRepository; - return this; - } - - public ArtifactRepository getLocalRepository() - { - return localRepository; - } - - public List<ArtifactRepository> getRemoteRepositories() - { - return remoteRepositories; - } - - public ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories ) - { - if ( remoteRepositories != null ) - { - this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories ); - } - else - { - this.remoteRepositories.clear(); - } - - return this; - } - - public List<ArtifactRepository> getPluginArtifactRepositories() - { - return pluginArtifactRepositories; - } - - public ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories ) - { - if ( pluginArtifactRepositories != null ) - { - this.pluginArtifactRepositories = new ArrayList<ArtifactRepository>( pluginArtifactRepositories ); - } - else - { - this.pluginArtifactRepositories.clear(); - } - - return this; - } - - public Properties getSystemProperties() - { - return systemProperties; - } - - public ProjectBuildingRequest setSystemProperties( Properties systemProperties ) - { - if ( systemProperties != null ) - { - this.systemProperties = new Properties(); - synchronized ( systemProperties ) - { // avoid concurrentmodification if someone else sets/removes an unrelated system property - this.systemProperties.putAll( systemProperties ); - } - } - else - { - this.systemProperties.clear(); - } - - return this; - } - - public Properties getUserProperties() - { - return userProperties; - } - - public ProjectBuildingRequest setUserProperties( Properties userProperties ) - { - if ( userProperties != null ) - { - this.userProperties = new Properties(); - this.userProperties.putAll( userProperties ); - } - else - { - this.userProperties.clear(); - } - - return this; - } - - public boolean isProcessPlugins() - { - return processPlugins; - } - - public ProjectBuildingRequest setProcessPlugins( boolean processPlugins ) - { - this.processPlugins = processPlugins; - return this; - } - - public ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies ) - { - this.resolveDependencies = resolveDependencies; - return this; - } - - public boolean isResolveDependencies() - { - return resolveDependencies; - } - - /** @since 3.2.2 */ - public ProjectBuildingRequest setResolveVersionRanges( boolean value ) - { - this.resolveVersionRanges = value; - return this; - } - - /** @since 3.2.2 */ - public boolean isResolveVersionRanges() - { - return this.resolveVersionRanges; - } - - public ProjectBuildingRequest setValidationLevel( int validationLevel ) - { - this.validationLevel = validationLevel; - return this; - } - - public int getValidationLevel() - { - return validationLevel; - } - - public List<String> getActiveProfileIds() - { - return activeProfileIds; - } - - public void setActiveProfileIds( List<String> activeProfileIds ) - { - if ( activeProfileIds != null ) - { - this.activeProfileIds = new ArrayList<String>( activeProfileIds ); - } - else - { - this.activeProfileIds.clear(); - } - } - - public List<String> getInactiveProfileIds() - { - return inactiveProfileIds; - } - - public void setInactiveProfileIds( List<String> inactiveProfileIds ) - { - if ( inactiveProfileIds != null ) - { - this.inactiveProfileIds = new ArrayList<String>( inactiveProfileIds ); - } - else - { - this.inactiveProfileIds.clear(); - } - } - - public void setProfiles( List<Profile> profiles ) - { - if ( profiles != null ) - { - this.profiles = new ArrayList<Profile>( profiles ); - } - else - { - this.profiles.clear(); - } - } - - public void addProfile( Profile profile ) - { - profiles.add( profile ); - } - - public List<Profile> getProfiles() - { - return profiles; - } - - public Date getBuildStartTime() - { - return buildStartTime; - } - - public void setBuildStartTime( Date buildStartTime ) - { - this.buildStartTime = buildStartTime; - } - - public RepositorySystemSession getRepositorySession() - { - return repositorySession; - } - - public DefaultProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession ) - { - this.repositorySession = repositorySession; - return this; - } - - public DefaultProjectBuildingRequest setRepositoryMerging( RepositoryMerging repositoryMerging ) - { - if ( repositoryMerging == null ) - { - throw new IllegalArgumentException( "repository merge mode not specified" ); - } - this.repositoryMerging = repositoryMerging; - return this; - } - - public RepositoryMerging getRepositoryMerging() - { - return repositoryMerging; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java deleted file mode 100644 index b64a395d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.model.building.ModelProblem; - -/** - * Collects the output of the project builder. - * - * @author Benjamin Bentmann - */ -class DefaultProjectBuildingResult - implements ProjectBuildingResult -{ - - private String projectId; - - private File pomFile; - - private MavenProject project; - - private List<ModelProblem> problems; - - private DependencyResolutionResult dependencyResolutionResult; - - /** - * Creates a new result with the specified contents. - * - * @param project The project that was built, may be {@code null}. - * @param problems The problems that were encouterned, may be {@code null}. - * @param dependencyResolutionResult The result of the resolution for the project dependencies, may be {@code null}. - */ - public DefaultProjectBuildingResult( MavenProject project, List<ModelProblem> problems, - DependencyResolutionResult dependencyResolutionResult ) - { - this.projectId = - ( project != null ) ? project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion() - : ""; - this.pomFile = ( project != null ) ? project.getFile() : null; - this.project = project; - this.problems = problems; - this.dependencyResolutionResult = dependencyResolutionResult; - } - - /** - * Creates a new result with the specified contents. - * - * @param projectId The identifier of the project, may be {@code null}. - * @param pomFile The POM file from which the project was built, may be {@code null}. - * @param problems The problems that were encouterned, may be {@code null}. - */ - public DefaultProjectBuildingResult( String projectId, File pomFile, List<ModelProblem> problems ) - { - this.projectId = ( projectId != null ) ? projectId : ""; - this.pomFile = pomFile; - this.problems = problems; - } - - public String getProjectId() - { - return projectId; - } - - public File getPomFile() - { - return pomFile; - } - - public MavenProject getProject() - { - return project; - } - - public List<ModelProblem> getProblems() - { - if ( problems == null ) - { - problems = new ArrayList<ModelProblem>(); - } - - return problems; - } - - public DependencyResolutionResult getDependencyResolutionResult() - { - return dependencyResolutionResult; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java deleted file mode 100644 index 1287eb14..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java +++ /dev/null @@ -1,333 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.Exclusion; -import org.apache.maven.model.InputLocation; -import org.apache.maven.model.InputSource; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.StringUtils; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.artifact.ArtifactProperties; -import org.eclipse.aether.artifact.ArtifactType; -import org.eclipse.aether.artifact.ArtifactTypeRegistry; -import org.eclipse.aether.collection.CollectRequest; -import org.eclipse.aether.collection.DependencyCollectionException; -import org.eclipse.aether.graph.DependencyFilter; -import org.eclipse.aether.graph.DependencyNode; -import org.eclipse.aether.graph.DependencyVisitor; -import org.eclipse.aether.resolution.ArtifactResult; -import org.eclipse.aether.resolution.DependencyRequest; -import org.eclipse.aether.util.artifact.ArtifactIdUtils; -import org.eclipse.aether.util.artifact.JavaScopes; -import org.eclipse.aether.util.graph.manager.DependencyManagerUtils; - -/** - * @author Benjamin Bentmann - */ -@Component( role = ProjectDependenciesResolver.class ) -public class DefaultProjectDependenciesResolver - implements ProjectDependenciesResolver -{ - - @Requirement - private Logger logger; - - @Requirement - private RepositorySystem repoSystem; - - @Requirement - private List<RepositorySessionDecorator> decorators; - - public DependencyResolutionResult resolve( DependencyResolutionRequest request ) - throws DependencyResolutionException - { - final RequestTrace trace = RequestTrace.newChild( null, request ); - - final DefaultDependencyResolutionResult result = new DefaultDependencyResolutionResult(); - - final MavenProject project = request.getMavenProject(); - final DependencyFilter filter = request.getResolutionFilter(); - RepositorySystemSession session = request.getRepositorySession(); - ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry(); - - if ( logger.isDebugEnabled() - && session.getConfigProperties().get( DependencyManagerUtils.CONFIG_PROP_VERBOSE ) == null ) - { - DefaultRepositorySystemSession verbose = new DefaultRepositorySystemSession( session ); - verbose.setConfigProperty( DependencyManagerUtils.CONFIG_PROP_VERBOSE, Boolean.TRUE ); - session = verbose; - } - - for ( RepositorySessionDecorator decorator : decorators ) - { - RepositorySystemSession decorated = decorator.decorate( project, session ); - if ( decorated != null ) - { - session = decorated; - } - } - - CollectRequest collect = new CollectRequest(); - collect.setRootArtifact( RepositoryUtils.toArtifact( project.getArtifact() ) ); - collect.setRequestContext( "project" ); - collect.setRepositories( project.getRemoteProjectRepositories() ); - - if ( project.getDependencyArtifacts() == null ) - { - for ( Dependency dependency : project.getDependencies() ) - { - if ( StringUtils.isEmpty( dependency.getGroupId() ) || StringUtils.isEmpty( dependency.getArtifactId() ) - || StringUtils.isEmpty( dependency.getVersion() ) ) - { - // guard against case where best-effort resolution for invalid models is requested - continue; - } - collect.addDependency( RepositoryUtils.toDependency( dependency, stereotypes ) ); - } - } - else - { - Map<String, Dependency> dependencies = new HashMap<String, Dependency>(); - for ( Dependency dependency : project.getDependencies() ) - { - String classifier = dependency.getClassifier(); - if ( classifier == null ) - { - ArtifactType type = stereotypes.get( dependency.getType() ); - if ( type != null ) - { - classifier = type.getClassifier(); - } - } - String key = - ArtifactIdUtils.toVersionlessId( dependency.getGroupId(), dependency.getArtifactId(), - dependency.getType(), classifier ); - dependencies.put( key, dependency ); - } - for ( Artifact artifact : project.getDependencyArtifacts() ) - { - String key = artifact.getDependencyConflictId(); - Dependency dependency = dependencies.get( key ); - Collection<Exclusion> exclusions = dependency != null ? dependency.getExclusions() : null; - org.eclipse.aether.graph.Dependency dep = RepositoryUtils.toDependency( artifact, exclusions ); - if ( !JavaScopes.SYSTEM.equals( dep.getScope() ) && dep.getArtifact().getFile() != null ) - { - // enable re-resolution - org.eclipse.aether.artifact.Artifact art = dep.getArtifact(); - art = art.setFile( null ).setVersion( art.getBaseVersion() ); - dep = dep.setArtifact( art ); - } - collect.addDependency( dep ); - } - } - - DependencyManagement depMngt = project.getDependencyManagement(); - if ( depMngt != null ) - { - for ( Dependency dependency : depMngt.getDependencies() ) - { - collect.addManagedDependency( RepositoryUtils.toDependency( dependency, stereotypes ) ); - } - } - - DependencyRequest depRequest = new DependencyRequest( collect, filter ); - depRequest.setTrace( trace ); - - DependencyNode node; - try - { - collect.setTrace( RequestTrace.newChild( trace, depRequest ) ); - node = repoSystem.collectDependencies( session, collect ).getRoot(); - result.setDependencyGraph( node ); - } - catch ( DependencyCollectionException e ) - { - result.setDependencyGraph( e.getResult().getRoot() ); - result.setCollectionErrors( e.getResult().getExceptions() ); - - throw new DependencyResolutionException( result, "Could not resolve dependencies for project " - + project.getId() + ": " + e.getMessage(), e ); - } - - depRequest.setRoot( node ); - - if ( logger.isWarnEnabled() ) - { - for ( DependencyNode child : node.getChildren() ) - { - if ( !child.getRelocations().isEmpty() ) - { - logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to " - + child.getDependency().getArtifact() ); - } - } - } - - if ( logger.isDebugEnabled() ) - { - node.accept( new GraphLogger( project ) ); - } - - try - { - process( result, repoSystem.resolveDependencies( session, depRequest ).getArtifactResults() ); - } - catch ( org.eclipse.aether.resolution.DependencyResolutionException e ) - { - process( result, e.getResult().getArtifactResults() ); - - throw new DependencyResolutionException( result, "Could not resolve dependencies for project " - + project.getId() + ": " + e.getMessage(), e ); - } - - return result; - } - - private void process( DefaultDependencyResolutionResult result, Collection<ArtifactResult> results ) - { - for ( ArtifactResult ar : results ) - { - DependencyNode node = ar.getRequest().getDependencyNode(); - if ( ar.isResolved() ) - { - result.addResolvedDependency( node.getDependency() ); - } - else - { - result.setResolutionErrors( node.getDependency(), ar.getExceptions() ); - } - } - } - - class GraphLogger - implements DependencyVisitor - { - - private final MavenProject project; - - private String indent = ""; - - private Map<String, Dependency> managed; - - public GraphLogger( MavenProject project ) - { - this.project = project; - } - - public boolean visitEnter( DependencyNode node ) - { - StringBuilder buffer = new StringBuilder( 128 ); - buffer.append( indent ); - org.eclipse.aether.graph.Dependency dep = node.getDependency(); - if ( dep != null ) - { - org.eclipse.aether.artifact.Artifact art = dep.getArtifact(); - - buffer.append( art ); - buffer.append( ':' ).append( dep.getScope() ); - - String premanagedScope = DependencyManagerUtils.getPremanagedScope( node ); - if ( premanagedScope != null && !premanagedScope.equals( dep.getScope() ) ) - { - buffer.append( " (scope managed from " ).append( premanagedScope ); - appendManagementSource( buffer, art, "scope" ); - buffer.append( ")" ); - } - - String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node ); - if ( premanagedVersion != null && !premanagedVersion.equals( art.getVersion() ) ) - { - buffer.append( " (version managed from " ).append( premanagedVersion ); - appendManagementSource( buffer, art, "version" ); - buffer.append( ")" ); - } - } - else - { - buffer.append( project.getGroupId() ); - buffer.append( ':' ).append( project.getArtifactId() ); - buffer.append( ':' ).append( project.getPackaging() ); - buffer.append( ':' ).append( project.getVersion() ); - } - - logger.debug( buffer.toString() ); - indent += " "; - return true; - } - - public boolean visitLeave( DependencyNode node ) - { - indent = indent.substring( 0, indent.length() - 3 ); - return true; - } - - private void appendManagementSource( StringBuilder buffer, org.eclipse.aether.artifact.Artifact artifact, - String field ) - { - if ( managed == null ) - { - managed = new HashMap<String, Dependency>(); - if ( project.getDependencyManagement() != null ) - { - for ( Dependency dep : project.getDependencyManagement().getDependencies() ) - { - managed.put( dep.getManagementKey(), dep ); - } - } - } - - String key = - ArtifactIdUtils.toVersionlessId( artifact.getGroupId(), artifact.getArtifactId(), - artifact.getProperty( ArtifactProperties.TYPE, "jar" ), - artifact.getClassifier() ); - - Dependency dependency = managed.get( key ); - if ( dependency != null ) - { - InputLocation location = dependency.getLocation( field ); - if ( location != null ) - { - InputSource source = location.getSource(); - if ( source != null ) - { - buffer.append( " by " ).append( source.getModelId() ); - } - } - } - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java deleted file mode 100644 index 53b82bcf..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.codehaus.plexus.classworlds.realm.ClassRealm; -import org.codehaus.plexus.classworlds.realm.NoSuchRealmException; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; -import org.eclipse.aether.graph.DependencyFilter; - -/** - * Default project realm cache implementation. Assumes cached data does not change. - */ -@Component( role = ProjectRealmCache.class ) -public class DefaultProjectRealmCache - implements ProjectRealmCache, Disposable -{ - - protected static class CacheKey - implements Key - { - - private final List<? extends ClassRealm> extensionRealms; - - private final int hashCode; - - public CacheKey( List<? extends ClassRealm> extensionRealms ) - { - this.extensionRealms = ( extensionRealms != null ) ? extensionRealms : Collections.<ClassRealm>emptyList(); - - this.hashCode = this.extensionRealms.hashCode(); - } - - @Override - public int hashCode() - { - return hashCode; - } - - @Override - public boolean equals( Object o ) - { - if ( o == this ) - { - return true; - } - - if ( !( o instanceof CacheKey ) ) - { - return false; - } - - CacheKey other = (CacheKey) o; - - return extensionRealms.equals( other.extensionRealms ); - } - - @Override - public String toString() - { - return extensionRealms.toString(); - } - } - - protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<Key, CacheRecord>(); - - @Override - public Key createKey( List<? extends ClassRealm> extensionRealms ) - { - return new CacheKey( extensionRealms ); - } - - public CacheRecord get( Key key ) - { - return cache.get( key ); - } - - public CacheRecord put( Key key, ClassRealm projectRealm, DependencyFilter extensionArtifactFilter ) - { - if ( projectRealm == null ) - { - throw new NullPointerException(); - } - - if ( cache.containsKey( key ) ) - { - throw new IllegalStateException( "Duplicate project realm for extensions " + key ); - } - - CacheRecord record = new CacheRecord( projectRealm, extensionArtifactFilter ); - - cache.put( key, record ); - - return record; - } - - public void flush() - { - for ( CacheRecord record : cache.values() ) - { - ClassRealm realm = record.realm; - try - { - realm.getWorld().disposeRealm( realm.getId() ); - } - catch ( NoSuchRealmException e ) - { - // ignore - } - } - cache.clear(); - } - - public void register( MavenProject project, Key key, CacheRecord record ) - { - // default cache does not track record usage - } - - @Override - public void dispose() - { - flush(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java deleted file mode 100644 index 50e601e7..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * @author Benjamin Bentmann - */ -public class DependencyResolutionException - extends Exception -{ - - private DependencyResolutionResult result; - - public DependencyResolutionException( DependencyResolutionResult result, String message, Throwable cause ) - { - super( message, cause ); - this.result = result; - } - - public DependencyResolutionResult getResult() - { - return result; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java deleted file mode 100644 index c120a137..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.graph.DependencyFilter; - -/** - * A request to resolve the dependencies of a project. - * - * @author Benjamin Bentmann - */ -public interface DependencyResolutionRequest -{ - - /** - * Gets the project to resolve dependencies for. - * - * @return The project to resolve dependencies for or {@code null} if not set. - */ - MavenProject getMavenProject(); - - /** - * Sets the project to resolve dependencies for. - * - * @param project The project to resolve dependencies for, may be {@code null}. - * @return This request for chaining, never {@code null}. - */ - DependencyResolutionRequest setMavenProject( MavenProject project ); - - /** - * Gets the filter used to exclude some dependencies from resolution. - * - * @return The filter to exclude dependencies from resolution or {@code null} to resolve all dependencies. - */ - DependencyFilter getResolutionFilter(); - - /** - * Sets the filter used to exclude some dependencies from resolution. Note that this filter only controls the - * resolution/download of dependency artifacts, not the inclusion of dependency nodes in the resolved dependency - * graph. - * - * @param filter The filter to exclude dependencies from resolution, may be {@code null} to resolve all - * dependencies. - * @return This request for chaining, never {@code null}. - */ - DependencyResolutionRequest setResolutionFilter( DependencyFilter filter ); - - /** - * Gets the session to use for repository access. - * - * @return The repository session or {@code null} if not set. - */ - RepositorySystemSession getRepositorySession(); - - /** - * Sets the session to use for repository access. - * - * @param repositorySession The repository session to use. - * @return This request for chaining, never {@code null}. - */ - DependencyResolutionRequest setRepositorySession( RepositorySystemSession repositorySession ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java deleted file mode 100644 index 6ad55fae..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; - -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.graph.DependencyNode; - -/** - * The result of a project dependency resolution. - * - * @author Benjamin Bentmann - */ -public interface DependencyResolutionResult -{ - - /** - * Gets the dependency graph of the project. - * - * @return The dependency graph or {@code null} if not available. - */ - DependencyNode getDependencyGraph(); - - /** - * Gets the transitive dependencies of the project that were not excluded by - * {@link DependencyResolutionRequest#getResolutionFilter()}. This list is a union of the results from - * {@link #getResolvedDependencies()} and {@link #getUnresolvedDependencies()}. - * - * @return The transitive dependencies, never {@code null}. - */ - List<Dependency> getDependencies(); - - /** - * Gets the dependencies that were successfully resolved. - * - * @return The resolved dependencies, never {@code null}. - */ - List<Dependency> getResolvedDependencies(); - - /** - * Gets the dependencies that could not be resolved. - * - * @return The unresolved dependencies, never {@code null}. - */ - List<Dependency> getUnresolvedDependencies(); - - /** - * Gets the errors that occurred while building the dependency graph. - * - * @return The errors that occurred while building the dependency graph, never {@code null}. - */ - List<Exception> getCollectionErrors(); - - /** - * Gets the errors that occurred while resolving the specified dependency. - * - * @param dependency The dependency for which to retrieve the errors, must not be {@code null}. - * @return The resolution errors for the specified dependency, never {@code null}. - */ - List<Exception> getResolutionErrors( Dependency dependency ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java deleted file mode 100644 index 6121473d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.artifact.Artifact; - -/** - * This exception is thrown if an application attempts to attach - * two of the same artifacts to a single project. - * - * @author pgier - * @author jdcasey - * @todo Make this a checked exception, and modify the API of MavenProjectHelper. - * Currently, this modification would create compatibility problems for existing plugins. - */ -public class DuplicateArtifactAttachmentException - extends RuntimeException -{ - - private static final String DEFAULT_MESSAGE = "Duplicate artifact attachment detected."; - - private Artifact artifact; - - private final MavenProject project; - - public DuplicateArtifactAttachmentException( MavenProject project, Artifact artifact ) - { - super( constructMessage( project, artifact ) ); - this.project = project; - this.artifact = artifact; - } - - private static String constructMessage( MavenProject project, Artifact artifact ) - { - return DEFAULT_MESSAGE + " (project: " + project.getId() + "; illegal attachment: " + artifact.getId() + ")"; - } - - public MavenProject getProject() - { - return project; - } - - public Artifact getArtifact() - { - return artifact; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java deleted file mode 100644 index f73c46b2..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; - -/** - * Exception that occurs when the project list contains duplicate projects instead of ignoring one. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class DuplicateProjectException - extends Exception -{ - private final String projectId; - - private final File existingProjectFile; - - private final File conflictingProjectFile; - - /** - * @deprecated use {@link #DuplicateProjectException(String, File, File, String)} - */ - public DuplicateProjectException( String message ) - { - this( null, null, null, message ); - } - - /** - * @deprecated use {@link #DuplicateProjectException(String, File, File, String)} - */ - public DuplicateProjectException( String message, Exception e ) - { - super( message, e ); - this.projectId = null; - this.existingProjectFile = null; - this.conflictingProjectFile = null; - } - - public DuplicateProjectException( String projectId, File existingProjectFile, File conflictingProjectFile, - String message ) - { - super( message ); - this.projectId = projectId; - this.existingProjectFile = existingProjectFile; - this.conflictingProjectFile = conflictingProjectFile; - } - - public String getProjectId() - { - return projectId; - } - - public File getExistingProjectFile() - { - return existingProjectFile; - } - - public File getConflictingProjectFile() - { - return conflictingProjectFile; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java deleted file mode 100644 index 062b8b77..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.List; - -/** - * Provides metadata about a build extension. <strong>Warning:</strong> This is an internal utility class that is only - * public for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted - * without prior notice. - * - * @author Benjamin Bentmann - */ -public class ExtensionDescriptor -{ - - private List<String> exportedPackages; - - private List<String> exportedArtifacts; - - ExtensionDescriptor() - { - // hide constructor - } - - public List<String> getExportedPackages() - { - if ( exportedPackages == null ) - { - exportedPackages = new ArrayList<String>(); - } - - return exportedPackages; - } - - public void setExportedPackages( List<String> exportedPackages ) - { - if ( exportedPackages == null ) - { - this.exportedPackages = null; - } - else - { - this.exportedPackages = new ArrayList<String>( exportedPackages ); - } - } - - public List<String> getExportedArtifacts() - { - if ( exportedArtifacts == null ) - { - exportedArtifacts = new ArrayList<String>(); - } - - return exportedArtifacts; - } - - public void setExportedArtifacts( List<String> exportedArtifacts ) - { - if ( exportedArtifacts == null ) - { - this.exportedArtifacts = null; - } - else - { - this.exportedArtifacts = new ArrayList<String>( exportedArtifacts ); - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java deleted file mode 100644 index c835eff5..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.jar.JarFile; -import java.util.zip.ZipEntry; - -import org.codehaus.plexus.util.IOUtil; -import org.codehaus.plexus.util.ReaderFactory; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -/** - * Creates an extension descriptor from some XML stream. - * - * @author Benjamin Bentmann - */ -public class ExtensionDescriptorBuilder -{ - - /** - * @since 3.3.0 - */ - public String getExtensionDescriptorLocation() - { - return "META-INF/maven/extension.xml"; - } - - /** - * Extracts the extension descriptor (if any) from the specified JAR file. - * - * @param extensionJar The JAR file or directory to extract the descriptor from, must not be {@code null}. - * @return The extracted descriptor or {@code null} if no descriptor was found. - * @throws IOException If the descriptor is present but could not be parsed. - */ - public ExtensionDescriptor build( File extensionJar ) - throws IOException - { - ExtensionDescriptor extensionDescriptor = null; - - if ( extensionJar.isFile() ) - { - JarFile pluginJar = new JarFile( extensionJar, false ); - try - { - ZipEntry pluginDescriptorEntry = pluginJar.getEntry( getExtensionDescriptorLocation() ); - - if ( pluginDescriptorEntry != null ) - { - InputStream is = pluginJar.getInputStream( pluginDescriptorEntry ); - - try - { - extensionDescriptor = build( is ); - } - finally - { - IOUtil.close( is ); - } - } - } - finally - { - pluginJar.close(); - } - } - else - { - File pluginXml = new File( extensionJar, getExtensionDescriptorLocation() ); - - if ( pluginXml.canRead() ) - { - InputStream is = new BufferedInputStream( new FileInputStream( pluginXml ) ); - try - { - extensionDescriptor = build( is ); - } - finally - { - IOUtil.close( is ); - } - } - } - - return extensionDescriptor; - } - - /** - * @since 3.3.0 - */ - public ExtensionDescriptor build( InputStream is ) - throws IOException - { - ExtensionDescriptor extensionDescriptor = new ExtensionDescriptor(); - - Xpp3Dom dom; - try - { - dom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( is ) ); - } - catch ( XmlPullParserException e ) - { - throw (IOException) new IOException( e.getMessage() ).initCause( e ); - } - - if ( !"extension".equals( dom.getName() ) ) - { - throw new IOException( "Unexpected root element \"" + dom.getName() + "\", expected \"extension\"" ); - } - - extensionDescriptor.setExportedPackages( parseStrings( dom.getChild( "exportedPackages" ) ) ); - - extensionDescriptor.setExportedArtifacts( parseStrings( dom.getChild( "exportedArtifacts" ) ) ); - - return extensionDescriptor; - } - - private List<String> parseStrings( Xpp3Dom dom ) - { - List<String> strings = null; - - if ( dom != null ) - { - strings = new ArrayList<String>(); - - for ( Xpp3Dom child : dom.getChildren() ) - { - String string = child.getValue(); - if ( string != null ) - { - string = string.trim(); - if ( string.length() > 0 ) - { - strings.add( string ); - } - } - } - } - - return strings; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java deleted file mode 100644 index 5e42ee46..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; - -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; - -public class InvalidProjectVersionException - extends ProjectBuildingException -{ - - private final String locationInPom; - - private final String offendingVersion; - - public InvalidProjectVersionException( String projectId, String locationInPom, String offendingVersion, - File pomFile, InvalidVersionSpecificationException cause ) - { - super( projectId, formatMessage( projectId, locationInPom, offendingVersion, cause ), pomFile, cause ); - this.locationInPom = locationInPom; - this.offendingVersion = offendingVersion; - } - - private static String formatMessage( String projectId, String locationInPom, String offendingVersion, - InvalidVersionSpecificationException cause ) - { - return "Invalid version: " + offendingVersion + " found for: " + locationInPom + " in project: " + projectId - + ". Reason: " + cause.getMessage(); - } - - public String getOffendingVersion() - { - return offendingVersion; - } - - public String getLocationInPom() - { - return locationInPom; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java deleted file mode 100644 index 8587a5c3..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ /dev/null @@ -1,1976 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.DependencyResolutionRequiredException; -// remove once createArtifacts() is removed -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.model.Build; -import org.apache.maven.model.CiManagement; -import org.apache.maven.model.Contributor; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.Developer; -import org.apache.maven.model.DistributionManagement; -import org.apache.maven.model.Extension; -import org.apache.maven.model.IssueManagement; -import org.apache.maven.model.License; -import org.apache.maven.model.MailingList; -import org.apache.maven.model.Model; -import org.apache.maven.model.Organization; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginExecution; -import org.apache.maven.model.PluginManagement; -import org.apache.maven.model.Prerequisites; -import org.apache.maven.model.Profile; -import org.apache.maven.model.ReportPlugin; -import org.apache.maven.model.ReportSet; -import org.apache.maven.model.Reporting; -import org.apache.maven.model.Repository; -import org.apache.maven.model.Resource; -import org.apache.maven.model.Scm; -import org.apache.maven.model.io.xpp3.MavenXpp3Writer; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.apache.maven.project.artifact.MavenMetadataSource; -import org.codehaus.plexus.classworlds.realm.ClassRealm; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.eclipse.aether.graph.DependencyFilter; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * The concern of the project is provide runtime values based on the model. - * <p/> - * The values in the model remain untouched but during the process of building a project notions like inheritance and - * interpolation can be added. This allows to have an entity which is useful in a runtime while preserving the model so - * that it can be marshalled and unmarshalled without being tainted by runtime requirements. - * <p/> - * <p> - * With changes during 3.2.2 release MavenProject is closer to being immutable after construction with the removal of - * all components from this class, and the upfront construction taken care of entirely by the @{ProjectBuilder}. There - * is still the issue of having to run the lifecycle in order to find all the compile source roots and resource - * directories but I hope to take care of this during the Maven 4.0 release (jvz). - * </p> - */ -public class MavenProject - implements Cloneable -{ - public static final String EMPTY_PROJECT_GROUP_ID = "unknown"; - - public static final String EMPTY_PROJECT_ARTIFACT_ID = "empty-project"; - - public static final String EMPTY_PROJECT_VERSION = "0"; - - private Model model; - - private MavenProject parent; - - private File file; - - private File basedir; - - private Set<Artifact> resolvedArtifacts; - - private ArtifactFilter artifactFilter; - - private Set<Artifact> artifacts; - - private Artifact parentArtifact; - - private Set<Artifact> pluginArtifacts; - - private List<ArtifactRepository> remoteArtifactRepositories; - - private List<ArtifactRepository> pluginArtifactRepositories; - - private List<RemoteRepository> remoteProjectRepositories; - - private List<RemoteRepository> remotePluginRepositories; - - private List<Artifact> attachedArtifacts; - - private MavenProject executionProject; - - private List<MavenProject> collectedProjects; - - private List<String> compileSourceRoots = new ArrayList<String>(); - - private List<String> testCompileSourceRoots = new ArrayList<String>(); - - private List<String> scriptSourceRoots = new ArrayList<String>(); - - private ArtifactRepository releaseArtifactRepository; - - private ArtifactRepository snapshotArtifactRepository; - - private List<Profile> activeProfiles = new ArrayList<Profile>(); - - private Map<String, List<String>> injectedProfileIds = new LinkedHashMap<String, List<String>>(); - - private Set<Artifact> dependencyArtifacts; - - private Artifact artifact; - - // calculated. - private Map<String, Artifact> artifactMap; - - private Model originalModel; - - private Map<String, Artifact> pluginArtifactMap; - - private Set<Artifact> reportArtifacts; - - private Map<String, Artifact> reportArtifactMap; - - private Set<Artifact> extensionArtifacts; - - private Map<String, Artifact> extensionArtifactMap; - - private Map<String, Artifact> managedVersionMap; - - private Map<String, MavenProject> projectReferences = new HashMap<String, MavenProject>(); - - private boolean executionRoot; - - private File parentFile; - - private Map<String, Object> context; - - private ClassRealm classRealm; - - private DependencyFilter extensionDependencyFilter; - - private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() ); - - public MavenProject() - { - Model model = new Model(); - - model.setGroupId( EMPTY_PROJECT_GROUP_ID ); - model.setArtifactId( EMPTY_PROJECT_ARTIFACT_ID ); - model.setVersion( EMPTY_PROJECT_VERSION ); - - setModel( model ); - } - - public MavenProject( Model model ) - { - setModel( model ); - } - - public MavenProject( MavenProject project ) - { - deepCopy( project ); - } - - public File getParentFile() - { - return parentFile; - } - - public void setParentFile( File parentFile ) - { - this.parentFile = parentFile; - } - - // ---------------------------------------------------------------------- - // Accessors - // ---------------------------------------------------------------------- - - public Artifact getArtifact() - { - return artifact; - } - - public void setArtifact( Artifact artifact ) - { - this.artifact = artifact; - } - - // @todo I would like to get rid of this. jvz. - public Model getModel() - { - return model; - } - - /** - * Returns the project corresponding to a declared parent. - * - * @return the parent, or null if no parent is declared or there was an error building it - */ - public MavenProject getParent() - { - return parent; - } - - public void setParent( MavenProject parent ) - { - this.parent = parent; - } - - public boolean hasParent() - { - return getParent() != null; - } - - public File getFile() - { - return file; - } - - public void setFile( File file ) - { - this.file = file; - this.basedir = file != null ? file.getParentFile() : null; - } - - /** - * Sets project {@code file} without changing project {@code basedir}. - * - * @since 3.2.4 - */ - public void setPomFile( File file ) - { - this.file = file; - } - - public File getBasedir() - { - return basedir; - } - - public void setDependencies( List<Dependency> dependencies ) - { - getModel().setDependencies( dependencies ); - } - - public List<Dependency> getDependencies() - { - return getModel().getDependencies(); - } - - public DependencyManagement getDependencyManagement() - { - return getModel().getDependencyManagement(); - } - - // ---------------------------------------------------------------------- - // Test and compile sourceroots. - // ---------------------------------------------------------------------- - - private void addPath( List<String> paths, String path ) - { - if ( path != null ) - { - path = path.trim(); - if ( path.length() > 0 ) - { - File file = new File( path ); - if ( file.isAbsolute() ) - { - path = file.getAbsolutePath(); - } - else - { - path = new File( getBasedir(), path ).getAbsolutePath(); - } - - if ( !paths.contains( path ) ) - { - paths.add( path ); - } - } - } - } - - public void addCompileSourceRoot( String path ) - { - addPath( getCompileSourceRoots(), path ); - } - - public void addTestCompileSourceRoot( String path ) - { - addPath( getTestCompileSourceRoots(), path ); - } - - public List<String> getCompileSourceRoots() - { - return compileSourceRoots; - } - - public List<String> getTestCompileSourceRoots() - { - return testCompileSourceRoots; - } - - public List<String> getCompileClasspathElements() - throws DependencyResolutionRequiredException - { - List<String> list = new ArrayList<String>( getArtifacts().size() + 1 ); - - String d = getBuild().getOutputDirectory(); - if ( d != null ) - { - list.add( d ); - } - - for ( Artifact a : getArtifacts() ) - { - if ( a.getArtifactHandler().isAddedToClasspath() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) - || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) - { - addArtifactPath( a, list ); - } - } - } - - return list; - } - - // TODO: this checking for file == null happens because the resolver has been confused about the root - // artifact or not. things like the stupid dummy artifact coming from surefire. - public List<String> getTestClasspathElements() - throws DependencyResolutionRequiredException - { - List<String> list = new ArrayList<String>( getArtifacts().size() + 2 ); - - String d = getBuild().getTestOutputDirectory(); - if ( d != null ) - { - list.add( d ); - } - - d = getBuild().getOutputDirectory(); - if ( d != null ) - { - list.add( d ); - } - - for ( Artifact a : getArtifacts() ) - { - if ( a.getArtifactHandler().isAddedToClasspath() ) - { - addArtifactPath( a, list ); - } - } - - return list; - } - - public List<String> getRuntimeClasspathElements() - throws DependencyResolutionRequiredException - { - List<String> list = new ArrayList<String>( getArtifacts().size() + 1 ); - - String d = getBuild().getOutputDirectory(); - if ( d != null ) - { - list.add( d ); - } - - for ( Artifact a : getArtifacts() ) - { - if ( a.getArtifactHandler().isAddedToClasspath() - // TODO: let the scope handler deal with this - && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) ) - { - addArtifactPath( a, list ); - } - } - return list; - } - - // ---------------------------------------------------------------------- - // Delegate to the model - // ---------------------------------------------------------------------- - - public void setModelVersion( String pomVersion ) - { - getModel().setModelVersion( pomVersion ); - } - - public String getModelVersion() - { - return getModel().getModelVersion(); - } - - public String getId() - { - return getModel().getId(); - } - - public void setGroupId( String groupId ) - { - getModel().setGroupId( groupId ); - } - - public String getGroupId() - { - String groupId = getModel().getGroupId(); - - if ( ( groupId == null ) && ( getModel().getParent() != null ) ) - { - groupId = getModel().getParent().getGroupId(); - } - - return groupId; - } - - public void setArtifactId( String artifactId ) - { - getModel().setArtifactId( artifactId ); - } - - public String getArtifactId() - { - return getModel().getArtifactId(); - } - - public void setName( String name ) - { - getModel().setName( name ); - } - - public String getName() - { - // TODO: this should not be allowed to be null. - if ( getModel().getName() != null ) - { - return getModel().getName(); - } - else - { - return getArtifactId(); - } - } - - public void setVersion( String version ) - { - getModel().setVersion( version ); - } - - public String getVersion() - { - String version = getModel().getVersion(); - - if ( ( version == null ) && ( getModel().getParent() != null ) ) - { - version = getModel().getParent().getVersion(); - } - - return version; - } - - public String getPackaging() - { - return getModel().getPackaging(); - } - - public void setPackaging( String packaging ) - { - getModel().setPackaging( packaging ); - } - - public void setInceptionYear( String inceptionYear ) - { - getModel().setInceptionYear( inceptionYear ); - } - - public String getInceptionYear() - { - return getModel().getInceptionYear(); - } - - public void setUrl( String url ) - { - getModel().setUrl( url ); - } - - public String getUrl() - { - return getModel().getUrl(); - } - - public Prerequisites getPrerequisites() - { - return getModel().getPrerequisites(); - } - - public void setIssueManagement( IssueManagement issueManagement ) - { - getModel().setIssueManagement( issueManagement ); - } - - public CiManagement getCiManagement() - { - return getModel().getCiManagement(); - } - - public void setCiManagement( CiManagement ciManagement ) - { - getModel().setCiManagement( ciManagement ); - } - - public IssueManagement getIssueManagement() - { - return getModel().getIssueManagement(); - } - - public void setDistributionManagement( DistributionManagement distributionManagement ) - { - getModel().setDistributionManagement( distributionManagement ); - } - - public DistributionManagement getDistributionManagement() - { - return getModel().getDistributionManagement(); - } - - public void setDescription( String description ) - { - getModel().setDescription( description ); - } - - public String getDescription() - { - return getModel().getDescription(); - } - - public void setOrganization( Organization organization ) - { - getModel().setOrganization( organization ); - } - - public Organization getOrganization() - { - return getModel().getOrganization(); - } - - public void setScm( Scm scm ) - { - getModel().setScm( scm ); - } - - public Scm getScm() - { - return getModel().getScm(); - } - - public void setMailingLists( List<MailingList> mailingLists ) - { - getModel().setMailingLists( mailingLists ); - } - - public List<MailingList> getMailingLists() - { - return getModel().getMailingLists(); - } - - public void addMailingList( MailingList mailingList ) - { - getModel().addMailingList( mailingList ); - } - - public void setDevelopers( List<Developer> developers ) - { - getModel().setDevelopers( developers ); - } - - public List<Developer> getDevelopers() - { - return getModel().getDevelopers(); - } - - public void addDeveloper( Developer developer ) - { - getModel().addDeveloper( developer ); - } - - public void setContributors( List<Contributor> contributors ) - { - getModel().setContributors( contributors ); - } - - public List<Contributor> getContributors() - { - return getModel().getContributors(); - } - - public void addContributor( Contributor contributor ) - { - getModel().addContributor( contributor ); - } - - public void setBuild( Build build ) - { - getModel().setBuild( build ); - } - - public Build getBuild() - { - return getModelBuild(); - } - - public List<Resource> getResources() - { - return getBuild().getResources(); - } - - public List<Resource> getTestResources() - { - return getBuild().getTestResources(); - } - - public void addResource( Resource resource ) - { - getBuild().addResource( resource ); - } - - public void addTestResource( Resource testResource ) - { - getBuild().addTestResource( testResource ); - } - - public void setLicenses( List<License> licenses ) - { - getModel().setLicenses( licenses ); - } - - public List<License> getLicenses() - { - return getModel().getLicenses(); - } - - public void addLicense( License license ) - { - getModel().addLicense( license ); - } - - public void setArtifacts( Set<Artifact> artifacts ) - { - this.artifacts = artifacts; - - // flush the calculated artifactMap - artifactMap = null; - } - - /** - * All dependencies that this project has, including transitive ones. Contents are lazily populated, so depending on - * what phases have run dependencies in some scopes won't be included. eg. if only compile phase has run, - * dependencies with scope test won't be included. - * - * @return {@link Set} < {@link Artifact} > - * @see #getDependencyArtifacts() to get only direct dependencies - */ - public Set<Artifact> getArtifacts() - { - if ( artifacts == null ) - { - if ( artifactFilter == null || resolvedArtifacts == null ) - { - artifacts = new LinkedHashSet<Artifact>(); - } - else - { - artifacts = new LinkedHashSet<Artifact>( resolvedArtifacts.size() * 2 ); - for ( Artifact artifact : resolvedArtifacts ) - { - if ( artifactFilter.include( artifact ) ) - { - artifacts.add( artifact ); - } - } - } - } - return artifacts; - } - - public Map<String, Artifact> getArtifactMap() - { - if ( artifactMap == null ) - { - artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() ); - } - return artifactMap; - } - - public void setPluginArtifacts( Set<Artifact> pluginArtifacts ) - { - this.pluginArtifacts = pluginArtifacts; - - this.pluginArtifactMap = null; - } - - public Set<Artifact> getPluginArtifacts() - { - return pluginArtifacts; - } - - public Map<String, Artifact> getPluginArtifactMap() - { - if ( pluginArtifactMap == null ) - { - pluginArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getPluginArtifacts() ); - } - - return pluginArtifactMap; - } - - public void setParentArtifact( Artifact parentArtifact ) - { - this.parentArtifact = parentArtifact; - } - - public Artifact getParentArtifact() - { - return parentArtifact; - } - - public List<Repository> getRepositories() - { - return getModel().getRepositories(); - } - - // ---------------------------------------------------------------------- - // Plugins - // ---------------------------------------------------------------------- - - public List<Plugin> getBuildPlugins() - { - if ( getModel().getBuild() == null ) - { - return Collections.emptyList(); - } - return getModel().getBuild().getPlugins(); - } - - public List<String> getModules() - { - return getModel().getModules(); - } - - public PluginManagement getPluginManagement() - { - PluginManagement pluginMgmt = null; - - Build build = getModel().getBuild(); - if ( build != null ) - { - pluginMgmt = build.getPluginManagement(); - } - - return pluginMgmt; - } - - private Build getModelBuild() - { - Build build = getModel().getBuild(); - - if ( build == null ) - { - build = new Build(); - - getModel().setBuild( build ); - } - - return build; - } - - public void setRemoteArtifactRepositories( List<ArtifactRepository> remoteArtifactRepositories ) - { - this.remoteArtifactRepositories = remoteArtifactRepositories; - this.remoteProjectRepositories = RepositoryUtils.toRepos( getRemoteArtifactRepositories() ); - } - - public List<ArtifactRepository> getRemoteArtifactRepositories() - { - if ( remoteArtifactRepositories == null ) - { - remoteArtifactRepositories = new ArrayList<ArtifactRepository>(); - } - - return remoteArtifactRepositories; - } - - public void setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories ) - { - this.pluginArtifactRepositories = pluginArtifactRepositories; - this.remotePluginRepositories = RepositoryUtils.toRepos( getPluginArtifactRepositories() ); - } - - /** - * @return a list of ArtifactRepository objects constructed from the Repository objects returned by - * getPluginRepositories. - */ - public List<ArtifactRepository> getPluginArtifactRepositories() - { - if ( pluginArtifactRepositories == null ) - { - pluginArtifactRepositories = new ArrayList<ArtifactRepository>(); - } - - return pluginArtifactRepositories; - } - - public ArtifactRepository getDistributionManagementArtifactRepository() - { - return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) - ? getSnapshotArtifactRepository() - : getReleaseArtifactRepository(); - } - - public List<Repository> getPluginRepositories() - { - return getModel().getPluginRepositories(); - } - - public List<RemoteRepository> getRemoteProjectRepositories() - { - return remoteProjectRepositories; - } - - public List<RemoteRepository> getRemotePluginRepositories() - { - return remotePluginRepositories; - } - - public void setActiveProfiles( List<Profile> activeProfiles ) - { - this.activeProfiles = activeProfiles; - } - - public List<Profile> getActiveProfiles() - { - return activeProfiles; - } - - public void setInjectedProfileIds( String source, List<String> injectedProfileIds ) - { - if ( injectedProfileIds != null ) - { - this.injectedProfileIds.put( source, new ArrayList<String>( injectedProfileIds ) ); - } - else - { - this.injectedProfileIds.remove( source ); - } - } - - /** - * Gets the identifiers of all profiles that contributed to this project's effective model. This includes active - * profiles from the project's POM and all its parent POMs as well as from external sources like the - * {@code settings.xml}. The profile identifiers are grouped by the identifier of their source, e.g. - * {@code <groupId>:<artifactId>:<version>} for a POM profile or {@code external} for profiles from the - * {@code settings.xml}. - * - * @return The identifiers of all injected profiles, indexed by the source from which the profiles originated, never - * {@code null}. - */ - public Map<String, List<String>> getInjectedProfileIds() - { - return this.injectedProfileIds; - } - - /** - * Add or replace an artifact. This method is now deprecated. Use the @{MavenProjectHelper} to attach artifacts to a - * project. In spite of the 'throws' declaration on this API, this method has never thrown an exception since Maven - * 3.0.x. Historically, it logged and ignored a second addition of the same g/a/v/c/t. Now it replaces the file for - * the artifact, so that plugins (e.g. shade) can change the pathname of the file for a particular set of - * coordinates. - * - * @param artifact the artifact to add or replace. - * @throws DuplicateArtifactAttachmentException - */ - public void addAttachedArtifact( Artifact artifact ) - throws DuplicateArtifactAttachmentException - { - getAttachedArtifacts().add( artifact ); - } - - public List<Artifact> getAttachedArtifacts() - { - if ( attachedArtifacts == null ) - { - attachedArtifacts = new ArrayList<Artifact>(); - } - return attachedArtifacts; - } - - public Xpp3Dom getGoalConfiguration( String pluginGroupId, String pluginArtifactId, String executionId, - String goalId ) - { - Xpp3Dom dom = null; - - if ( getBuildPlugins() != null ) - { - for ( Plugin plugin : getBuildPlugins() ) - { - if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) ) - { - dom = (Xpp3Dom) plugin.getConfiguration(); - - if ( executionId != null ) - { - PluginExecution execution = plugin.getExecutionsAsMap().get( executionId ); - if ( execution != null ) - { - // NOTE: The PluginConfigurationExpander already merged the plugin-level config in - dom = (Xpp3Dom) execution.getConfiguration(); - } - } - break; - } - } - } - - if ( dom != null ) - { - // make a copy so the original in the POM doesn't get messed with - dom = new Xpp3Dom( dom ); - } - - return dom; - } - - public MavenProject getExecutionProject() - { - return ( executionProject == null ? this : executionProject ); - } - - public void setExecutionProject( MavenProject executionProject ) - { - this.executionProject = executionProject; - } - - public List<MavenProject> getCollectedProjects() - { - return collectedProjects; - } - - public void setCollectedProjects( List<MavenProject> collectedProjects ) - { - this.collectedProjects = collectedProjects; - } - - /** - * Direct dependencies that this project has. - * - * @return {@link Set} < {@link Artifact} > - * @see #getArtifacts() to get all transitive dependencies - */ - public Set<Artifact> getDependencyArtifacts() - { - return dependencyArtifacts; - } - - public void setDependencyArtifacts( Set<Artifact> dependencyArtifacts ) - { - this.dependencyArtifacts = dependencyArtifacts; - } - - public void setReleaseArtifactRepository( ArtifactRepository releaseArtifactRepository ) - { - this.releaseArtifactRepository = releaseArtifactRepository; - } - - public void setSnapshotArtifactRepository( ArtifactRepository snapshotArtifactRepository ) - { - this.snapshotArtifactRepository = snapshotArtifactRepository; - } - - public void setOriginalModel( Model originalModel ) - { - this.originalModel = originalModel; - } - - public Model getOriginalModel() - { - return originalModel; - } - - public void setManagedVersionMap( Map<String, Artifact> map ) - { - managedVersionMap = map; - } - - public Map<String, Artifact> getManagedVersionMap() - { - return managedVersionMap; - } - - @Override - public boolean equals( Object other ) - { - if ( other == this ) - { - return true; - } - else if ( !( other instanceof MavenProject ) ) - { - return false; - } - - MavenProject that = (MavenProject) other; - - return eq( getArtifactId(), that.getArtifactId() ) && eq( getGroupId(), that.getGroupId() ) - && eq( getVersion(), that.getVersion() ); - } - - 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 = 31 * hash + getGroupId().hashCode(); - hash = 31 * hash + getArtifactId().hashCode(); - hash = 31 * hash + getVersion().hashCode(); - return hash; - } - - public List<Extension> getBuildExtensions() - { - Build build = getBuild(); - if ( ( build == null ) || ( build.getExtensions() == null ) ) - { - return Collections.emptyList(); - } - else - { - return build.getExtensions(); - } - } - - public void addProjectReference( MavenProject project ) - { - projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), - project.getVersion() ), project ); - } - - public Properties getProperties() - { - return getModel().getProperties(); - } - - public List<String> getFilters() - { - return getBuild().getFilters(); - } - - public Map<String, MavenProject> getProjectReferences() - { - return projectReferences; - } - - public boolean isExecutionRoot() - { - return executionRoot; - } - - public void setExecutionRoot( boolean executionRoot ) - { - this.executionRoot = executionRoot; - } - - public String getDefaultGoal() - { - return getBuild() != null ? getBuild().getDefaultGoal() : null; - } - - public Plugin getPlugin( String pluginKey ) - { - return getBuild().getPluginsAsMap().get( pluginKey ); - } - - /** - * Default toString - */ - @Override - public String toString() - { - StringBuilder sb = new StringBuilder( 128 ); - sb.append( "MavenProject: " ); - sb.append( getGroupId() ); - sb.append( ":" ); - sb.append( getArtifactId() ); - sb.append( ":" ); - sb.append( getVersion() ); - sb.append( " @ " ); - - try - { - sb.append( getFile().getPath() ); - } - catch ( NullPointerException e ) - { - // don't log it. - } - - return sb.toString(); - } - - /** - * @throws CloneNotSupportedException - * @since 2.0.9 - */ - @Override - public MavenProject clone() - { - MavenProject clone; - try - { - clone = (MavenProject) super.clone(); - } - catch ( CloneNotSupportedException e ) - { - throw new UnsupportedOperationException( e ); - } - - clone.deepCopy( this ); - - return clone; - } - - public void setModel( Model model ) - { - this.model = model; - } - - protected void setAttachedArtifacts( List<Artifact> attachedArtifacts ) - { - this.attachedArtifacts = attachedArtifacts; - } - - protected void setCompileSourceRoots( List<String> compileSourceRoots ) - { - this.compileSourceRoots = compileSourceRoots; - } - - protected void setTestCompileSourceRoots( List<String> testCompileSourceRoots ) - { - this.testCompileSourceRoots = testCompileSourceRoots; - } - - protected ArtifactRepository getReleaseArtifactRepository() - { - return releaseArtifactRepository; - } - - protected ArtifactRepository getSnapshotArtifactRepository() - { - return snapshotArtifactRepository; - } - - private void deepCopy( MavenProject project ) - { - // disown the parent - - // copy fields - setFile( project.getFile() ); - - // don't need a deep copy, they don't get modified or added/removed to/from - but make them unmodifiable to be - // sure! - if ( project.getDependencyArtifacts() != null ) - { - setDependencyArtifacts( Collections.unmodifiableSet( project.getDependencyArtifacts() ) ); - } - - if ( project.getArtifacts() != null ) - { - setArtifacts( Collections.unmodifiableSet( project.getArtifacts() ) ); - } - - if ( project.getParentFile() != null ) - { - parentFile = new File( project.getParentFile().getAbsolutePath() ); - } - - if ( project.getPluginArtifacts() != null ) - { - setPluginArtifacts( Collections.unmodifiableSet( project.getPluginArtifacts() ) ); - } - - if ( project.getReportArtifacts() != null ) - { - setReportArtifacts( Collections.unmodifiableSet( project.getReportArtifacts() ) ); - } - - if ( project.getExtensionArtifacts() != null ) - { - setExtensionArtifacts( Collections.unmodifiableSet( project.getExtensionArtifacts() ) ); - } - - setParentArtifact( ( project.getParentArtifact() ) ); - - if ( project.getRemoteArtifactRepositories() != null ) - { - setRemoteArtifactRepositories( Collections.unmodifiableList( project.getRemoteArtifactRepositories() ) ); - } - - if ( project.getPluginArtifactRepositories() != null ) - { - setPluginArtifactRepositories( Collections.unmodifiableList( project.getPluginArtifactRepositories() ) ); - } - - if ( project.getActiveProfiles() != null ) - { - setActiveProfiles( ( Collections.unmodifiableList( project.getActiveProfiles() ) ) ); - } - - if ( project.getAttachedArtifacts() != null ) - { - // clone properties modifyable by plugins in a forked lifecycle - setAttachedArtifacts( new ArrayList<Artifact>( project.getAttachedArtifacts() ) ); - } - - if ( project.getCompileSourceRoots() != null ) - { - // clone source roots - setCompileSourceRoots( ( new ArrayList<String>( project.getCompileSourceRoots() ) ) ); - } - - if ( project.getTestCompileSourceRoots() != null ) - { - setTestCompileSourceRoots( ( new ArrayList<String>( project.getTestCompileSourceRoots() ) ) ); - } - - if ( project.getScriptSourceRoots() != null ) - { - setScriptSourceRoots( ( new ArrayList<String>( project.getScriptSourceRoots() ) ) ); - } - - if ( project.getModel() != null ) - { - setModel( project.getModel().clone() ); - } - - if ( project.getOriginalModel() != null ) - { - setOriginalModel( project.getOriginalModel() ); - } - - setExecutionRoot( project.isExecutionRoot() ); - - if ( project.getArtifact() != null ) - { - setArtifact( ArtifactUtils.copyArtifact( project.getArtifact() ) ); - } - - if ( project.getManagedVersionMap() != null ) - { - setManagedVersionMap( new HashMap<String, Artifact>( project.getManagedVersionMap() ) ); - } - - lifecyclePhases.addAll( project.lifecyclePhases ); - } - - private void addArtifactPath( Artifact artifact, List<String> classpath ) - { - File file = artifact.getFile(); - if ( file != null ) - { - classpath.add( file.getPath() ); - } - } - - private static String getProjectReferenceId( String groupId, String artifactId, String version ) - { - StringBuilder buffer = new StringBuilder( 128 ); - buffer.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( version ); - return buffer.toString(); - } - - /** - * Sets the value of the context value of this project identified by the given key. If the supplied value is - * <code>null</code>, the context value is removed from this project. Context values are intended to allow core - * extensions to associate derived state with project instances. - */ - public void setContextValue( String key, Object value ) - { - if ( context == null ) - { - context = new HashMap<String, Object>(); - } - if ( value != null ) - { - context.put( key, value ); - } - else - { - context.remove( key ); - } - } - - /** - * Returns context value of this project associated with the given key or null if this project has no such value. - */ - public Object getContextValue( String key ) - { - if ( context == null ) - { - return null; - } - return context.get( key ); - } - - /** - * Sets the project's class realm. <strong>Warning:</strong> This is an internal utility method that is only public - * for technical reasons, it is not part of the public API. In particular, this method can be changed or deleted - * without prior notice and must not be used by plugins. - * - * @param classRealm The class realm hosting the build extensions of this project, may be {@code null}. - */ - public void setClassRealm( ClassRealm classRealm ) - { - this.classRealm = classRealm; - } - - /** - * Gets the project's class realm. This class realm hosts the build extensions of the project. - * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not - * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be - * used by plugins. - * - * @return The project's class realm or {@code null}. - */ - public ClassRealm getClassRealm() - { - return classRealm; - } - - /** - * Sets the artifact filter used to exclude shared extension artifacts from plugin realms. <strong>Warning:</strong> - * This is an internal utility method that is only public for technical reasons, it is not part of the public API. - * In particular, this method can be changed or deleted without prior notice and must not be used by plugins. - * - * @param extensionDependencyFilter The dependency filter to apply to plugins, may be {@code null}. - */ - public void setExtensionDependencyFilter( DependencyFilter extensionDependencyFilter ) - { - this.extensionDependencyFilter = extensionDependencyFilter; - } - - /** - * Gets the dependency filter used to exclude shared extension artifacts from plugin realms. - * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not - * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be - * used by plugins. - * - * @return The dependency filter or {@code null}. - */ - public DependencyFilter getExtensionDependencyFilter() - { - return extensionDependencyFilter; - } - - /** - * Sets the transitive dependency artifacts that have been resolved/collected for this project. - * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not - * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be - * used by plugins. - * - * @param artifacts The set of artifacts, may be {@code null}. - */ - public void setResolvedArtifacts( Set<Artifact> artifacts ) - { - this.resolvedArtifacts = ( artifacts != null ) ? artifacts : Collections.<Artifact>emptySet(); - this.artifacts = null; - this.artifactMap = null; - } - - /** - * Sets the scope filter to select the artifacts being exposed to the currently executed mojo. - * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not - * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be - * used by plugins. - * - * @param artifactFilter The artifact filter, may be {@code null} to exclude all artifacts. - */ - public void setArtifactFilter( ArtifactFilter artifactFilter ) - { - this.artifactFilter = artifactFilter; - this.artifacts = null; - this.artifactMap = null; - } - - /** - * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not - * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be - * used by plugins. - * - * @param phase The phase to check for, must not be {@code null}. - * @return {@code true} if the phase has been seen. - */ - public boolean hasLifecyclePhase( String phase ) - { - return lifecyclePhases.contains( phase ); - } - - /** - * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not - * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be - * used by plugins. - * - * @param lifecyclePhase The lifecycle phase to add, must not be {@code null}. - */ - public void addLifecyclePhase( String lifecyclePhase ) - { - lifecyclePhases.add( lifecyclePhase ); - } - - // ---------------------------------------------------------------------------------------------------------------- - // - // - // D E P R E C A T E D - // - // - // ---------------------------------------------------------------------------------------------------------------- - // - // Everything below will be removed for Maven 4.0.0 - // - // ---------------------------------------------------------------------------------------------------------------- - - private ProjectBuildingRequest projectBuilderConfiguration; - - private Map<String, String> moduleAdjustments; - - @Deprecated // This appears only to be used in test code - public String getModulePathAdjustment( MavenProject moduleProject ) - throws IOException - { - // FIXME: This is hacky. What if module directory doesn't match artifactid, and parent - // is coming from the repository?? - String module = moduleProject.getArtifactId(); - - File moduleFile = moduleProject.getFile(); - - if ( moduleFile != null ) - { - File moduleDir = moduleFile.getCanonicalFile().getParentFile(); - - module = moduleDir.getName(); - } - - if ( moduleAdjustments == null ) - { - moduleAdjustments = new HashMap<String, String>(); - - List<String> modules = getModules(); - if ( modules != null ) - { - for ( String modulePath : modules ) - { - String moduleName = modulePath; - - if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) ) - { - moduleName = moduleName.substring( 0, moduleName.length() - 1 ); - } - - int lastSlash = moduleName.lastIndexOf( '/' ); - - if ( lastSlash < 0 ) - { - lastSlash = moduleName.lastIndexOf( '\\' ); - } - - String adjustment = null; - - if ( lastSlash > -1 ) - { - moduleName = moduleName.substring( lastSlash + 1 ); - adjustment = modulePath.substring( 0, lastSlash ); - } - - moduleAdjustments.put( moduleName, adjustment ); - } - } - } - - return moduleAdjustments.get( module ); - } - - @Deprecated - public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String inheritedScope, - ArtifactFilter filter ) - throws InvalidDependencyVersionException - { - return MavenMetadataSource.createArtifacts( artifactFactory, getDependencies(), inheritedScope, filter, this ); - } - - @Deprecated - protected void setScriptSourceRoots( List<String> scriptSourceRoots ) - { - this.scriptSourceRoots = scriptSourceRoots; - } - - @Deprecated - public void addScriptSourceRoot( String path ) - { - if ( path != null ) - { - path = path.trim(); - if ( path.length() != 0 ) - { - if ( !getScriptSourceRoots().contains( path ) ) - { - getScriptSourceRoots().add( path ); - } - } - } - } - - @Deprecated - public List<String> getScriptSourceRoots() - { - return scriptSourceRoots; - } - - @Deprecated - public List<Artifact> getCompileArtifacts() - { - List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: classpath check doesn't belong here - that's the other method - if ( a.getArtifactHandler().isAddedToClasspath() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) - || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) - { - list.add( a ); - } - } - } - return list; - } - - @Deprecated - public List<Dependency> getCompileDependencies() - { - Set<Artifact> artifacts = getArtifacts(); - - if ( ( artifacts == null ) || artifacts.isEmpty() ) - { - return Collections.emptyList(); - } - - List<Dependency> list = new ArrayList<Dependency>( artifacts.size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) - || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) - { - Dependency dependency = new Dependency(); - - dependency.setArtifactId( a.getArtifactId() ); - dependency.setGroupId( a.getGroupId() ); - dependency.setVersion( a.getVersion() ); - dependency.setScope( a.getScope() ); - dependency.setType( a.getType() ); - dependency.setClassifier( a.getClassifier() ); - - list.add( dependency ); - } - } - return list; - } - - @Deprecated - public List<Artifact> getTestArtifacts() - { - List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: classpath check doesn't belong here - that's the other method - if ( a.getArtifactHandler().isAddedToClasspath() ) - { - list.add( a ); - } - } - return list; - } - - @Deprecated - public List<Dependency> getTestDependencies() - { - Set<Artifact> artifacts = getArtifacts(); - - if ( ( artifacts == null ) || artifacts.isEmpty() ) - { - return Collections.emptyList(); - } - - List<Dependency> list = new ArrayList<Dependency>( artifacts.size() ); - - for ( Artifact a : getArtifacts() ) - { - Dependency dependency = new Dependency(); - - dependency.setArtifactId( a.getArtifactId() ); - dependency.setGroupId( a.getGroupId() ); - dependency.setVersion( a.getVersion() ); - dependency.setScope( a.getScope() ); - dependency.setType( a.getType() ); - dependency.setClassifier( a.getClassifier() ); - - list.add( dependency ); - } - return list; - } - - @Deprecated // used by the Maven ITs - public List<Dependency> getRuntimeDependencies() - { - Set<Artifact> artifacts = getArtifacts(); - - if ( ( artifacts == null ) || artifacts.isEmpty() ) - { - return Collections.emptyList(); - } - - List<Dependency> list = new ArrayList<Dependency>( artifacts.size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) - { - Dependency dependency = new Dependency(); - - dependency.setArtifactId( a.getArtifactId() ); - dependency.setGroupId( a.getGroupId() ); - dependency.setVersion( a.getVersion() ); - dependency.setScope( a.getScope() ); - dependency.setType( a.getType() ); - dependency.setClassifier( a.getClassifier() ); - - list.add( dependency ); - } - } - return list; - } - - @Deprecated - public List<Artifact> getRuntimeArtifacts() - { - List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: classpath check doesn't belong here - that's the other method - if ( a.getArtifactHandler().isAddedToClasspath() - // TODO: let the scope handler deal with this - && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) ) - { - list.add( a ); - } - } - return list; - } - - @Deprecated - public List<String> getSystemClasspathElements() - throws DependencyResolutionRequiredException - { - List<String> list = new ArrayList<String>( getArtifacts().size() ); - - String d = getBuild().getOutputDirectory(); - if ( d != null ) - { - list.add( d ); - } - - for ( Artifact a : getArtifacts() ) - { - if ( a.getArtifactHandler().isAddedToClasspath() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) - { - addArtifactPath( a, list ); - } - } - } - return list; - } - - @Deprecated - public List<Artifact> getSystemArtifacts() - { - List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: classpath check doesn't belong here - that's the other method - if ( a.getArtifactHandler().isAddedToClasspath() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) - { - list.add( a ); - } - } - } - return list; - } - - @Deprecated - public List<Dependency> getSystemDependencies() - { - Set<Artifact> artifacts = getArtifacts(); - - if ( ( artifacts == null ) || artifacts.isEmpty() ) - { - return Collections.emptyList(); - } - - List<Dependency> list = new ArrayList<Dependency>( artifacts.size() ); - - for ( Artifact a : getArtifacts() ) - { - // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) - { - Dependency dependency = new Dependency(); - - dependency.setArtifactId( a.getArtifactId() ); - dependency.setGroupId( a.getGroupId() ); - dependency.setVersion( a.getVersion() ); - dependency.setScope( a.getScope() ); - dependency.setType( a.getType() ); - dependency.setClassifier( a.getClassifier() ); - - list.add( dependency ); - } - } - return list; - } - - @Deprecated - public void setReporting( Reporting reporting ) - { - getModel().setReporting( reporting ); - } - - @Deprecated - public Reporting getReporting() - { - return getModel().getReporting(); - } - - @Deprecated - public void setReportArtifacts( Set<Artifact> reportArtifacts ) - { - this.reportArtifacts = reportArtifacts; - - reportArtifactMap = null; - } - - @Deprecated - public Set<Artifact> getReportArtifacts() - { - return reportArtifacts; - } - - @Deprecated - public Map<String, Artifact> getReportArtifactMap() - { - if ( reportArtifactMap == null ) - { - reportArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getReportArtifacts() ); - } - - return reportArtifactMap; - } - - @Deprecated - public void setExtensionArtifacts( Set<Artifact> extensionArtifacts ) - { - this.extensionArtifacts = extensionArtifacts; - - extensionArtifactMap = null; - } - - @Deprecated - public Set<Artifact> getExtensionArtifacts() - { - return extensionArtifacts; - } - - @Deprecated - public Map<String, Artifact> getExtensionArtifactMap() - { - if ( extensionArtifactMap == null ) - { - extensionArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getExtensionArtifacts() ); - } - - return extensionArtifactMap; - } - - @Deprecated - public List<ReportPlugin> getReportPlugins() - { - if ( getModel().getReporting() == null ) - { - return Collections.emptyList(); - } - return getModel().getReporting().getPlugins(); - - } - - @Deprecated - public Xpp3Dom getReportConfiguration( String pluginGroupId, String pluginArtifactId, String reportSetId ) - { - Xpp3Dom dom = null; - - // ---------------------------------------------------------------------- - // I would like to be able to lookup the Mojo object using a key but - // we have a limitation in modello that will be remedied shortly. So - // for now I have to iterate through and see what we have. - // ---------------------------------------------------------------------- - - if ( getReportPlugins() != null ) - { - for ( ReportPlugin plugin : getReportPlugins() ) - { - if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) ) - { - dom = (Xpp3Dom) plugin.getConfiguration(); - - if ( reportSetId != null ) - { - ReportSet reportSet = plugin.getReportSetsAsMap().get( reportSetId ); - if ( reportSet != null ) - { - Xpp3Dom executionConfiguration = (Xpp3Dom) reportSet.getConfiguration(); - if ( executionConfiguration != null ) - { - Xpp3Dom newDom = new Xpp3Dom( executionConfiguration ); - dom = Xpp3Dom.mergeXpp3Dom( newDom, dom ); - } - } - } - break; - } - } - } - - if ( dom != null ) - { - // make a copy so the original in the POM doesn't get messed with - dom = new Xpp3Dom( dom ); - } - - return dom; - } - - /** - * @deprecated Use MavenProjectHelper.attachArtifact(..) instead. - */ - @Deprecated - public void attachArtifact( String type, String classifier, File file ) - { - } - - /** - * @deprecated Use {@link org.apache.maven.model.io.ModelWriter}. - */ - @Deprecated - public void writeModel( Writer writer ) - throws IOException - { - MavenXpp3Writer pomWriter = new MavenXpp3Writer(); - pomWriter.write( writer, getModel() ); - } - - /** - * @deprecated Use {@link org.apache.maven.model.io.ModelWriter}. - */ - @Deprecated - public void writeOriginalModel( Writer writer ) - throws IOException - { - MavenXpp3Writer pomWriter = new MavenXpp3Writer(); - pomWriter.write( writer, getOriginalModel() ); - } - - @Deprecated - public Artifact replaceWithActiveArtifact( Artifact pluginArtifact ) - { - return pluginArtifact; - } - - /** - * Gets the project building request from which this project instance was created. <strong>Warning:</strong> This is - * an utility method that is meant to assist integrators of Maven, it must not be used by Maven plugins. - * - * @return The project building request or {@code null}. - * @since 2.1 - */ - @Deprecated - public ProjectBuildingRequest getProjectBuildingRequest() - { - return projectBuilderConfiguration; - } - - /** - * Sets the project building request from which this project instance was created. <strong>Warning:</strong> This is - * an utility method that is meant to assist integrators of Maven, it must not be used by Maven plugins. - * - * @param projectBuildingRequest The project building request, may be {@code null}. - * @since 2.1 - */ - // used by maven-dependency-tree - @Deprecated - public void setProjectBuildingRequest( ProjectBuildingRequest projectBuildingRequest ) - { - this.projectBuilderConfiguration = projectBuildingRequest; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java deleted file mode 100644 index 0b54c004..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.List; - -/** - * Convenience interface for plugins to add or replace artifacts and resources on projects. - */ -public interface MavenProjectHelper -{ - String ROLE = MavenProjectHelper.class.getName(); - - /** - * See {@link #attachArtifact(MavenProject, String, String, java.io.File)}, but with type set to null. - * @param project project reference. - * @param artifactFile artifact file. - * @param artifactClassifier artifact classifier. - */ - void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier ); - - /** - * * See {@link #attachArtifact(MavenProject, String, String, java.io.File)}, but with classifier set to null. - * @param project project reference. - * @param artifactType artifact type. - * @param artifactFile arrifact file. - */ - void attachArtifact( MavenProject project, String artifactType, File artifactFile ); - - /** - * Add or replace an artifact to the current project. - * @param project the project reference. - * @param artifactType the type (e.g. jar) or null. - * @param artifactClassifier the classifier or null. - * @param artifactFile the file for the artifact. - */ - void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile ); - - /** - * Add a resource directory to the project. - * @param project project reference. - * @param resourceDirectory directory. - * @param includes include patterns. - * @param excludes exclude patterns. - */ - void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes ); - - /** - * Add a test resource directory to the project. - * @param project project reference. - * @param resourceDirectory directory. - * @param includes include patterns. - * @param excludes exclude patterns. - */ - void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, - List<String> excludes ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java deleted file mode 100644 index 4ac83972..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.building.ModelSource; - -/** - * Builds in-memory descriptions of projects. - */ -public interface ProjectBuilder -{ - - /** - * Builds a project descriptor from the specified POM file. - * - * @param projectFile The POM file to build the project from, must not be {@code null}. - * @param request The project building request that holds further parameters, must not be {@code null}. - * @return The result of the project building, never {@code null}. - * @throws ProjectBuildingException If the project descriptor could not be successfully built. - */ - ProjectBuildingResult build( File projectFile, ProjectBuildingRequest request ) - throws ProjectBuildingException; - - /** - * Builds a project descriptor for the specified artifact. - * - * @param projectArtifact The POM artifact to build the project from, must not be {@code null}. - * @param request The project building request that holds further parameters, must not be {@code null}. - * @return The result of the project building, never {@code null}. - * @throws ProjectBuildingException If the project descriptor could not be successfully built. - */ - ProjectBuildingResult build( Artifact projectArtifact, ProjectBuildingRequest request ) - throws ProjectBuildingException; - - /** - * Builds a project descriptor for the specified artifact. - * - * @param projectArtifact The POM artifact to build the project from, must not be {@code null}. - * @param allowStubModel A flag controlling the case of a missing POM artifact. If {@code true} and the specified - * POM artifact does not exist, a simple stub model will be returned. If {@code false}, an exception will - * be thrown. - * @param request The project building request that holds further parameters, must not be {@code null}. - * @return The result of the project building, never {@code null}. - * @throws ProjectBuildingException If the project descriptor could not be successfully built. - */ - ProjectBuildingResult build( Artifact projectArtifact, boolean allowStubModel, ProjectBuildingRequest request ) - throws ProjectBuildingException; - - /** - * Builds a project descriptor for the specified model source. - * - * @param modelSource The source of the model to built the project descriptor from, must not be {@code null}. - * @param request The project building request that holds further parameters, must not be {@code null}. - * @return The result of the project building, never {@code null}. - * @throws ProjectBuildingException If the project descriptor could not be successfully built. - * - * @see org.apache.maven.model.building.ModelSource2 - */ - ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request ) - throws ProjectBuildingException; - - /** - * Builds the projects for the specified POM files and optionally their children. - * - * @param pomFiles The POM files to build, must not be {@code null}. - * @param recursive {@code true} to recursively build sub modules referenced by the POM files, {@code false} to - * build only the specified POM files. - * @param request The project builder configuration that provides further parameters, must not be {@code null}. - * @return The results of the project builder where each result corresponds to one project that was built, never - * {@code null}. - * @throws ProjectBuildingException If an error was encountered during building of any project. - * {@link ProjectBuildingException#getResults()} provides access to the details of the problems. - */ - List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request ) - throws ProjectBuildingException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java deleted file mode 100644 index 47c12315..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.List; - -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.building.ModelProblemUtils; - -/** - * @author Jason van Zyl - */ -public class ProjectBuildingException - extends Exception -{ - private final String projectId; - - private File pomFile; - - private List<ProjectBuildingResult> results; - - public ProjectBuildingException( String projectId, String message, Throwable cause ) - { - super( createMessage( message, projectId, null ), cause ); - this.projectId = projectId; - } - - /** - * @param projectId - * @param message - * @param pomFile pom file location - */ - public ProjectBuildingException( String projectId, String message, File pomFile ) - { - super( createMessage( message, projectId, pomFile ) ); - this.projectId = projectId; - this.pomFile = pomFile; - } - - /** - * @param projectId - * @param message - * @param pomFile pom file location - * @param cause - */ - protected ProjectBuildingException( String projectId, String message, File pomFile, Throwable cause ) - { - super( createMessage( message, projectId, pomFile ), cause ); - this.projectId = projectId; - this.pomFile = pomFile; - } - - public ProjectBuildingException( List<ProjectBuildingResult> results ) - { - super( createMessage( results ) ); - this.projectId = ""; - this.results = results; - } - - public File getPomFile() - { - return pomFile; - } - - /** - * @deprecated use {@link #getPomFile()} - */ - public String getPomLocation() - { - if ( getPomFile() != null ) - { - return getPomFile().getAbsolutePath(); - } - else - { - return "null"; - } - } - - public String getProjectId() - { - return projectId; - } - - public List<ProjectBuildingResult> getResults() - { - return results; - } - - private static String createMessage( String message, String projectId, File pomFile ) - { - StringBuilder buffer = new StringBuilder( 256 ); - buffer.append( message ); - buffer.append( " for project " ).append( projectId ); - if ( pomFile != null ) - { - buffer.append( " at " ).append( pomFile.getAbsolutePath() ); - } - return buffer.toString(); - } - - private static String createMessage( List<ProjectBuildingResult> results ) - { - StringWriter buffer = new StringWriter( 1024 ); - - PrintWriter writer = new PrintWriter( buffer ); - writer.println( "Some problems were encountered while processing the POMs:" ); - for ( ProjectBuildingResult result : results ) - { - for ( ModelProblem problem : result.getProblems() ) - { - writer.print( "[" ); - writer.print( problem.getSeverity() ); - writer.print( "] " ); - writer.print( problem.getMessage() ); - writer.print( " @ " ); - writer.println( ModelProblemUtils.formatLocation( problem, result.getProjectId() ) ); - } - } - writer.close(); - - return buffer.toString(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java deleted file mode 100644 index 45fff6e6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; - -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.model.Model; -import org.apache.maven.model.Repository; -import org.apache.maven.plugin.PluginManagerException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; - -/** - * Assists the project builder. <strong>Warning:</strong> This is an internal utility interface that is only public for - * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without - * prior notice. - * - * @author Benjamin Bentmann - */ -public interface ProjectBuildingHelper -{ - - /** - * Creates the effective artifact repositories from the specified POM repositories. - * - * @param pomRepositories The POM repositories to create the artifact repositories from, must not be {@code null}. - * @param externalRepositories The external (and already mirrored) repositories to merge into the result list, may - * be {@code null}. - * @param request The project building request holding further settings like repository settings, must not be - * {@code null}. - * @return The effective artifact repositories, never {@code null}. - * @throws InvalidRepositoryException - */ - List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories, - List<ArtifactRepository> externalRepositories, - ProjectBuildingRequest request ) - throws InvalidRepositoryException; - - /** - * Creates the project realm that hosts the build extensions of the specified model. - * - * @param project The project to create the project realm for, must not be {@code null} - * @param model The model to create the project realm for, must not be {@code null} - * @param request The project building request holding further settings like repository settings, must not be - * {@code null}. - * @return The record with the project realm and extension artifact filter, never {@code null}. - * @throws PluginResolutionException If any build extension could not be resolved. - */ - ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model, - ProjectBuildingRequest request ) - throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException; - - /** - * Updates the context class loader such that the container will search the project realm when the model builder - * injects the lifecycle bindings from the packaging in the next step. The context class loader is to be reset by - * the project builder when the project is fully assembled. - * - * @param project The project whose class realm should be selected, must not be {@code null}. - */ - void selectProjectRealm( MavenProject project ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java deleted file mode 100644 index 0380278b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Date; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.model.Profile; -import org.eclipse.aether.RepositorySystemSession; - -public interface ProjectBuildingRequest -{ - - ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository ); - - ArtifactRepository getLocalRepository(); - - ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories ); - - List<ArtifactRepository> getRemoteRepositories(); - - ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories ); - - List<ArtifactRepository> getPluginArtifactRepositories(); - - /** - * Sets the system properties to use for interpolation and profile activation. The system properties are collected - * from the runtime environment like {@link System#getProperties()} and environment variables. - * - * @param systemProperties The system properties, may be {@code null}. - * @return This request, never {@code null}. - */ - ProjectBuildingRequest setSystemProperties( Properties systemProperties ); - - /** - * Gets the system properties to use for interpolation and profile activation. The system properties are collected - * from the runtime environment like {@link System#getProperties()} and environment variables. - * - * @return The system properties, never {@code null}. - */ - Properties getSystemProperties(); - - /** - * Sets the user properties to use for interpolation and profile activation. The user properties have been - * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command - * line. - * - * @param userProperties The user properties, may be {@code null}. - * @return This request, never {@code null}. - */ - ProjectBuildingRequest setUserProperties( Properties userProperties ); - - /** - * Gets the user properties to use for interpolation and profile activation. The user properties have been - * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command - * line. - * - * @return The user properties, never {@code null}. - */ - Properties getUserProperties(); - - void setProject( MavenProject mavenProject ); - - MavenProject getProject(); - - ProjectBuildingRequest setProcessPlugins( boolean processPlugins ); - - boolean isProcessPlugins(); - - ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies ); - - boolean isResolveDependencies(); - - /** - * Controls the level of validation to perform on processed models. By default, models are validated in strict mode. - * - * @param validationLevel The level of validation to perform on processed models, e.g. - * {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}. - * @return This configuration, never {@code null}. - */ - ProjectBuildingRequest setValidationLevel( int validationLevel ); - - /** - * Gets the level of validation to perform on processed models. - * - * @return The level of validation to perform on processed models. - */ - int getValidationLevel(); - - // Profiles - - /** - * Set any active profiles that the {@link ProjectBuilder} should consider while constructing - * a {@link MavenProject}. - */ - void setActiveProfileIds( List<String> activeProfileIds ); - - List<String> getActiveProfileIds(); - - void setInactiveProfileIds( List<String> inactiveProfileIds ); - - List<String> getInactiveProfileIds(); - - /** - * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom - * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. - * - * @param profile - */ - void addProfile( Profile profile ); - - void setProfiles( List<Profile> profiles ); - - List<Profile> getProfiles(); - - /** - * Gets the start time of the build. - * - * @return The start time of the build or {@code null} if unknown. - */ - Date getBuildStartTime(); - - /** - * Sets the start time of the build. - * - * @param buildStartTime The start time of the build, may be {@code null}. - */ - void setBuildStartTime( Date buildStartTime ); - - RepositorySystemSession getRepositorySession(); - - ProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession ); - - /** - * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this - * request. - * - * @param mode The repository merge mode, must not be {@code null}. - * @return This request for chaining, never {@code null}. - * @see #setRemoteRepositories(List) - */ - ProjectBuildingRequest setRepositoryMerging( RepositoryMerging mode ); - - /** - * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this - * request - * - * @return The merge mode, never {@code null}. - */ - RepositoryMerging getRepositoryMerging(); - - /** @since 3.2.2 */ - boolean isResolveVersionRanges(); - - /** @since 3.2.2 */ - ProjectBuildingRequest setResolveVersionRanges( boolean value ); - - /** - * The possible merge modes for combining remote repositories. - */ - enum RepositoryMerging - { - - /** - * The repositories declared in the POM have precedence over the repositories specified in the request. - */ - POM_DOMINANT, - - /** - * The repositories specified in the request have precedence over the repositories declared in the POM. - */ - REQUEST_DOMINANT, - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java deleted file mode 100644 index 9a43154c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.List; - -import org.apache.maven.model.building.ModelProblem; - -/** - * Collects the output of the project builder. - * - * @author Benjamin Bentmann - */ -public interface ProjectBuildingResult -{ - - /** - * Gets the identifier of the project that could not be built. The general format of the identifier is {@code - * <groupId>:<artifactId>:<version>} but some of these coordinates may still be unknown at the point the exception - * is thrown so this information is merely meant to assist the user. - * - * @return The identifier of the project or an empty string if not known, never {@code null}. - */ - String getProjectId(); - - /** - * Gets the POM file from which the project was built. - * - * @return The POM file or {@code null} if unknown. - */ - File getPomFile(); - - /** - * Gets the project that was built. - * - * @return The project that was built or {@code null} if an error occurred and this result accompanies a - * {@link ProjectBuildingException}. - */ - MavenProject getProject(); - - /** - * Gets the problems that were encountered during the project building. - * - * @return The problems that were encountered during the project building, can be empty but never {@code null}. - */ - List<ModelProblem> getProblems(); - - /** - * Gets the result of the dependency resolution for the project. - * - * @return The result of the dependency resolution for the project or {@code null} if the project dependencies were - * not requested. - */ - DependencyResolutionResult getDependencyResolutionResult(); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java deleted file mode 100644 index 539055ca..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Resolves the transitive dependencies of a project. - * - * @author Benjamin Bentmann - */ -public interface ProjectDependenciesResolver -{ - - /** - * Resolves the transitive dependencies of a project. - * - * @param request The resolution request holding the parameters, must not be {@code null}. - * @return The resolution result, never {@code null}. - * @throws DependencyResolutionException If any project dependency could not be resolved. - */ - DependencyResolutionResult resolve( DependencyResolutionRequest request ) - throws DependencyResolutionException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java deleted file mode 100644 index 3e33eb57..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -import org.apache.maven.model.Parent; -import org.apache.maven.model.Repository; -import org.apache.maven.model.building.FileModelSource; -import org.apache.maven.model.building.ModelSource; -import org.apache.maven.model.resolution.InvalidRepositoryException; -import org.apache.maven.model.resolution.ModelResolver; -import org.apache.maven.model.resolution.UnresolvableModelException; -import org.apache.maven.repository.internal.ArtifactDescriptorUtils; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.impl.RemoteRepositoryManager; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; -import org.eclipse.aether.resolution.VersionRangeRequest; -import org.eclipse.aether.resolution.VersionRangeResolutionException; -import org.eclipse.aether.resolution.VersionRangeResult; - -/** - * A model resolver to assist building of projects. This resolver gives priority to those repositories that have been - * declared in the POM. - * - * @author Benjamin Bentmann - */ -public class ProjectModelResolver - implements ModelResolver -{ - - private final RepositorySystemSession session; - - private final RequestTrace trace; - - private final String context = "project"; - - private List<RemoteRepository> repositories; - - private List<RemoteRepository> pomRepositories; - - private final List<RemoteRepository> externalRepositories; - - private final RepositorySystem resolver; - - private final RemoteRepositoryManager remoteRepositoryManager; - - private final Set<String> repositoryIds; - - private final ReactorModelPool modelPool; - - private final ProjectBuildingRequest.RepositoryMerging repositoryMerging; - - public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace, RepositorySystem resolver, - RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories, - ProjectBuildingRequest.RepositoryMerging repositoryMerging, - ReactorModelPool modelPool ) - { - this.session = session; - this.trace = trace; - this.resolver = resolver; - this.remoteRepositoryManager = remoteRepositoryManager; - this.pomRepositories = new ArrayList<RemoteRepository>(); - List<RemoteRepository> externalRepositories = new ArrayList<RemoteRepository>(); - externalRepositories.addAll( repositories ); - this.externalRepositories = Collections.unmodifiableList( externalRepositories ); - this.repositories = new ArrayList<RemoteRepository>(); - this.repositories.addAll( externalRepositories ); - this.repositoryMerging = repositoryMerging; - this.repositoryIds = new HashSet<String>(); - this.modelPool = modelPool; - } - - private ProjectModelResolver( ProjectModelResolver original ) - { - this.session = original.session; - this.trace = original.trace; - this.resolver = original.resolver; - this.remoteRepositoryManager = original.remoteRepositoryManager; - this.pomRepositories = new ArrayList<RemoteRepository>( original.pomRepositories ); - this.externalRepositories = original.externalRepositories; - this.repositories = new ArrayList<RemoteRepository>( original.repositories ); - this.repositoryMerging = original.repositoryMerging; - this.repositoryIds = new HashSet<String>( original.repositoryIds ); - this.modelPool = original.modelPool; - } - - public void addRepository( Repository repository ) - throws InvalidRepositoryException - { - addRepository( repository, false ); - } - - @Override - public void addRepository( final Repository repository, boolean replace ) - throws InvalidRepositoryException - { - if ( !repositoryIds.add( repository.getId() ) ) - { - if ( !replace ) - { - return; - } - - // Remove any previous repository with this Id - removeMatchingRepository( repositories, repository.getId() ); - removeMatchingRepository( pomRepositories, repository.getId() ); - } - - List<RemoteRepository> newRepositories = - Collections.singletonList( ArtifactDescriptorUtils.toRemoteRepository( repository ) ); - - if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( repositoryMerging ) ) - { - repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, - true ); - } - else - { - pomRepositories = - remoteRepositoryManager.aggregateRepositories( session, pomRepositories, newRepositories, true ); - repositories = - remoteRepositoryManager.aggregateRepositories( session, pomRepositories, externalRepositories, false ); - } - } - - private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id ) - { - Iterables.removeIf( repositories, new Predicate<RemoteRepository>() - { - @Override - public boolean apply( RemoteRepository remoteRepository ) - { - return remoteRepository.getId().equals( id ); - } - } ); - } - - public ModelResolver newCopy() - { - return new ProjectModelResolver( this ); - } - - public ModelSource resolveModel( String groupId, String artifactId, String version ) - throws UnresolvableModelException - { - File pomFile = null; - - if ( modelPool != null ) - { - pomFile = modelPool.get( groupId, artifactId, version ); - } - - if ( pomFile == null ) - { - Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); - - try - { - ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); - request.setTrace( trace ); - pomArtifact = resolver.resolveArtifact( session, request ).getArtifact(); - } - catch ( ArtifactResolutionException e ) - { - throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e ); - } - - pomFile = pomArtifact.getFile(); - } - - return new FileModelSource( pomFile ); - } - - public ModelSource resolveModel( Parent parent ) - throws UnresolvableModelException - { - Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom", - parent.getVersion() ); - - VersionRangeRequest versionRangeRequest = new VersionRangeRequest( artifact, repositories, context ); - versionRangeRequest.setTrace( trace ); - - try - { - VersionRangeResult versionRangeResult = resolver.resolveVersionRange( session, versionRangeRequest ); - - if ( versionRangeResult.getHighestVersion() == null ) - { - throw new UnresolvableModelException( "No versions matched the requested range '" + parent.getVersion() - + "'", parent.getGroupId(), parent.getArtifactId(), - parent.getVersion() ); - - } - - if ( versionRangeResult.getVersionConstraint() != null - && versionRangeResult.getVersionConstraint().getRange() != null - && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null ) - { - throw new UnresolvableModelException( "The requested version range '" + parent.getVersion() - + "' does not specify an upper bound", parent.getGroupId(), - parent.getArtifactId(), parent.getVersion() ); - - } - - parent.setVersion( versionRangeResult.getHighestVersion().toString() ); - } - catch ( VersionRangeResolutionException e ) - { - throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(), - parent.getVersion(), e ); - - } - - return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java deleted file mode 100644 index 9265b894..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; - -import org.codehaus.plexus.classworlds.realm.ClassRealm; -import org.eclipse.aether.graph.DependencyFilter; - -/** - * Caches project class realms. <strong>Warning:</strong> This is an internal utility interface that is only public for - * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without - * prior notice. - * - * @author Igor Fedorenko - * @author Benjamin Bentmann - */ -public interface ProjectRealmCache -{ - - /** - * A cache key. - */ - interface Key - { - // marker interface for cache keys - } - - static class CacheRecord - { - - public final ClassRealm realm; - - public final DependencyFilter extensionArtifactFilter; - - public CacheRecord( ClassRealm realm, DependencyFilter extensionArtifactFilter ) - { - this.realm = realm; - this.extensionArtifactFilter = extensionArtifactFilter; - } - - } - - Key createKey( List<? extends ClassRealm> extensionRealms ); - - CacheRecord get( Key key ); - - CacheRecord put( Key key, ClassRealm projectRealm, DependencyFilter extensionArtifactFilter ); - - void flush(); - - /** - * Registers the specified cache record for usage with the given project. Integrators can use the information - * collected from this method in combination with a custom cache implementation to dispose unused records from the - * cache. - * - * @param project The project that employs the plugin realm, must not be {@code null}. - * @param record The cache record being used for the project, must not be {@code null}. - */ - void register( MavenProject project, Key key, CacheRecord record ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java deleted file mode 100644 index 16985e2a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Extension; -import org.apache.maven.model.Parent; -import org.apache.maven.model.Plugin; -import org.codehaus.plexus.util.StringUtils; -import org.codehaus.plexus.util.dag.CycleDetectedException; -import org.codehaus.plexus.util.dag.DAG; -import org.codehaus.plexus.util.dag.TopologicalSorter; -import org.codehaus.plexus.util.dag.Vertex; - -public class ProjectSorter -{ - private DAG dag; - - private List<MavenProject> sortedProjects; - - private Map<String, MavenProject> projectMap; - - private MavenProject topLevelProject; - - /** - * Sort a list of projects. - * <ul> - * <li>collect all the vertices for the projects that we want to build.</li> - * <li>iterate through the deps of each project and if that dep is within - * the set of projects we want to build then add an edge, otherwise throw - * the edge away because that dependency is not within the set of projects - * we are trying to build. we assume a closed set.</li> - * <li>do a topo sort on the graph that remains.</li> - * </ul> - * @throws DuplicateProjectException if any projects are duplicated by id - */ - // MAVENAPI FIXME: the DAG used is NOT only used to represent the dependency relation, - // but also for <parent>, <build><plugin>, <reports>. We need multiple DAG's - // since a DAG can only handle 1 type of relationship properly. - // Usecase: This is detected as a cycle: - // org.apache.maven:maven-plugin-api -(PARENT)-> - // org.apache.maven:maven -(inherited REPORTING)-> - // org.apache.maven.plugins:maven-checkstyle-plugin -(DEPENDENCY)-> - // org.apache.maven:maven-plugin-api - // In this case, both the verify and the report goals are called - // in a different lifecycle. Though the compiler-plugin has a valid usecase, although - // that seems to work fine. We need to take versions and lifecycle into account. - public ProjectSorter( Collection<MavenProject> projects ) - throws CycleDetectedException, DuplicateProjectException - { - dag = new DAG(); - - // groupId:artifactId:version -> project - projectMap = new HashMap<String, MavenProject>( projects.size() * 2 ); - - // groupId:artifactId -> (version -> vertex) - Map<String, Map<String, Vertex>> vertexMap = new HashMap<String, Map<String, Vertex>>( projects.size() * 2 ); - - for ( MavenProject project : projects ) - { - String projectId = getId( project ); - - MavenProject conflictingProject = projectMap.put( projectId, project ); - - if ( conflictingProject != null ) - { - throw new DuplicateProjectException( projectId, conflictingProject.getFile(), project.getFile(), - "Project '" + projectId + "' is duplicated in the reactor" ); - } - - String projectKey = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); - - Map<String, Vertex> vertices = vertexMap.get( projectKey ); - if ( vertices == null ) - { - vertices = new HashMap<String, Vertex>( 2, 1 ); - vertexMap.put( projectKey, vertices ); - } - vertices.put( project.getVersion(), dag.addVertex( projectId ) ); - } - - for ( Vertex projectVertex : dag.getVerticies() ) - { - String projectId = projectVertex.getLabel(); - - MavenProject project = projectMap.get( projectId ); - - for ( Dependency dependency : project.getDependencies() ) - { - addEdge( projectMap, vertexMap, project, projectVertex, dependency.getGroupId(), - dependency.getArtifactId(), dependency.getVersion(), false, false ); - } - - Parent parent = project.getModel().getParent(); - - if ( parent != null ) - { - // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has - // in conflict - addEdge( projectMap, vertexMap, null, projectVertex, parent.getGroupId(), parent.getArtifactId(), - parent.getVersion(), true, false ); - } - - List<Plugin> buildPlugins = project.getBuildPlugins(); - if ( buildPlugins != null ) - { - for ( Plugin plugin : buildPlugins ) - { - addEdge( projectMap, vertexMap, project, projectVertex, plugin.getGroupId(), - plugin.getArtifactId(), plugin.getVersion(), false, true ); - - for ( Dependency dependency : plugin.getDependencies() ) - { - addEdge( projectMap, vertexMap, project, projectVertex, dependency.getGroupId(), - dependency.getArtifactId(), dependency.getVersion(), false, true ); - } - } - } - - List<Extension> buildExtensions = project.getBuildExtensions(); - if ( buildExtensions != null ) - { - for ( Extension extension : buildExtensions ) - { - addEdge( projectMap, vertexMap, project, projectVertex, extension.getGroupId(), - extension.getArtifactId(), extension.getVersion(), false, true ); - } - } - } - - List<MavenProject> sortedProjects = new ArrayList<MavenProject>( projects.size() ); - - List<String> sortedProjectLabels = TopologicalSorter.sort( dag ); - - for ( String id : sortedProjectLabels ) - { - sortedProjects.add( projectMap.get( id ) ); - } - - this.sortedProjects = Collections.unmodifiableList( sortedProjects ); - } - - private void addEdge( Map<String, MavenProject> projectMap, Map<String, Map<String, Vertex>> vertexMap, - MavenProject project, Vertex projectVertex, String groupId, String artifactId, - String version, boolean force, boolean safe ) - throws CycleDetectedException - { - String projectKey = ArtifactUtils.versionlessKey( groupId, artifactId ); - - Map<String, Vertex> vertices = vertexMap.get( projectKey ); - - if ( vertices != null ) - { - if ( isSpecificVersion( version ) ) - { - Vertex vertex = vertices.get( version ); - if ( vertex != null ) - { - addEdge( projectVertex, vertex, project, projectMap, force, safe ); - } - } - else - { - for ( Vertex vertex : vertices.values() ) - { - addEdge( projectVertex, vertex, project, projectMap, force, safe ); - } - } - } - } - - private void addEdge( Vertex fromVertex, Vertex toVertex, MavenProject fromProject, - Map<String, MavenProject> projectMap, boolean force, boolean safe ) - throws CycleDetectedException - { - if ( fromVertex.equals( toVertex ) ) - { - return; - } - - if ( fromProject != null ) - { - MavenProject toProject = projectMap.get( toVertex.getLabel() ); - fromProject.addProjectReference( toProject ); - } - - if ( force && toVertex.getChildren().contains( fromVertex ) ) - { - dag.removeEdge( toVertex, fromVertex ); - } - - try - { - dag.addEdge( fromVertex, toVertex ); - } - catch ( CycleDetectedException e ) - { - if ( !safe ) - { - throw e; - } - } - } - - private boolean isSpecificVersion( String version ) - { - return !( StringUtils.isEmpty( version ) || version.startsWith( "[" ) || version.startsWith( "(" ) ); - } - - // TODO: !![jc; 28-jul-2005] check this; if we're using '-r' and there are aggregator tasks, this will result in weirdness. - public MavenProject getTopLevelProject() - { - if ( topLevelProject == null ) - { - for ( Iterator<MavenProject> i = sortedProjects.iterator(); i.hasNext() && ( topLevelProject == null ); ) - { - MavenProject project = i.next(); - if ( project.isExecutionRoot() ) - { - topLevelProject = project; - } - } - } - - return topLevelProject; - } - - public List<MavenProject> getSortedProjects() - { - return sortedProjects; - } - - public boolean hasMultipleProjects() - { - return sortedProjects.size() > 1; - } - - public List<String> getDependents( String id ) - { - return dag.getParentLabels( id ); - } - - public List<String> getDependencies( String id ) - { - return dag.getChildLabels( id ); - } - - public static String getId( MavenProject project ) - { - return ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ); - } - - public DAG getDAG() - { - return dag; - } - - public Map<String, MavenProject> getProjectMap() - { - return projectMap; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java deleted file mode 100644 index 24425da1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.HashMap; -import java.util.Map; - -import org.apache.maven.model.building.ModelCache; - -/** - * A simple model cache used to accelerate model building during a reactor build. - * - * @author Benjamin Bentmann - */ -class ReactorModelCache - implements ModelCache -{ - - private final Map<CacheKey, Object> models = new HashMap<CacheKey, Object>( 256 ); - - public Object get( String groupId, String artifactId, String version, String tag ) - { - return models.get( new CacheKey( groupId, artifactId, version, tag ) ); - } - - public void put( String groupId, String artifactId, String version, String tag, Object data ) - { - models.put( new CacheKey( groupId, artifactId, version, tag ), data ); - } - - private static final class CacheKey - { - - private final String groupId; - - private final String artifactId; - - private final String version; - - private final String tag; - - private final int hashCode; - - public CacheKey( String groupId, String artifactId, String version, String tag ) - { - this.groupId = ( groupId != null ) ? groupId : ""; - this.artifactId = ( artifactId != null ) ? artifactId : ""; - this.version = ( version != null ) ? version : ""; - this.tag = ( tag != null ) ? tag : ""; - - int hash = 17; - hash = hash * 31 + this.groupId.hashCode(); - hash = hash * 31 + this.artifactId.hashCode(); - hash = hash * 31 + this.version.hashCode(); - hash = hash * 31 + this.tag.hashCode(); - hashCode = hash; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - - if ( !( obj instanceof CacheKey ) ) - { - return false; - } - - CacheKey that = (CacheKey) obj; - - return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId ) - && version.equals( that.version ) && tag.equals( that.tag ); - } - - @Override - public int hashCode() - { - return hashCode; - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java deleted file mode 100644 index 294fccdb..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.HashMap; -import java.util.Map; - -/** - * Holds all POM files that are known to the reactor. This allows the project builder to resolve imported POMs from the - * reactor when building another project's effective model. - * - * @author Benjamin Bentmann - */ -class ReactorModelPool -{ - - private final Map<CacheKey, File> pomFiles = new HashMap<CacheKey, File>(); - - public File get( String groupId, String artifactId, String version ) - { - return pomFiles.get( new CacheKey( groupId, artifactId, version ) ); - } - - public void put( String groupId, String artifactId, String version, File pomFile ) - { - pomFiles.put( new CacheKey( groupId, artifactId, version ), pomFile ); - } - - private static final class CacheKey - { - - private final String groupId; - - private final String artifactId; - - private final String version; - - private final int hashCode; - - public CacheKey( String groupId, String artifactId, String version ) - { - this.groupId = ( groupId != null ) ? groupId : ""; - this.artifactId = ( artifactId != null ) ? artifactId : ""; - this.version = ( version != null ) ? version : ""; - - int hash = 17; - hash = hash * 31 + this.groupId.hashCode(); - hash = hash * 31 + this.artifactId.hashCode(); - hash = hash * 31 + this.version.hashCode(); - hashCode = hash; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - - if ( !( obj instanceof CacheKey ) ) - { - return false; - } - - CacheKey that = (CacheKey) obj; - - return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId ) - && version.equals( that.version ); - } - - @Override - public int hashCode() - { - return hashCode; - } - - @Override - public String toString() - { - StringBuilder buffer = new StringBuilder( 96 ); - buffer.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( version ); - return buffer.toString(); - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java deleted file mode 100644 index 679ee008..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.apache.maven.project; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.eclipse.aether.RepositorySystemSession; - -/** - * Component interface that allows per-project customization of Aether repository system sessions. - * - * @since 3.2.4 - * @provisional This interface is part of work in progress and can be changed or removed without notice. - */ -public interface RepositorySessionDecorator -{ - /** - * Returns possibly {@code null} Aether repository system session to be used to resolve project dependencies. - */ - RepositorySystemSession decorate( MavenProject project, RepositorySystemSession session ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java deleted file mode 100644 index 6e13d332..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java +++ /dev/null @@ -1,403 +0,0 @@ -package org.apache.maven.project.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. - */ - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.project.MavenProject; - -import java.io.File; -import java.util.Collection; -import java.util.List; - -/** - * Wraps an active project instance to be able to receive updates from its artifact without affecting the original - * attributes of this artifact. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @todo I think this exposes a design flaw in that the immutable and mutable parts of an artifact are in one class and - * should be split. ie scope, file, etc depend on the context of use, whereas everything else is immutable. - */ -@Deprecated -public class ActiveProjectArtifact - implements Artifact -{ - private final Artifact artifact; - - private final MavenProject project; - - public ActiveProjectArtifact( MavenProject project, Artifact artifact ) - { - this.artifact = artifact; - this.project = project; - - artifact.setFile( project.getArtifact().getFile() ); - artifact.setResolved( true ); - } - - /** {@inheritDoc} */ - public File getFile() - { - // we need to get the latest file for the project, not the artifact that was created at one point in time - return project.getArtifact().getFile(); - } - - /** {@inheritDoc} */ - public String getGroupId() - { - return artifact.getGroupId(); - } - - /** {@inheritDoc} */ - public String getArtifactId() - { - return artifact.getArtifactId(); - } - - /** {@inheritDoc} */ - public String getVersion() - { - return artifact.getVersion(); - } - - /** {@inheritDoc} */ - public void setVersion( String version ) - { - artifact.setVersion( version ); - } - - /** {@inheritDoc} */ - public String getScope() - { - return artifact.getScope(); - } - - /** {@inheritDoc} */ - public String getType() - { - return artifact.getType(); - } - - /** {@inheritDoc} */ - public String getClassifier() - { - return artifact.getClassifier(); - } - - /** {@inheritDoc} */ - public boolean hasClassifier() - { - return artifact.hasClassifier(); - } - - /** {@inheritDoc} */ - public void setFile( File destination ) - { - artifact.setFile( destination ); - project.getArtifact().setFile( destination ); - } - - /** {@inheritDoc} */ - public String getBaseVersion() - { - return artifact.getBaseVersion(); - } - - /** {@inheritDoc} */ - public void setBaseVersion( String baseVersion ) - { - artifact.setBaseVersion( baseVersion ); - } - - /** {@inheritDoc} */ - public String getId() - { - return artifact.getId(); - } - - /** {@inheritDoc} */ - public String getDependencyConflictId() - { - return artifact.getDependencyConflictId(); - } - - /** {@inheritDoc} */ - public void addMetadata( ArtifactMetadata metadata ) - { - artifact.addMetadata( metadata ); - } - - /** {@inheritDoc} */ - public Collection<ArtifactMetadata> getMetadataList() - { - return artifact.getMetadataList(); - } - - /** {@inheritDoc} */ - public void setRepository( ArtifactRepository remoteRepository ) - { - artifact.setRepository( remoteRepository ); - } - - /** {@inheritDoc} */ - public ArtifactRepository getRepository() - { - return artifact.getRepository(); - } - - /** {@inheritDoc} */ - public void updateVersion( String version, ArtifactRepository localRepository ) - { - artifact.updateVersion( version, localRepository ); - } - - /** {@inheritDoc} */ - public String getDownloadUrl() - { - return artifact.getDownloadUrl(); - } - - /** {@inheritDoc} */ - public void setDownloadUrl( String downloadUrl ) - { - artifact.setDownloadUrl( downloadUrl ); - } - - /** {@inheritDoc} */ - public ArtifactFilter getDependencyFilter() - { - return artifact.getDependencyFilter(); - } - - /** {@inheritDoc} */ - public void setDependencyFilter( ArtifactFilter artifactFilter ) - { - artifact.setDependencyFilter( artifactFilter ); - } - - /** {@inheritDoc} */ - public ArtifactHandler getArtifactHandler() - { - return artifact.getArtifactHandler(); - } - - /** {@inheritDoc} */ - public List<String> getDependencyTrail() - { - return artifact.getDependencyTrail(); - } - - /** {@inheritDoc} */ - public void setDependencyTrail( List<String> dependencyTrail ) - { - artifact.setDependencyTrail( dependencyTrail ); - } - - /** {@inheritDoc} */ - public void setScope( String scope ) - { - artifact.setScope( scope ); - } - - /** {@inheritDoc} */ - public VersionRange getVersionRange() - { - return artifact.getVersionRange(); - } - - /** {@inheritDoc} */ - public void setVersionRange( VersionRange newRange ) - { - artifact.setVersionRange( newRange ); - } - - /** {@inheritDoc} */ - public void selectVersion( String version ) - { - artifact.selectVersion( version ); - } - - /** {@inheritDoc} */ - public void setGroupId( String groupId ) - { - artifact.setGroupId( groupId ); - } - - /** {@inheritDoc} */ - public void setArtifactId( String artifactId ) - { - artifact.setArtifactId( artifactId ); - } - - /** {@inheritDoc} */ - public boolean isSnapshot() - { - return artifact.isSnapshot(); - } - - /** {@inheritDoc} */ - public int compareTo( Artifact a ) - { - return artifact.compareTo( a ); - } - - /** {@inheritDoc} */ - public void setResolved( boolean resolved ) - { - artifact.setResolved( resolved ); - } - - /** {@inheritDoc} */ - public boolean isResolved() - { - return artifact.isResolved(); - } - - /** {@inheritDoc} */ - public void setResolvedVersion( String version ) - { - artifact.setResolvedVersion( version ); - } - - /** {@inheritDoc} */ - public void setArtifactHandler( ArtifactHandler handler ) - { - artifact.setArtifactHandler( handler ); - } - - /** {@inheritDoc} */ - public String toString() - { - return "active project artifact:\n\tartifact = " + artifact + ";\n\tproject: " + project; - } - - /** {@inheritDoc} */ - public boolean isRelease() - { - return artifact.isRelease(); - } - - /** {@inheritDoc} */ - public void setRelease( boolean release ) - { - artifact.setRelease( release ); - } - - /** {@inheritDoc} */ - public List<ArtifactVersion> getAvailableVersions() - { - return artifact.getAvailableVersions(); - } - - /** {@inheritDoc} */ - public void setAvailableVersions( List<ArtifactVersion> versions ) - { - artifact.setAvailableVersions( versions ); - } - - /** {@inheritDoc} */ - public boolean isOptional() - { - return artifact.isOptional(); - } - - /** {@inheritDoc} */ - public ArtifactVersion getSelectedVersion() - throws OverConstrainedVersionException - { - return artifact.getSelectedVersion(); - } - - /** {@inheritDoc} */ - public boolean isSelectedVersionKnown() - throws OverConstrainedVersionException - { - return artifact.isSelectedVersionKnown(); - } - - /** {@inheritDoc} */ - public void setOptional( boolean optional ) - { - artifact.setOptional( optional ); - } - - /** {@inheritDoc} */ - public int hashCode() - { - int result = 17; - - result = 37 * result + getGroupId().hashCode(); - result = 37 * result + getArtifactId().hashCode(); - result = 37 * result + getType().hashCode(); - if ( getVersion() != null ) - { - result = 37 * result + getVersion().hashCode(); - } - result = 37 * result + ( getClassifier() != null ? getClassifier().hashCode() : 0 ); - - return result; - } - - /** {@inheritDoc} */ - public boolean equals( Object o ) - { - if ( o == this ) - { - return true; - } - - if ( !( o instanceof Artifact ) ) - { - return false; - } - - Artifact a = (Artifact) o; - - if ( !a.getGroupId().equals( getGroupId() ) ) - { - return false; - } - else if ( !a.getArtifactId().equals( getArtifactId() ) ) - { - return false; - } - else if ( !a.getVersion().equals( getVersion() ) ) - { - return false; - } - else if ( !a.getType().equals( getType() ) ) - { - return false; - } - else if ( a.getClassifier() == null ? getClassifier() != null : !a.getClassifier().equals( getClassifier() ) ) - { - return false; - } - - return true; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java deleted file mode 100644 index cb06b70f..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.util.List; - -import org.apache.maven.model.Dependency; - -public interface ArtifactWithDependencies -{ - - List<Dependency> getDependencies(); - - List<Dependency> getManagedDependencies(); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java deleted file mode 100644 index fd2b956c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java +++ /dev/null @@ -1,185 +0,0 @@ -package org.apache.maven.project.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. - */ - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.DefaultArtifact; -import org.apache.maven.artifact.InvalidArtifactRTException; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.VersionRange; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - *<strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part - * of the public API. In particular, this class can be changed or deleted without prior notice. Use - * {@link org.apache.maven.project.MavenProjectHelper#attachArtifact} instead. - */ -@Deprecated -public class AttachedArtifact - extends DefaultArtifact -{ - - private final Artifact parent; - - public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler ) - { - super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type, - classifier, artifactHandler, parent.isOptional() ); - - setDependencyTrail( Collections.singletonList( parent.getId() ) ); - - this.parent = parent; - - if ( getId().equals( parent.getId() ) ) - { - throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), - parent.getType(), "An attached artifact must have a different ID" - + " than its corresponding main artifact." ); - } - } - - public AttachedArtifact( Artifact parent, String type, ArtifactHandler artifactHandler ) - { - this( parent, type, null, artifactHandler ); - } - - public void setArtifactId( String artifactId ) - { - throw new UnsupportedOperationException( "Cannot change the artifactId for an attached artifact." - + " It is derived from the main artifact." ); - } - - public List<ArtifactVersion> getAvailableVersions() - { - return parent.getAvailableVersions(); - } - - public void setAvailableVersions( List<ArtifactVersion> availableVersions ) - { - throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public String getBaseVersion() - { - return parent.getBaseVersion(); - } - - public void setBaseVersion( String baseVersion ) - { - throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public String getDownloadUrl() - { - return parent.getDownloadUrl(); - } - - public void setDownloadUrl( String downloadUrl ) - { - throw new UnsupportedOperationException( "Cannot change the download information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public void setGroupId( String groupId ) - { - throw new UnsupportedOperationException( "Cannot change the groupId for an attached artifact." - + " It is derived from the main artifact." ); - } - - public ArtifactRepository getRepository() - { - return parent.getRepository(); - } - - public void setRepository( ArtifactRepository repository ) - { - throw new UnsupportedOperationException( "Cannot change the repository information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public String getScope() - { - return parent.getScope(); - } - - public void setScope( String scope ) - { - throw new UnsupportedOperationException( "Cannot change the scoping information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public String getVersion() - { - return parent.getVersion(); - } - - public void setVersion( String version ) - { - throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public VersionRange getVersionRange() - { - return parent.getVersionRange(); - } - - public void setVersionRange( VersionRange range ) - { - throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public boolean isRelease() - { - return parent.isRelease(); - } - - public void setRelease( boolean release ) - { - throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact." - + " It is derived from the main artifact." ); - } - - public boolean isSnapshot() - { - return parent.isSnapshot(); - } - - public void addMetadata( ArtifactMetadata metadata ) - { - // ignore. The parent artifact will handle metadata. - // we must fail silently here to avoid problems with the artifact transformers. - } - - public Collection<ArtifactMetadata> getMetadataList() - { - return Collections.emptyList(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java deleted file mode 100644 index 07fd11da..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java +++ /dev/null @@ -1,347 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.codehaus.plexus.component.annotations.Component; - -@Component( role = MavenMetadataCache.class ) -public class DefaultMavenMetadataCache - implements MavenMetadataCache -{ - - protected final Map<CacheKey, CacheRecord> cache = new ConcurrentHashMap<CacheKey, CacheRecord>(); - - public static class CacheKey - { - private final Artifact artifact; - private final long pomHash; - private final boolean resolveManagedVersions; - private final List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>(); - private final int hashCode; - - public CacheKey( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - { - File file = artifact.getFile(); - this.artifact = ArtifactUtils.copyArtifact( artifact ); - if ( "pom".equals( artifact.getType() ) && file != null ) - { - pomHash = file.getPath().hashCode() + file.lastModified(); - } - else - { - pomHash = 0; - } - this.resolveManagedVersions = resolveManagedVersions; - this.repositories.add( localRepository ); - this.repositories.addAll( remoteRepositories ); - - int hash = 17; - hash = hash * 31 + artifactHashCode( artifact ); - hash = hash * 31 + ( resolveManagedVersions ? 1 : 2 ); - hash = hash * 31 + repositoriesHashCode( repositories ); - this.hashCode = hash; - } - - @Override - public int hashCode() - { - return hashCode; - } - - @Override - public boolean equals( Object o ) - { - if ( o == this ) - { - return true; - } - - if ( !( o instanceof CacheKey ) ) - { - return false; - } - - CacheKey other = (CacheKey) o; - - return pomHash == other.pomHash && artifactEquals( artifact, other.artifact ) - && resolveManagedVersions == other.resolveManagedVersions - && repositoriesEquals( repositories, other.repositories ); - } - } - - private static int artifactHashCode( Artifact a ) - { - int result = 17; - result = 31 * result + a.getGroupId().hashCode(); - result = 31 * result + a.getArtifactId().hashCode(); - result = 31 * result + a.getType().hashCode(); - if ( a.getVersion() != null ) - { - result = 31 * result + a.getVersion().hashCode(); - } - result = 31 * result + ( a.getClassifier() != null ? a.getClassifier().hashCode() : 0 ); - result = 31 * result + ( a.getScope() != null ? a.getScope().hashCode() : 0 ); - result = 31 * result + ( a.getDependencyFilter() != null ? a.getDependencyFilter().hashCode() : 0 ); - result = 31 * result + ( a.isOptional() ? 1 : 0 ); - return result; - } - - private static boolean artifactEquals( Artifact a1, Artifact a2 ) - { - if ( a1 == a2 ) - { - return true; - } - - return eq( a1.getGroupId(), a2.getGroupId() ) - && eq( a1.getArtifactId(), a2.getArtifactId() ) - && eq( a1.getType(), a2.getType() ) - && eq( a1.getVersion(), a2.getVersion() ) - && eq( a1.getClassifier(), a2.getClassifier() ) - && eq( a1.getScope(), a2.getScope() ) - && eq( a1.getDependencyFilter(), a2.getDependencyFilter() ) - && a1.isOptional() == a2.isOptional(); - } - - private static int repositoryHashCode( ArtifactRepository repository ) - { - int result = 17; - result = 31 * result + ( repository.getId() != null ? repository.getId().hashCode() : 0 ); - return result; - } - - private static int repositoriesHashCode( List<ArtifactRepository> repositories ) - { - int result = 17; - for ( ArtifactRepository repository : repositories ) - { - result = 31 * result + repositoryHashCode( repository ); - } - return result; - } - - private static boolean repositoryEquals( ArtifactRepository r1, ArtifactRepository r2 ) - { - if ( r1 == r2 ) - { - return true; - } - - return eq( r1.getId(), r2.getId() ) && eq( r1.getUrl(), r2.getUrl() ) - && repositoryPolicyEquals( r1.getReleases(), r2.getReleases() ) - && repositoryPolicyEquals( r1.getSnapshots(), r2.getSnapshots() ); - } - - private static boolean repositoryPolicyEquals( ArtifactRepositoryPolicy p1, ArtifactRepositoryPolicy p2 ) - { - if ( p1 == p2 ) - { - return true; - } - - return p1.isEnabled() == p2.isEnabled() && eq( p1.getUpdatePolicy(), p2.getUpdatePolicy() ); - } - - private static boolean repositoriesEquals( List<ArtifactRepository> r1, List<ArtifactRepository> r2 ) - { - if ( r1.size() != r2.size() ) - { - return false; - } - - for ( Iterator<ArtifactRepository> it1 = r1.iterator(), it2 = r2.iterator(); it1.hasNext(); ) - { - if ( !repositoryEquals( it1.next(), it2.next() ) ) - { - return false; - } - } - - return true; - } - - private static <T> boolean eq( T s1, T s2 ) - { - return s1 != null ? s1.equals( s2 ) : s2 == null; - } - - public class CacheRecord - { - private Artifact pomArtifact; - private Artifact relocatedArtifact; - private List<Artifact> artifacts; - private Map<String, Artifact> managedVersions; - private List<ArtifactRepository> remoteRepositories; - - private long length; - private long timestamp; - - CacheRecord( Artifact pomArtifact, Artifact relocatedArtifact, Set<Artifact> artifacts, - Map<String, Artifact> managedVersions, List<ArtifactRepository> remoteRepositories ) - { - this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact ); - this.relocatedArtifact = ArtifactUtils.copyArtifactSafe( relocatedArtifact ); - this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<Artifact>() ); - this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories ); - - this.managedVersions = managedVersions; - if ( managedVersions != null ) - { - this.managedVersions = - ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() ); - } - - File pomFile = pomArtifact.getFile(); - if ( pomFile != null && pomFile.canRead() ) - { - this.length = pomFile.length(); - this.timestamp = pomFile.lastModified(); - } - else - { - this.length = -1; - this.timestamp = -1; - } - } - - public Artifact getArtifact() - { - return pomArtifact; - } - - public Artifact getRelocatedArtifact() - { - return relocatedArtifact; - } - - public List<Artifact> getArtifacts() - { - return artifacts; - } - - public Map<String, Artifact> getManagedVersions() - { - return managedVersions; - } - - public List<ArtifactRepository> getRemoteRepositories() - { - return remoteRepositories; - } - - public boolean isStale() - { - File pomFile = pomArtifact.getFile(); - if ( pomFile != null ) - { - if ( pomFile.canRead() ) - { - return length != pomFile.length() || timestamp != pomFile.lastModified(); - } - else - { - // if the POM didn't exist, retry if any repo is configured to always update - boolean snapshot = pomArtifact.isSnapshot(); - for ( ArtifactRepository repository : remoteRepositories ) - { - ArtifactRepositoryPolicy policy = - snapshot ? repository.getSnapshots() : repository.getReleases(); - if ( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS.equals( policy.getUpdatePolicy() ) ) - { - return true; - } - } - } - } - - return length != -1 || timestamp != -1; - } - } - - - public ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - { - CacheKey cacheKey = newCacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories ); - - CacheRecord cacheRecord = cache.get( cacheKey ); - - if ( cacheRecord != null && !cacheRecord.isStale() ) - { - Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() ); - Artifact relocatedArtifact = ArtifactUtils.copyArtifactSafe( cacheRecord.getRelocatedArtifact() ); - Set<Artifact> artifacts = - ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<Artifact>() ); - Map<String, Artifact> managedVersions = cacheRecord.getManagedVersions(); - if ( managedVersions != null ) - { - managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() ); - } - return new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions, - cacheRecord.getRemoteRepositories() ); - } - - cache.remove( cacheKey ); - - return null; - } - - public void put( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, ResolutionGroup result ) - { - put( newCacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories ), result ); - } - - protected CacheKey newCacheKey( Artifact artifact, boolean resolveManagedVersions, - ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) - { - return new CacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories ); - } - - protected void put( CacheKey cacheKey, ResolutionGroup result ) - { - CacheRecord cacheRecord = - new CacheRecord( result.getPomArtifact(), result.getRelocatedArtifact(), result.getArtifacts(), - result.getManagedVersions(), result.getResolutionRepositories() ); - - cache.put( cacheKey, cacheRecord ); - } - - public void flush() - { - cache.clear(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java deleted file mode 100644 index 91f665b5..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.maven.project.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. - */ - -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.codehaus.plexus.component.annotations.Component; - -/** - * This realizes the metadata source via the default hint to provide backward-compat with Maven 2.x whose Plexus version - * registered component descriptors twice: once keyed by role+roleHint and once keyed by role only. This effectively - * made the metadata source available with its original role hint ("maven") as well as the default hint. - * - * @author Benjamin Bentmann - */ -@Component( role = ArtifactMetadataSource.class ) -public class DefaultMetadataSource - extends MavenMetadataSource -{ - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java deleted file mode 100644 index 8a1de685..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.io.File; - -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.model.Dependency; -import org.apache.maven.project.InvalidProjectVersionException; - -/** - * Thrown if a dependency has an invalid version. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class InvalidDependencyVersionException - extends InvalidProjectVersionException -{ - private Dependency dependency; - - public InvalidDependencyVersionException( String projectId, Dependency dependency, File pomFile, - InvalidVersionSpecificationException cause ) - { - super( projectId, formatLocationInPom( dependency ), dependency.getVersion(), pomFile, cause ); - this.dependency = dependency; - } - - private static String formatLocationInPom( Dependency dependency ) - { - return "Dependency: " + ArtifactUtils.versionlessKey( dependency.getGroupId(), dependency.getArtifactId() ); - } - - public Dependency getDependency() - { - return dependency; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java deleted file mode 100644 index 036ee86c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.metadata.ResolutionGroup; - -public interface MavenMetadataCache -{ - - ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ); - - void put( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, ResolutionGroup result ); - - void flush(); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java deleted file mode 100644 index 1fb5c545..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java +++ /dev/null @@ -1,770 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Metadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.DistributionManagement; -import org.apache.maven.model.Exclusion; -import org.apache.maven.model.Relocation; -import org.apache.maven.model.building.ModelBuildingException; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.resolution.UnresolvableModelException; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.DefaultProjectBuildingRequest; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuilder; -import org.apache.maven.project.ProjectBuildingException; -import org.apache.maven.project.ProjectBuildingRequest; -import org.apache.maven.properties.internal.EnvironmentUtils; -import org.apache.maven.properties.internal.SystemProperties; -import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.RepositoryPolicy; -import org.eclipse.aether.transfer.ArtifactNotFoundException; - -/** - * @author Jason van Zyl - */ -@Component( role = ArtifactMetadataSource.class, hint = "maven" ) -public class MavenMetadataSource - implements ArtifactMetadataSource -{ - @Requirement - private RepositoryMetadataManager repositoryMetadataManager; - - @Requirement - private ArtifactFactory repositorySystem; - - //TODO: This prevents a cycle in the composition which shows us another problem we need to deal with. - //@Requirement - private ProjectBuilder projectBuilder; - - @Requirement - private PlexusContainer container; - - @Requirement - private Logger logger; - - @Requirement - private MavenMetadataCache cache; - - @Requirement - private LegacySupport legacySupport; - - private void injectSession( MetadataResolutionRequest request ) - { - RepositorySystemSession session = legacySupport.getRepositorySession(); - - if ( session != null ) - { - request.setOffline( session.isOffline() ); - request.setForceUpdate( RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals( session.getUpdatePolicy() ) ); - } - } - - public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - throws ArtifactMetadataRetrievalException - { - return retrieve( artifact, localRepository, remoteRepositories, false ); - } - - public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, boolean resolveManagedVersions ) - throws ArtifactMetadataRetrievalException - { - MetadataResolutionRequest request = new DefaultMetadataResolutionRequest(); - injectSession( request ); - request.setArtifact( artifact ); - request.setLocalRepository( localRepository ); - request.setRemoteRepositories( remoteRepositories ); - request.setResolveManagedVersions( resolveManagedVersions ); - return retrieve( request ); - } - - public ResolutionGroup retrieve( MetadataResolutionRequest request ) - throws ArtifactMetadataRetrievalException - { - Artifact artifact = request.getArtifact(); - - // - // If we have a system scoped artifact then we do not want any searching in local or remote repositories - // and we want artifact resolution to only return the system scoped artifact itself. - // - if ( artifact.getScope() != null && artifact.getScope().equals( Artifact.SCOPE_SYSTEM ) ) - { - return new ResolutionGroup( null, null, null ); - } - - ResolutionGroup cached = - cache.get( artifact, request.isResolveManagedVersions(), request.getLocalRepository(), - request.getRemoteRepositories() ); - - if ( cached != null - // if the POM has no file, we cached a missing artifact, only return the cached data if no update forced - && ( !request.isForceUpdate() || hasFile( cached.getPomArtifact() ) ) ) - { - return cached; - } - - List<Dependency> dependencies; - - List<Dependency> managedDependencies = null; - - List<ArtifactRepository> pomRepositories = null; - - Artifact pomArtifact; - - Artifact relocatedArtifact = null; - - //TODO: Not even sure this is really required as the project will be cached in the builder, we'll see this - // is currently the biggest hotspot - if ( artifact instanceof ArtifactWithDependencies ) - { - pomArtifact = artifact; - - dependencies = ( (ArtifactWithDependencies) artifact ).getDependencies(); - - managedDependencies = ( (ArtifactWithDependencies) artifact ).getManagedDependencies(); - } - else - { - ProjectRelocation rel = retrieveRelocatedProject( artifact, request ); - - if ( rel == null ) - { - return null; - } - - pomArtifact = rel.pomArtifact; - - relocatedArtifact = rel.relocatedArtifact; - - if ( rel.project == null ) - { - // When this happens we have a Maven 1.x POM, or some invalid POM. - // It should have never found its way into Maven 2.x repository but it did. - dependencies = Collections.emptyList(); - } - else - { - dependencies = rel.project.getDependencies(); - - DependencyManagement depMngt = rel.project.getDependencyManagement(); - managedDependencies = ( depMngt != null ) ? depMngt.getDependencies() : null; - - pomRepositories = rel.project.getRemoteArtifactRepositories(); - } - } - - Set<Artifact> artifacts = Collections.<Artifact>emptySet(); - - if ( !artifact.getArtifactHandler().isIncludesDependencies() ) - { - artifacts = new LinkedHashSet<Artifact>(); - - for ( Dependency dependency : dependencies ) - { - Artifact dependencyArtifact = createDependencyArtifact( dependency, artifact, pomArtifact ); - - if ( dependencyArtifact != null ) - { - artifacts.add( dependencyArtifact ); - } - } - } - - Map<String, Artifact> managedVersions = null; - - if ( managedDependencies != null && request.isResolveManagedVersions() ) - { - managedVersions = new HashMap<String, Artifact>(); - - for ( Dependency managedDependency : managedDependencies ) - { - Artifact managedArtifact = createDependencyArtifact( managedDependency, null, pomArtifact ); - - managedVersions.put( managedDependency.getManagementKey(), managedArtifact ); - } - } - - List<ArtifactRepository> aggregatedRepositories = - aggregateRepositories( request.getRemoteRepositories(), pomRepositories ); - - ResolutionGroup result = - new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions, aggregatedRepositories ); - - cache.put( artifact, request.isResolveManagedVersions(), request.getLocalRepository(), - request.getRemoteRepositories(), result ); - - return result; - } - - private boolean hasFile( Artifact artifact ) - { - return artifact != null && artifact.getFile() != null && artifact.getFile().exists(); - } - - private List<ArtifactRepository> aggregateRepositories( List<ArtifactRepository> requestRepositories, - List<ArtifactRepository> pomRepositories ) - { - List<ArtifactRepository> repositories = requestRepositories; - - if ( pomRepositories != null && !pomRepositories.isEmpty() ) - { - Map<String, ArtifactRepository> repos = new LinkedHashMap<String, ArtifactRepository>(); - - for ( ArtifactRepository repo : requestRepositories ) - { - if ( !repos.containsKey( repo.getId() ) ) - { - repos.put( repo.getId(), repo ); - } - } - - for ( ArtifactRepository repo : pomRepositories ) - { - if ( !repos.containsKey( repo.getId() ) ) - { - repos.put( repo.getId(), repo ); - } - } - - repositories = new ArrayList<ArtifactRepository>( repos.values() ); - } - - return repositories; - } - - private Artifact createDependencyArtifact( Dependency dependency, Artifact owner, Artifact pom ) - throws ArtifactMetadataRetrievalException - { - try - { - String inheritedScope = ( owner != null ) ? owner.getScope() : null; - - ArtifactFilter inheritedFilter = ( owner != null ) ? owner.getDependencyFilter() : null; - - return createDependencyArtifact( repositorySystem, dependency, inheritedScope, inheritedFilter ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw new ArtifactMetadataRetrievalException( "Invalid version for dependency " - + dependency.getManagementKey() + ": " + e.getMessage(), e, pom ); - } - } - - private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency, - String inheritedScope, ArtifactFilter inheritedFilter ) - throws InvalidVersionSpecificationException - { - String effectiveScope = getEffectiveScope( dependency.getScope(), inheritedScope ); - - if ( effectiveScope == null ) - { - return null; - } - - VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() ); - - Artifact dependencyArtifact = - factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange, - dependency.getType(), dependency.getClassifier(), effectiveScope, - dependency.isOptional() ); - - ArtifactFilter dependencyFilter = inheritedFilter; - - if ( dependencyFilter != null && !dependencyFilter.include( dependencyArtifact ) ) - { - return null; - } - - if ( Artifact.SCOPE_SYSTEM.equals( effectiveScope ) ) - { - dependencyArtifact.setFile( new File( dependency.getSystemPath() ) ); - } - - dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, dependencyFilter ) ); - - return dependencyArtifact; - } - - private static String getEffectiveScope( String originalScope, String inheritedScope ) - { - String effectiveScope = Artifact.SCOPE_RUNTIME; - - if ( originalScope == null ) - { - originalScope = Artifact.SCOPE_COMPILE; - } - - if ( inheritedScope == null ) - { - // direct dependency retains its scope - effectiveScope = originalScope; - } - else if ( Artifact.SCOPE_TEST.equals( originalScope ) || Artifact.SCOPE_PROVIDED.equals( originalScope ) ) - { - // test and provided are not transitive, so exclude them - effectiveScope = null; - } - else if ( Artifact.SCOPE_SYSTEM.equals( originalScope ) ) - { - // system scope come through unchanged... - effectiveScope = Artifact.SCOPE_SYSTEM; - } - else if ( Artifact.SCOPE_COMPILE.equals( originalScope ) && Artifact.SCOPE_COMPILE.equals( inheritedScope ) ) - { - // added to retain compile scope. Remove if you want compile inherited as runtime - effectiveScope = Artifact.SCOPE_COMPILE; - } - else if ( Artifact.SCOPE_TEST.equals( inheritedScope ) ) - { - effectiveScope = Artifact.SCOPE_TEST; - } - else if ( Artifact.SCOPE_PROVIDED.equals( inheritedScope ) ) - { - effectiveScope = Artifact.SCOPE_PROVIDED; - } - - return effectiveScope; - } - - private static ArtifactFilter createDependencyFilter( Dependency dependency, ArtifactFilter inheritedFilter ) - { - ArtifactFilter effectiveFilter = inheritedFilter; - - if ( !dependency.getExclusions().isEmpty() ) - { - List<String> exclusions = new ArrayList<String>(); - - for ( Exclusion e : dependency.getExclusions() ) - { - exclusions.add( e.getGroupId() + ':' + e.getArtifactId() ); - } - - effectiveFilter = new ExcludesArtifactFilter( exclusions ); - - if ( inheritedFilter != null ) - { - effectiveFilter = new AndArtifactFilter( Arrays.asList( inheritedFilter, effectiveFilter ) ); - } - } - - return effectiveFilter; - } - - public List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - throws ArtifactMetadataRetrievalException - { - MetadataResolutionRequest request = new DefaultMetadataResolutionRequest(); - injectSession( request ); - request.setArtifact( artifact ); - request.setLocalRepository( localRepository ); - request.setRemoteRepositories( remoteRepositories ); - return retrieveAvailableVersions( request ); - } - - public List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request ) - throws ArtifactMetadataRetrievalException - { - RepositoryMetadata metadata = new ArtifactRepositoryMetadata( request.getArtifact() ); - - try - { - repositoryMetadataManager.resolve( metadata, request ); - } - catch ( RepositoryMetadataResolutionException e ) - { - throw new ArtifactMetadataRetrievalException( e.getMessage(), e, request.getArtifact() ); - } - - List<String> availableVersions = request.getLocalRepository().findVersions( request.getArtifact() ); - - return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions ); - } - - public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, - ArtifactRepository localRepository, - ArtifactRepository deploymentRepository ) - throws ArtifactMetadataRetrievalException - { - RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); - - try - { - repositoryMetadataManager.resolveAlways( metadata, localRepository, deploymentRepository ); - } - catch ( RepositoryMetadataResolutionException e ) - { - throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact ); - } - - List<String> availableVersions = localRepository.findVersions( artifact ); - - return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions ); - } - - private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata( Metadata repoMetadata, - List<String> availableVersions ) - { - Collection<String> versions = new LinkedHashSet<String>(); - - if ( ( repoMetadata != null ) && ( repoMetadata.getVersioning() != null ) ) - { - versions.addAll( repoMetadata.getVersioning().getVersions() ); - } - - versions.addAll( availableVersions ); - - List<ArtifactVersion> artifactVersions = new ArrayList<ArtifactVersion>( versions.size() ); - - for ( String version : versions ) - { - artifactVersions.add( new DefaultArtifactVersion( version ) ); - } - - return artifactVersions; - } - - // USED BY MAVEN ASSEMBLY PLUGIN - @Deprecated - public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies, - String inheritedScope, ArtifactFilter dependencyFilter, - MavenProject project ) - throws InvalidDependencyVersionException - { - Set<Artifact> artifacts = new LinkedHashSet<Artifact>(); - - for ( Dependency d : dependencies ) - { - Artifact dependencyArtifact; - try - { - dependencyArtifact = createDependencyArtifact( artifactFactory, d, inheritedScope, dependencyFilter ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw new InvalidDependencyVersionException( project.getId(), d, project.getFile(), e ); - } - - if ( dependencyArtifact != null ) - { - artifacts.add( dependencyArtifact ); - } - } - - return artifacts; - } - - private ProjectBuilder getProjectBuilder() - { - if ( projectBuilder != null ) - { - return projectBuilder; - } - - try - { - projectBuilder = container.lookup( ProjectBuilder.class ); - } - catch ( ComponentLookupException e ) - { - // Won't happen - } - - return projectBuilder; - } - - private ProjectRelocation retrieveRelocatedProject( Artifact artifact, MetadataResolutionRequest repositoryRequest ) - throws ArtifactMetadataRetrievalException - { - MavenProject project; - - Artifact pomArtifact; - Artifact relocatedArtifact = null; - boolean done = false; - do - { - project = null; - - pomArtifact = - repositorySystem.createProjectArtifact( artifact.getGroupId(), - artifact.getArtifactId(), - artifact.getVersion(), artifact.getScope() ); - - if ( "pom".equals( artifact.getType() ) ) - { - pomArtifact.setFile( artifact.getFile() ); - } - - if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) ) - { - done = true; - } - else - { - try - { - ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest(); - configuration.setLocalRepository( repositoryRequest.getLocalRepository() ); - configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() ); - configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); - configuration.setProcessPlugins( false ); - configuration.setRepositoryMerging( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT ); - configuration.setSystemProperties( getSystemProperties() ); - configuration.setRepositorySession( legacySupport.getRepositorySession() ); - - project = getProjectBuilder().build( pomArtifact, configuration ).getProject(); - } - catch ( ProjectBuildingException e ) - { - ModelProblem missingParentPom = hasMissingParentPom( e ); - if ( missingParentPom != null ) - { - throw new ArtifactMetadataRetrievalException( "Failed to process POM for " - + artifact.getId() + ": " + missingParentPom.getMessage(), - missingParentPom.getException(), - artifact ); - } - - String message; - - if ( isMissingPom( e ) ) - { - message = "Missing POM for " + artifact.getId(); - } - else if ( isNonTransferrablePom( e ) ) - { - throw new ArtifactMetadataRetrievalException( "Failed to retrieve POM for " - + artifact.getId() + ": " + e.getCause().getMessage(), e.getCause(), - artifact ); - } - else - { - message = - "Invalid POM for " + artifact.getId() - + ", transitive dependencies (if any) will not be available" - + ", enable debug logging for more details"; - } - - if ( logger.isDebugEnabled() ) - { - message += ": " + e.getMessage(); - } - - logger.warn( message ); - } - - if ( project != null ) - { - Relocation relocation = null; - - DistributionManagement distMgmt = project.getDistributionManagement(); - if ( distMgmt != null ) - { - relocation = distMgmt.getRelocation(); - - artifact.setDownloadUrl( distMgmt.getDownloadUrl() ); - pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() ); - } - - if ( relocation != null ) - { - if ( relocation.getGroupId() != null ) - { - artifact.setGroupId( relocation.getGroupId() ); - relocatedArtifact = artifact; - project.setGroupId( relocation.getGroupId() ); - } - if ( relocation.getArtifactId() != null ) - { - artifact.setArtifactId( relocation.getArtifactId() ); - relocatedArtifact = artifact; - project.setArtifactId( relocation.getArtifactId() ); - } - if ( relocation.getVersion() != null ) - { - // note: see MNG-3454. This causes a problem, but fixing it may break more. - artifact.setVersionRange( VersionRange.createFromVersion( relocation.getVersion() ) ); - relocatedArtifact = artifact; - project.setVersion( relocation.getVersion() ); - } - - if ( artifact.getDependencyFilter() != null - && !artifact.getDependencyFilter().include( artifact ) ) - { - return null; - } - - // MNG-2861: the artifact data has changed. If the available versions where previously - // retrieved, we need to update it. - // TODO: shouldn't the versions be merged across relocations? - List<ArtifactVersion> available = artifact.getAvailableVersions(); - if ( available != null && !available.isEmpty() ) - { - MetadataResolutionRequest metadataRequest = - new DefaultMetadataResolutionRequest( repositoryRequest ); - metadataRequest.setArtifact( artifact ); - available = retrieveAvailableVersions( metadataRequest ); - artifact.setAvailableVersions( available ); - } - - String message = - "\n This artifact has been relocated to " + artifact.getGroupId() + ":" - + artifact.getArtifactId() + ":" + artifact.getVersion() + ".\n"; - - if ( relocation.getMessage() != null ) - { - message += " " + relocation.getMessage() + "\n"; - } - - if ( artifact.getDependencyTrail() != null && artifact.getDependencyTrail().size() == 1 ) - { - logger.warn( "While downloading " + pomArtifact.getGroupId() + ":" - + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" ); - } - else - { - logger.debug( "While downloading " + pomArtifact.getGroupId() + ":" - + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" ); - } - } - else - { - done = true; - } - } - else - { - done = true; - } - } - } - while ( !done ); - - ProjectRelocation rel = new ProjectRelocation(); - rel.project = project; - rel.pomArtifact = pomArtifact; - rel.relocatedArtifact = relocatedArtifact; - - return rel; - } - - private ModelProblem hasMissingParentPom( ProjectBuildingException e ) - { - if ( e.getCause() instanceof ModelBuildingException ) - { - ModelBuildingException mbe = (ModelBuildingException) e.getCause(); - for ( ModelProblem problem : mbe.getProblems() ) - { - if ( problem.getException() instanceof UnresolvableModelException ) - { - return problem; - } - } - - } - return null; - } - - private boolean isMissingPom( Exception e ) - { - if ( e.getCause() instanceof MultipleArtifactsNotFoundException ) - { - return true; - } - return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException - && e.getCause().getCause() instanceof ArtifactNotFoundException; - } - - private boolean isNonTransferrablePom( Exception e ) - { - if ( e.getCause() instanceof ArtifactResolutionException ) - { - return true; - } - return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException - && !( e.getCause().getCause() instanceof ArtifactNotFoundException ); - } - - private Properties getSystemProperties() - { - Properties props = new Properties(); - - EnvironmentUtils.addEnvVars( props ); - - SystemProperties.addSystemProperties( props ); - - return props; - } - - private static final class ProjectRelocation - { - private MavenProject project; - - private Artifact pomArtifact; - - private Artifact relocatedArtifact; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java deleted file mode 100644 index d348d59c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.util.Collections; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.DefaultArtifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Plugin; - -public class PluginArtifact - extends DefaultArtifact - implements ArtifactWithDependencies -{ - private Plugin plugin; - - public PluginArtifact( Plugin plugin, Artifact pluginArtifact ) - { - super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null, - new PluginArtifactHandler() ); - this.plugin = plugin; - setFile( pluginArtifact.getFile() ); - setResolved( true ); - } - - public List<Dependency> getDependencies() - { - return plugin.getDependencies(); - } - - public List<Dependency> getManagedDependencies() - { - return Collections.emptyList(); - } - - static class PluginArtifactHandler - implements ArtifactHandler - { - public String getClassifier() - { - return null; - } - - public String getDirectory() - { - return null; - } - - public String getExtension() - { - return "jar"; - } - - public String getLanguage() - { - return "none"; - } - - public String getPackaging() - { - return "maven-plugin"; - } - - public boolean isAddedToClasspath() - { - return true; - } - - public boolean isIncludesDependencies() - { - return false; - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java deleted file mode 100644 index 1d4a2a31..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.util.Collections; -import java.util.List; - -import org.apache.maven.artifact.DefaultArtifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.project.MavenProject; - -public class ProjectArtifact - extends DefaultArtifact - implements ArtifactWithDependencies -{ - private MavenProject project; - - public ProjectArtifact( MavenProject project ) - { - super( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, "pom", null, - new PomArtifactHandler() ); - this.project = project; - setFile( project.getFile() ); - setResolved( true ); - } - - public MavenProject getProject() - { - return project; - } - - public List<Dependency> getDependencies() - { - return project.getDependencies(); - } - - public List<Dependency> getManagedDependencies() - { - DependencyManagement depMngt = project.getDependencyManagement(); - return ( depMngt != null ) ? depMngt.getDependencies() : Collections.<Dependency>emptyList(); - } - - static class PomArtifactHandler - implements ArtifactHandler - { - public String getClassifier() - { - return null; - } - - public String getDirectory() - { - return null; - } - - public String getExtension() - { - return "pom"; - } - - public String getLanguage() - { - return "none"; - } - - public String getPackaging() - { - return "pom"; - } - - public boolean isAddedToClasspath() - { - return false; - } - - public boolean isIncludesDependencies() - { - return false; - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java deleted file mode 100644 index 7ea99bf0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.apache.maven.project.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. - */ - -import java.io.File; -import java.io.IOException; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.AbstractArtifactMetadata; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException; -import org.codehaus.plexus.util.FileUtils; - -/** - * Attach a POM to an artifact. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class ProjectArtifactMetadata - extends AbstractArtifactMetadata -{ - private final File file; - - public ProjectArtifactMetadata( Artifact artifact ) - { - this( artifact, null ); - } - - public ProjectArtifactMetadata( Artifact artifact, File file ) - { - super( artifact ); - this.file = file; - } - - public File getFile() - { - return file; - } - - public String getRemoteFilename() - { - return getFilename(); - } - - public String getLocalFilename( ArtifactRepository repository ) - { - return getFilename(); - } - - private String getFilename() - { - return getArtifactId() + "-" + artifact.getVersion() + ".pom"; - } - - public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository ) - throws RepositoryMetadataStoreException - { - File destination = - new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( this, - remoteRepository ) ); - - // ---------------------------------------------------------------------------- - // I'm fully aware that the file could just be moved using File.rename but - // there are bugs in various JVM that have problems doing this across - // different filesystem. So we'll incur the small hit to actually copy - // here and be safe. jvz. - // ---------------------------------------------------------------------------- - - try - { - FileUtils.copyFile( file, destination ); - } - catch ( IOException e ) - { - throw new RepositoryMetadataStoreException( "Error copying POM to the local repository.", e ); - } - } - - public String toString() - { - return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion(); - } - - public boolean storedInArtifactVersionDirectory() - { - return true; - } - - public String getBaseVersion() - { - return artifact.getBaseVersion(); - } - - public Object getKey() - { - return "project " + artifact.getGroupId() + ":" + artifact.getArtifactId(); - } - - public void merge( ArtifactMetadata metadata ) - { - ProjectArtifactMetadata m = (ProjectArtifactMetadata) metadata; - if ( !m.file.equals( file ) ) - { - throw new IllegalStateException( "Cannot add two different pieces of metadata for: " + getKey() ); - } - } - - public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata ) - { - this.merge( (ArtifactMetadata) metadata ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java deleted file mode 100644 index 18e349ac..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.apache.maven.project.path; - -/* - * 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.model.Model; - -/** - * @author Jason van Zyl - */ -@Deprecated -public interface PathTranslator -{ - String ROLE = PathTranslator.class.getName(); - - void alignToBaseDirectory( Model model, File basedir ); - - String alignToBaseDirectory( String path, File basedir ); - - void unalignFromBaseDirectory( Model model, File basedir ); - - String unalignFromBaseDirectory( String directory, File basedir ); -} |