diff options
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java')
131 files changed, 0 insertions, 18251 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java deleted file mode 100644 index 7051e3bf..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.apache.maven.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. - */ - -/** - * Type safe reincarnation of Artifact scope. Also supplies the <code>DEFAULT_SCOPE<code> as well - * as convenience method to deal with scope relationships. - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ - -public enum ArtifactScopeEnum -{ - compile( 1 ), test( 2 ), runtime( 3 ), provided( 4 ), system( 5 ), runtime_plus_system( 6 ); - - public static final ArtifactScopeEnum DEFAULT_SCOPE = compile; - - private int id; - - // Constructor - ArtifactScopeEnum( int id ) - { - this.id = id; - } - - int getId() - { - return id; - } - - - /** - * Helper method to simplify null processing - * - * @return - */ - public static final ArtifactScopeEnum checkScope( ArtifactScopeEnum scope ) - { - return scope == null ? DEFAULT_SCOPE : scope; - } - - /** - * - * @return unsafe String representation of this scope. - */ - public String getScope() - { - if ( id == 1 ) - { - return Artifact.SCOPE_COMPILE; - } - else if ( id == 2 ) - { - return Artifact.SCOPE_TEST; - - } - else if ( id == 3 ) - { - return Artifact.SCOPE_RUNTIME; - - } - else if ( id == 4 ) - { - return Artifact.SCOPE_PROVIDED; - } - else if ( id == 5 ) - { - return Artifact.SCOPE_SYSTEM; - } - else - { - return Artifact.SCOPE_RUNTIME_PLUS_SYSTEM; - } - } - - private static final ArtifactScopeEnum [][][] COMPLIANCY_SETS = { - { { compile }, { compile, provided, system } } - , { { test }, { compile, test, provided, system } } - , { { runtime }, { compile, runtime, system } } - , { { provided }, { compile, test, provided } } - }; - - /** - * scope relationship function. Used by the graph conflict resolution policies - * - * @param scope - * @return true is supplied scope is an inclusive sub-scope of current one. - */ - public boolean encloses( ArtifactScopeEnum scope ) - { - final ArtifactScopeEnum s = checkScope( scope ); - - // system scope is historic only - and simple - if ( id == system.id ) - { - return scope.id == system.id; - } - - for ( ArtifactScopeEnum[][] set : COMPLIANCY_SETS ) - { - if ( id == set[0][0].id ) - { - for ( ArtifactScopeEnum ase : set[1] ) - { - if ( s.id == ase.id ) - { - return true; - } - } - break; - } - } - return false; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java deleted file mode 100644 index 3bd1e341..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.apache.maven.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.HashMap; -import java.util.Map; - -/** - * Type safe enumeration for the artifact status field. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public final class ArtifactStatus - implements Comparable<ArtifactStatus> -{ - /** - * No trust - no information about status. - */ - public static final ArtifactStatus NONE = new ArtifactStatus( "none", 0 ); - - /** - * No trust - information was generated with defaults. - */ - public static final ArtifactStatus GENERATED = new ArtifactStatus( "generated", 1 ); - - /** - * Low trust - was converted from the Maven 1.x repository. - */ - public static final ArtifactStatus CONVERTED = new ArtifactStatus( "converted", 2 ); - - /** - * Moderate trust - it was deployed directly from a partner. - */ - public static final ArtifactStatus PARTNER = new ArtifactStatus( "partner", 3 ); - - /** - * Moderate trust - it was deployed directly by a user. - */ - public static final ArtifactStatus DEPLOYED = new ArtifactStatus( "deployed", 4 ); - - /** - * Trusted, as it has had its data verified by hand. - */ - public static final ArtifactStatus VERIFIED = new ArtifactStatus( "verified", 5 ); - - private final int rank; - - private final String key; - - private static Map<String, ArtifactStatus> map; - - private ArtifactStatus( String key, int rank ) - { - this.rank = rank; - this.key = key; - - if ( map == null ) - { - map = new HashMap<String, ArtifactStatus>(); - } - map.put( key, this ); - } - - public static ArtifactStatus valueOf( String status ) - { - ArtifactStatus retVal = null; - - if ( status != null ) - { - retVal = map.get( status ); - } - - return retVal != null ? retVal : NONE; - } - - public boolean equals( Object o ) - { - if ( this == o ) - { - return true; - } - if ( o == null || getClass() != o.getClass() ) - { - return false; - } - - final ArtifactStatus that = (ArtifactStatus) o; - - return rank == that.rank; - - } - - public int hashCode() - { - return rank; - } - - public String toString() - { - return key; - } - - public int compareTo( ArtifactStatus s ) - { - return rank - s.rank; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java deleted file mode 100644 index 5abe1105..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.maven.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.codehaus.plexus.component.repository.exception.ComponentLookupException; - -/** - * Exception which is meant to occur when a layout specified for a particular - * repository doesn't have a corresponding {@link ArtifactRepositoryLayout} - * component in the current container. - * - * @author jdcasey - */ -public class UnknownRepositoryLayoutException - extends InvalidRepositoryException -{ - - private final String layoutId; - - public UnknownRepositoryLayoutException( String repositoryId, String layoutId ) - { - super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId ); - this.layoutId = layoutId; - } - - public UnknownRepositoryLayoutException( String repositoryId, String layoutId, ComponentLookupException e ) - { - super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId, e ); - this.layoutId = layoutId; - } - - public String getLayoutId() - { - return layoutId; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java deleted file mode 100644 index 072552cc..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.apache.maven.artifact.deployer; - -/* - * 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.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -public interface ArtifactDeployer -{ - String ROLE = ArtifactDeployer.class.getName(); - - /** - * Deploy an artifact from a particular directory. The artifact handler is used to determine the - * filename of the source file. - * - * @param basedir the directory where the artifact is stored - * @param finalName the name of the artifact without extension - * @param artifact the artifact definition - * @param deploymentRepository the repository to deploy to - * @param localRepository the local repository to install into - * @throws ArtifactDeploymentException if an error occurred deploying the artifact - * @deprecated to be removed before 2.0 after the install/deploy plugins use the alternate - * method - */ - @Deprecated - void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException; - - /** - * Deploy an artifact from a particular file. - * - * @param source the file to deploy - * @param artifact the artifact definition - * @param deploymentRepository the repository to deploy to - * @param localRepository the local repository to install into - * @throws ArtifactDeploymentException if an error occurred deploying the artifact - */ - void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java deleted file mode 100644 index 6e44ed3c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.apache.maven.artifact.deployer; - -/* - * 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 Jason van Zyl - */ -public class ArtifactDeploymentException - extends Exception -{ - public ArtifactDeploymentException( String message ) - { - super( message ); - } - - public ArtifactDeploymentException( Throwable cause ) - { - super( cause ); - } - - public ArtifactDeploymentException( String message, - Throwable cause ) - { - super( message, cause ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java deleted file mode 100644 index abbab821..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.maven.artifact.deployer; - -/* - * 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.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.MetadataBridge; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.artifact.ProjectArtifactMetadata; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.deployment.DeployRequest; -import org.eclipse.aether.deployment.DeployResult; -import org.eclipse.aether.deployment.DeploymentException; -import org.eclipse.aether.metadata.MergeableMetadata; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.util.artifact.SubArtifact; - -@Component( role = ArtifactDeployer.class, instantiationStrategy = "per-lookup" ) -public class DefaultArtifactDeployer - extends AbstractLogEnabled - implements ArtifactDeployer -{ - - @Requirement - private RepositorySystem repoSystem; - - @Requirement - private LegacySupport legacySupport; - - private Map<Object, MergeableMetadata> relatedMetadata = new ConcurrentHashMap<Object, MergeableMetadata>(); - - /** - * @deprecated we want to use the artifact method only, and ensure artifact.file is set - * correctly. - */ - @Deprecated - public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException - { - String extension = artifact.getArtifactHandler().getExtension(); - File source = new File( basedir, finalName + "." + extension ); - deploy( source, artifact, deploymentRepository, localRepository ); - } - - public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException - { - RepositorySystemSession session = - LegacyLocalRepositoryManager.overlay( localRepository, legacySupport.getRepositorySession(), repoSystem ); - - DeployRequest request = new DeployRequest(); - - request.setTrace( RequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) ); - - org.eclipse.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact ); - mainArtifact = mainArtifact.setFile( source ); - request.addArtifact( mainArtifact ); - - String versionKey = artifact.getGroupId() + ':' + artifact.getArtifactId(); - String snapshotKey = null; - if ( artifact.isSnapshot() ) - { - snapshotKey = versionKey + ':' + artifact.getBaseVersion(); - request.addMetadata( relatedMetadata.get( snapshotKey ) ); - } - request.addMetadata( relatedMetadata.get( versionKey ) ); - - for ( ArtifactMetadata metadata : artifact.getMetadataList() ) - { - if ( metadata instanceof ProjectArtifactMetadata ) - { - org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" ); - pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() ); - request.addArtifact( pomArtifact ); - } - else if ( metadata instanceof SnapshotArtifactRepositoryMetadata - || metadata instanceof ArtifactRepositoryMetadata ) - { - // eaten, handled by repo system - } - else - { - request.addMetadata( new MetadataBridge( metadata ) ); - } - } - - RemoteRepository remoteRepo = RepositoryUtils.toRepo( deploymentRepository ); - /* - * NOTE: This provides backward-compat with maven-deploy-plugin:2.4 which bypasses the repository factory when - * using an alternative deployment location. - */ - if ( deploymentRepository instanceof DefaultArtifactRepository - && deploymentRepository.getAuthentication() == null ) - { - RemoteRepository.Builder builder = new RemoteRepository.Builder( remoteRepo ); - builder.setAuthentication( session.getAuthenticationSelector().getAuthentication( remoteRepo ) ); - builder.setProxy( session.getProxySelector().getProxy( remoteRepo ) ); - remoteRepo = builder.build(); - } - request.setRepository( remoteRepo ); - - DeployResult result; - try - { - result = repoSystem.deploy( session, request ); - } - catch ( DeploymentException e ) - { - throw new ArtifactDeploymentException( e.getMessage(), e ); - } - - for ( Object metadata : result.getMetadata() ) - { - if ( metadata.getClass().getName().endsWith( ".internal.VersionsMetadata" ) ) - { - relatedMetadata.put( versionKey, (MergeableMetadata) metadata ); - } - if ( snapshotKey != null && metadata.getClass().getName().endsWith( ".internal.RemoteSnapshotMetadata" ) ) - { - relatedMetadata.put( snapshotKey, (MergeableMetadata) metadata ); - } - } - - artifact.setResolvedVersion( result.getArtifacts().iterator().next().getVersion() ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java deleted file mode 100644 index 9f1e45b9..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.apache.maven.artifact.installer; - -/* - * 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 <a href="mailto:jason@maven.org">Jason van Zyl</a> - */ -public class ArtifactInstallationException - extends Exception -{ - public ArtifactInstallationException( String message ) - { - super( message ); - } - - public ArtifactInstallationException( Throwable cause ) - { - super( cause ); - } - - public ArtifactInstallationException( String message, - Throwable cause ) - { - super( message, cause ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java deleted file mode 100644 index 376eba20..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.maven.artifact.installer; - -/* - * 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.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * @author <a href="michal@codehaus.org">Michal Maczka</a> - */ -public interface ArtifactInstaller -{ - String ROLE = ArtifactInstaller.class.getName(); - - /** - * Install an artifact from a particular directory. The artifact handler is used to determine - * the filename of the source file. - * - * @param basedir the directory where the artifact is stored - * @param finalName the name of the artifact sans extension - * @param artifact the artifact definition - * @param localRepository the local repository to install into - * @throws ArtifactInstallationException if an error occurred installing the artifact - * @deprecated to be removed before 2.0 after the instlal/deploy plugins use the alternate - * method - */ - @Deprecated - void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository ) - throws ArtifactInstallationException; - - /** - * Install an artifact from a particular file. - * - * @param source the file to install - * @param artifact the artifact definition - * @param localRepository the local repository to install into - * @throws ArtifactInstallationException if an error occurred installing the artifact - */ - void install( File source, Artifact artifact, ArtifactRepository localRepository ) - throws ArtifactInstallationException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java deleted file mode 100644 index a2529757..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.apache.maven.artifact.installer; - -/* - * 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.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.MetadataBridge; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.artifact.ProjectArtifactMetadata; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.installation.InstallRequest; -import org.eclipse.aether.installation.InstallationException; -import org.eclipse.aether.util.artifact.SubArtifact; - -/** - * @author Jason van Zyl - */ -@Component( role = ArtifactInstaller.class ) -public class DefaultArtifactInstaller - extends AbstractLogEnabled - implements ArtifactInstaller -{ - - @Requirement - private RepositorySystem repoSystem; - - @Requirement - private LegacySupport legacySupport; - - /** @deprecated we want to use the artifact method only, and ensure artifact.file is set correctly. */ - @Deprecated - public void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository ) - throws ArtifactInstallationException - { - String extension = artifact.getArtifactHandler().getExtension(); - File source = new File( basedir, finalName + "." + extension ); - - install( source, artifact, localRepository ); - } - - public void install( File source, Artifact artifact, ArtifactRepository localRepository ) - throws ArtifactInstallationException - { - RepositorySystemSession session = - LegacyLocalRepositoryManager.overlay( localRepository, legacySupport.getRepositorySession(), repoSystem ); - - InstallRequest request = new InstallRequest(); - - request.setTrace( RequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) ); - - org.eclipse.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact ); - mainArtifact = mainArtifact.setFile( source ); - request.addArtifact( mainArtifact ); - - for ( ArtifactMetadata metadata : artifact.getMetadataList() ) - { - if ( metadata instanceof ProjectArtifactMetadata ) - { - org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" ); - pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() ); - request.addArtifact( pomArtifact ); - } - else if ( metadata instanceof SnapshotArtifactRepositoryMetadata - || metadata instanceof ArtifactRepositoryMetadata ) - { - // eaten, handled by repo system - } - else - { - request.addMetadata( new MetadataBridge( metadata ) ); - } - } - - try - { - repoSystem.install( session, request ); - } - catch ( InstallationException e ) - { - throw new ArtifactInstallationException( e.getMessage(), e ); - } - - /* - * NOTE: Not used by Maven core, only here to provide backward-compat with plugins like the Install Plugin. - */ - - if ( artifact.isSnapshot() ) - { - Snapshot snapshot = new Snapshot(); - snapshot.setLocalCopy( true ); - artifact.addMetadata( new SnapshotArtifactRepositoryMetadata( artifact, snapshot ) ); - } - - Versioning versioning = new Versioning(); - versioning.updateTimestamp(); - versioning.addVersion( artifact.getBaseVersion() ); - if ( artifact.isRelease() ) - { - versioning.setRelease( artifact.getBaseVersion() ); - } - artifact.addMetadata( new ArtifactRepositoryMetadata( artifact, versioning ) ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java deleted file mode 100644 index 29876e24..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.apache.maven.artifact.manager; - -/* - * 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.repository.ArtifactRepositoryFactory; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.MirrorSelector; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecrypter; -import org.apache.maven.settings.crypto.SettingsDecryptionResult; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; - -@Component( role = WagonManager.class ) -public class DefaultWagonManager - extends org.apache.maven.repository.legacy.DefaultWagonManager - implements WagonManager -{ - - // NOTE: This must use a different field name than in the super class or IoC has no chance to inject the loggers - @Requirement - private Logger log; - - @Requirement - private LegacySupport legacySupport; - - @Requirement - private SettingsDecrypter settingsDecrypter; - - @Requirement - private MirrorSelector mirrorSelector; - - @Requirement - private ArtifactRepositoryFactory artifactRepositoryFactory; - - public AuthenticationInfo getAuthenticationInfo( String id ) - { - MavenSession session = legacySupport.getSession(); - - if ( session != null && id != null ) - { - MavenExecutionRequest request = session.getRequest(); - - if ( request != null ) - { - List<Server> servers = request.getServers(); - - if ( servers != null ) - { - for ( Server server : servers ) - { - if ( id.equalsIgnoreCase( server.getId() ) ) - { - SettingsDecryptionResult result = - settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( server ) ); - server = result.getServer(); - - AuthenticationInfo authInfo = new AuthenticationInfo(); - authInfo.setUserName( server.getUsername() ); - authInfo.setPassword( server.getPassword() ); - authInfo.setPrivateKey( server.getPrivateKey() ); - authInfo.setPassphrase( server.getPassphrase() ); - - return authInfo; - } - } - } - } - } - - // empty one to prevent NPE - return new AuthenticationInfo(); - } - - public ProxyInfo getProxy( String protocol ) - { - MavenSession session = legacySupport.getSession(); - - if ( session != null && protocol != null ) - { - MavenExecutionRequest request = session.getRequest(); - - if ( request != null ) - { - List<Proxy> proxies = request.getProxies(); - - if ( proxies != null ) - { - for ( Proxy proxy : proxies ) - { - if ( proxy.isActive() && protocol.equalsIgnoreCase( proxy.getProtocol() ) ) - { - SettingsDecryptionResult result = - settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( proxy ) ); - proxy = result.getProxy(); - - ProxyInfo proxyInfo = new ProxyInfo(); - proxyInfo.setHost( proxy.getHost() ); - proxyInfo.setType( proxy.getProtocol() ); - proxyInfo.setPort( proxy.getPort() ); - proxyInfo.setNonProxyHosts( proxy.getNonProxyHosts() ); - proxyInfo.setUserName( proxy.getUsername() ); - proxyInfo.setPassword( proxy.getPassword() ); - - return proxyInfo; - } - } - } - } - } - - return null; - } - - public void getArtifact( Artifact artifact, ArtifactRepository repository ) - throws TransferFailedException, ResourceDoesNotExistException - { - getArtifact( artifact, repository, null, false ); - } - - public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories ) - throws TransferFailedException, ResourceDoesNotExistException - { - getArtifact( artifact, remoteRepositories, null, false ); - } - - @Deprecated - public ArtifactRepository getMirrorRepository( ArtifactRepository repository ) - { - - Mirror mirror = mirrorSelector.getMirror( repository, legacySupport.getSession().getSettings().getMirrors() ); - - if ( mirror != null ) - { - String id = mirror.getId(); - if ( id == null ) - { - // TODO: this should be illegal in settings.xml - id = repository.getId(); - } - - log.debug( "Using mirror: " + mirror.getUrl() + " (id: " + id + ")" ); - - repository = artifactRepositoryFactory.createArtifactRepository( id, mirror.getUrl(), - repository.getLayout(), repository.getSnapshots(), - repository.getReleases() ); - } - return repository; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java deleted file mode 100644 index 8065116f..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.maven.artifact.manager; - -/* - * 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 Olivier Lamy - */ -@Deprecated -public class WagonConfigurationException - extends org.apache.maven.repository.legacy.WagonConfigurationException -{ - public WagonConfigurationException( String repositoryId, String message, Throwable cause ) - { - super( repositoryId, message, cause ); - } - - public WagonConfigurationException( String repositoryId, String message ) - { - super( repositoryId, message ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java deleted file mode 100644 index fb7ca8b6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.maven.artifact.manager; - -/* - * 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.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.proxy.ProxyInfo; - -/** - * Manages <a href="http://maven.apache.org/wagon">Wagon</a> related operations in Maven. - * - * @author <a href="michal.maczka@dimatics.com">Michal Maczka </a> - */ -@Deprecated -public interface WagonManager - extends org.apache.maven.repository.legacy.WagonManager -{ - /** - * this method is only here for backward compat (project-info-reports:dependencies) - * the default implementation will return an empty AuthenticationInfo - */ - AuthenticationInfo getAuthenticationInfo( String id ); - - ProxyInfo getProxy( String protocol ); - - void getArtifact( Artifact artifact, ArtifactRepository repository ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories ) - throws TransferFailedException, ResourceDoesNotExistException; - - ArtifactRepository getMirrorRepository( ArtifactRepository repository ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java deleted file mode 100644 index ac18b3ad..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.maven.artifact.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; - -/** @author jdcasey */ -public interface ArtifactRepositoryFactory -{ - String ROLE = ArtifactRepositoryFactory.class.getName(); - - String DEFAULT_LAYOUT_ID = "default"; - - String LOCAL_REPOSITORY_ID = "local"; - - @Deprecated - ArtifactRepositoryLayout getLayout( String layoutId ) - throws UnknownRepositoryLayoutException; - - @Deprecated - ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, - boolean uniqueVersion ); - - ArtifactRepository createArtifactRepository( String id, String url, String layoutId, - ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); - - void setGlobalUpdatePolicy( String snapshotPolicy ); - - void setGlobalChecksumPolicy( String checksumPolicy ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java deleted file mode 100644 index e0a55879..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java +++ /dev/null @@ -1,267 +0,0 @@ -package org.apache.maven.artifact.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.repository.Proxy; -import org.apache.maven.wagon.repository.Repository; - -/** - * This class is an abstraction of the location from/to resources can be - * transfered. - * - * @author <a href="michal.maczka@dimatics.com">Michal Maczka </a> - */ -@Deprecated -public class DefaultArtifactRepository - extends Repository - implements ArtifactRepository -{ - private ArtifactRepositoryLayout layout; - - private ArtifactRepositoryPolicy snapshots; - - private ArtifactRepositoryPolicy releases; - - private boolean blacklisted; - - private Authentication authentication; - - private Proxy proxy; - - private List<ArtifactRepository> mirroredRepositories = Collections.emptyList(); - - /** - * Create a local repository or a test repository. - * - * @param id the unique identifier of the repository - * @param url the URL of the repository - * @param layout the layout of the repository - */ - public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout ) - { - this( id, url, layout, null, null ); - } - - /** - * Create a remote deployment repository. - * - * @param id the unique identifier of the repository - * @param url the URL of the repository - * @param layout the layout of the repository - * @param uniqueVersion whether to assign each snapshot a unique version - */ - public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion ) - { - super( id, url ); - this.layout = layout; - } - - /** - * Create a remote download repository. - * - * @param id the unique identifier of the repository - * @param url the URL of the repository - * @param layout the layout of the repository - * @param snapshots the policies to use for snapshots - * @param releases the policies to use for releases - */ - public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, - ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) - { - super( id, url ); - - this.layout = layout; - - if ( snapshots == null ) - { - snapshots = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); - } - - this.snapshots = snapshots; - - if ( releases == null ) - { - releases = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); - } - - this.releases = releases; - } - - public String pathOf( Artifact artifact ) - { - return layout.pathOf( artifact ); - } - - public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata ) - { - return layout.pathOfRemoteRepositoryMetadata( artifactMetadata ); - } - - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return layout.pathOfLocalRepositoryMetadata( metadata, repository ); - } - - public void setLayout( ArtifactRepositoryLayout layout ) - { - this.layout = layout; - } - - public ArtifactRepositoryLayout getLayout() - { - return layout; - } - - public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy snapshots ) - { - this.snapshots = snapshots; - } - - public ArtifactRepositoryPolicy getSnapshots() - { - return snapshots; - } - - public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy releases ) - { - this.releases = releases; - } - - public ArtifactRepositoryPolicy getReleases() - { - return releases; - } - - public String getKey() - { - return getId(); - } - - public boolean isBlacklisted() - { - return blacklisted; - } - - public void setBlacklisted( boolean blacklisted ) - { - this.blacklisted = blacklisted; - } - - public String toString() - { - StringBuilder sb = new StringBuilder(); - - sb.append( " id: " ).append( getId() ).append( "\n" ); - sb.append( " url: " ).append( getUrl() ).append( "\n" ); - sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" ); - - if ( snapshots != null ) - { - sb.append( "snapshots: [enabled => " ).append( snapshots.isEnabled() ); - sb.append( ", update => " ).append( snapshots.getUpdatePolicy() ).append( "]\n" ); - } - - if ( releases != null ) - { - sb.append( " releases: [enabled => " ).append( releases.isEnabled() ); - sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]\n" ); - } - - return sb.toString(); - } - - public Artifact find( Artifact artifact ) - { - File artifactFile = new File( getBasedir(), pathOf( artifact ) ); - - // We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal - // with multiple local repository implementations yet. - artifact.setFile( artifactFile ); - - if ( artifactFile.exists() ) - { - artifact.setResolved( true ); - } - - return artifact; - } - - public List<String> findVersions( Artifact artifact ) - { - return Collections.emptyList(); - } - - public boolean isProjectAware() - { - return false; - } - - public Authentication getAuthentication() - { - return authentication; - } - - public void setAuthentication( Authentication authentication ) - { - this.authentication = authentication; - } - - public Proxy getProxy() - { - return proxy; - } - - public void setProxy( Proxy proxy ) - { - this.proxy = proxy; - } - - public boolean isUniqueVersion() - { - return true; - } - - public List<ArtifactRepository> getMirroredRepositories() - { - return mirroredRepositories; - } - - public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories ) - { - if ( mirroredRepositories != null ) - { - this.mirroredRepositories = mirroredRepositories; - } - else - { - this.mirroredRepositories = Collections.emptyList(); - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java deleted file mode 100644 index 658dbdac..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.apache.maven.artifact.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.eclipse.aether.RepositorySystemSession; - -/** - * @author jdcasey - */ -@Component( role = ArtifactRepositoryFactory.class ) -public class DefaultArtifactRepositoryFactory - implements ArtifactRepositoryFactory -{ - - @Requirement - private org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory factory; - - @Requirement - private LegacySupport legacySupport; - - @Requirement - private RepositorySystem repositorySystem; - - public ArtifactRepositoryLayout getLayout( String layoutId ) - throws UnknownRepositoryLayoutException - { - return factory.getLayout( layoutId ); - } - - public ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, - boolean uniqueVersion ) - throws UnknownRepositoryLayoutException - { - return injectSession( factory.createDeploymentArtifactRepository( id, url, layoutId, uniqueVersion ), false ); - } - - public ArtifactRepository createDeploymentArtifactRepository( String id, String url, - ArtifactRepositoryLayout repositoryLayout, - boolean uniqueVersion ) - { - return injectSession( factory.createDeploymentArtifactRepository( id, url, repositoryLayout, uniqueVersion ), - false ); - } - - public ArtifactRepository createArtifactRepository( String id, String url, String layoutId, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases ) - throws UnknownRepositoryLayoutException - { - return injectSession( factory.createArtifactRepository( id, url, layoutId, snapshots, releases ), true ); - } - - public ArtifactRepository createArtifactRepository( String id, String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases ) - { - return injectSession( factory.createArtifactRepository( id, url, repositoryLayout, snapshots, releases ), true ); - } - - public void setGlobalUpdatePolicy( String updatePolicy ) - { - factory.setGlobalUpdatePolicy( updatePolicy ); - } - - public void setGlobalChecksumPolicy( String checksumPolicy ) - { - factory.setGlobalChecksumPolicy( checksumPolicy ); - } - - private ArtifactRepository injectSession( ArtifactRepository repository, boolean mirrors ) - { - RepositorySystemSession session = legacySupport.getRepositorySession(); - - if ( session != null && repository != null && !isLocalRepository( repository ) ) - { - List<ArtifactRepository> repositories = Arrays.asList( repository ); - - if ( mirrors ) - { - repositorySystem.injectMirror( session, repositories ); - } - - repositorySystem.injectProxy( session, repositories ); - - repositorySystem.injectAuthentication( session, repositories ); - } - - return repository; - } - - private boolean isLocalRepository( ArtifactRepository repository ) - { - // unfortunately, the API doesn't allow to tell a remote repo and the local repo apart... - return "local".equals( repository.getId() ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java deleted file mode 100644 index 8553a312..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.apache.maven.artifact.repository.layout; - -/* - * 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.codehaus.plexus.component.annotations.Component; - -/** - * The code in this class is taken from DefaultRepositorylayout, located at: - * http://svn.apache.org/viewvc/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java - * - */ -@Component( role = ArtifactRepositoryLayout.class, hint = "flat" ) -public class FlatRepositoryLayout - implements ArtifactRepositoryLayout -{ - private static final char ARTIFACT_SEPARATOR = '-'; - - private static final char GROUP_SEPARATOR = '.'; - - public String getId() - { - return "flat"; - } - - public String pathOf( Artifact artifact ) - { - ArtifactHandler artifactHandler = artifact.getArtifactHandler(); - - StringBuilder path = new StringBuilder( 128 ); - - path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() ); - - if ( artifact.hasClassifier() ) - { - path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() ); - } - - if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) - { - path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() ); - } - - return path.toString(); - } - - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return pathOfRepositoryMetadata( metadata.getLocalFilename( repository ) ); - } - - private String pathOfRepositoryMetadata( String filename ) - { - StringBuilder path = new StringBuilder( 128 ); - - path.append( filename ); - - return path.toString(); - } - - public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) - { - return pathOfRepositoryMetadata( metadata.getRemoteFilename() ); - } - - @Override - public String toString() - { - return getId(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java deleted file mode 100644 index e7937134..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ /dev/null @@ -1,558 +0,0 @@ -package org.apache.maven.artifact.repository.metadata; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.DefaultRepositoryRequest; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; -import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer; -import org.apache.maven.repository.legacy.UpdateCheckManager; -import org.apache.maven.repository.legacy.WagonManager; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.util.IOUtil; -import org.codehaus.plexus.util.ReaderFactory; -import org.codehaus.plexus.util.WriterFactory; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -/** - * @author Jason van Zyl - */ -@Component( role = RepositoryMetadataManager.class ) -public class DefaultRepositoryMetadataManager - extends AbstractLogEnabled - implements RepositoryMetadataManager -{ - @Requirement - private WagonManager wagonManager; - - @Requirement - private UpdateCheckManager updateCheckManager; - - public void resolve( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws RepositoryMetadataResolutionException - { - RepositoryRequest request = new DefaultRepositoryRequest(); - request.setLocalRepository( localRepository ); - request.setRemoteRepositories( remoteRepositories ); - resolve( metadata, request ); - } - - public void resolve( RepositoryMetadata metadata, RepositoryRequest request ) - throws RepositoryMetadataResolutionException - { - ArtifactRepository localRepo = request.getLocalRepository(); - List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories(); - - if ( !request.isOffline() ) - { - Date localCopyLastModified = null; - if ( metadata.getBaseVersion() != null ) - { - localCopyLastModified = getLocalCopyLastModified( localRepo, metadata ); - } - - for ( ArtifactRepository repository : remoteRepositories ) - { - ArtifactRepositoryPolicy policy = metadata.getPolicy( repository ); - - File file = - new File( localRepo.getBasedir(), localRepo.pathOfLocalRepositoryMetadata( metadata, repository ) ); - boolean update; - - if ( !policy.isEnabled() ) - { - update = false; - - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( - "Skipping update check for " + metadata.getKey() + " (" + file - + ") from disabled repository " + repository.getId() + " (" - + repository.getUrl() + ")" ); - } - } - else if ( request.isForceUpdate() ) - { - update = true; - } - else if ( localCopyLastModified != null && !policy.checkOutOfDate( localCopyLastModified ) ) - { - update = false; - - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( - "Skipping update check for " + metadata.getKey() + " (" + file - + ") from repository " + repository.getId() + " (" + repository.getUrl() - + ") in favor of local copy" ); - } - } - else - { - update = updateCheckManager.isUpdateRequired( metadata, repository, file ); - } - - if ( update ) - { - getLogger().info( metadata.getKey() + ": checking for updates from " + repository.getId() ); - try - { - wagonManager.getArtifactMetadata( metadata, repository, file, policy.getChecksumPolicy() ); - } - catch ( ResourceDoesNotExistException e ) - { - getLogger().debug( metadata + " could not be found on repository: " + repository.getId() ); - - // delete the local copy so the old details aren't used. - if ( file.exists() ) - { - if ( !file.delete() ) - { - // sleep for 10ms just in case this is windows holding a file lock - try - { - Thread.sleep( 10 ); - } - catch ( InterruptedException ie ) - { - // ignore - } - file.delete(); // if this fails, forget about it - } - } - } - catch ( TransferFailedException e ) - { - getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId() - + " due to an error: " + e.getMessage() ); - getLogger().debug( "Exception", e ); - } - finally - { - updateCheckManager.touch( metadata, repository, file ); - } - } - - // TODO: should this be inside the above check? - // touch file so that this is not checked again until interval has passed - if ( file.exists() ) - { - file.setLastModified( System.currentTimeMillis() ); - } - } - } - - try - { - mergeMetadata( metadata, remoteRepositories, localRepo ); - } - catch ( RepositoryMetadataStoreException e ) - { - throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: " - + e.getMessage(), e ); - } - } - - private Date getLocalCopyLastModified( ArtifactRepository localRepository, RepositoryMetadata metadata ) - { - String metadataPath = localRepository.pathOfLocalRepositoryMetadata( metadata, localRepository ); - File metadataFile = new File( localRepository.getBasedir(), metadataPath ); - return metadataFile.isFile() ? new Date( metadataFile.lastModified() ) : null; - } - - private void mergeMetadata( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws RepositoryMetadataStoreException - { - // TODO: currently this is first wins, but really we should take the latest by comparing either the - // snapshot timestamp, or some other timestamp later encoded into the metadata. - // TODO: this needs to be repeated here so the merging doesn't interfere with the written metadata - // - we'd be much better having a pristine input, and an ongoing metadata for merging instead - - Map<ArtifactRepository, Metadata> previousMetadata = new HashMap<ArtifactRepository, Metadata>(); - ArtifactRepository selected = null; - for ( ArtifactRepository repository : remoteRepositories ) - { - ArtifactRepositoryPolicy policy = metadata.getPolicy( repository ); - - if ( policy.isEnabled() && loadMetadata( metadata, repository, localRepository, previousMetadata ) ) - { - metadata.setRepository( repository ); - selected = repository; - } - } - if ( loadMetadata( metadata, localRepository, localRepository, previousMetadata ) ) - { - metadata.setRepository( null ); - selected = localRepository; - } - - updateSnapshotMetadata( metadata, previousMetadata, selected, localRepository ); - } - - private void updateSnapshotMetadata( RepositoryMetadata metadata, - Map<ArtifactRepository, Metadata> previousMetadata, - ArtifactRepository selected, ArtifactRepository localRepository ) - throws RepositoryMetadataStoreException - { - // TODO: this could be a lot nicer... should really be in the snapshot transformation? - if ( metadata.isSnapshot() ) - { - Metadata prevMetadata = metadata.getMetadata(); - - for ( ArtifactRepository repository : previousMetadata.keySet() ) - { - Metadata m = previousMetadata.get( repository ); - if ( repository.equals( selected ) ) - { - if ( m.getVersioning() == null ) - { - m.setVersioning( new Versioning() ); - } - - if ( m.getVersioning().getSnapshot() == null ) - { - m.getVersioning().setSnapshot( new Snapshot() ); - } - } - else - { - if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null ) - && m.getVersioning().getSnapshot().isLocalCopy() ) - { - m.getVersioning().getSnapshot().setLocalCopy( false ); - metadata.setMetadata( m ); - metadata.storeInLocalRepository( localRepository, repository ); - } - } - } - - metadata.setMetadata( prevMetadata ); - } - } - - private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository, - ArtifactRepository localRepository, Map<ArtifactRepository, - Metadata> previousMetadata ) - { - boolean setRepository = false; - - File metadataFile = - new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata, - remoteRepository ) ); - - if ( metadataFile.exists() ) - { - Metadata metadata; - - try - { - metadata = readMetadata( metadataFile ); - } - catch ( RepositoryMetadataReadException e ) - { - if ( getLogger().isDebugEnabled() ) - { - getLogger().warn( e.getMessage(), e ); - } - else - { - getLogger().warn( e.getMessage() ); - } - return setRepository; - } - - if ( repoMetadata.isSnapshot() && ( previousMetadata != null ) ) - { - previousMetadata.put( remoteRepository, metadata ); - } - - if ( repoMetadata.getMetadata() != null ) - { - setRepository = repoMetadata.getMetadata().merge( metadata ); - } - else - { - repoMetadata.setMetadata( metadata ); - setRepository = true; - } - } - return setRepository; - } - - /** @todo share with DefaultPluginMappingManager. */ - protected Metadata readMetadata( File mappingFile ) - throws RepositoryMetadataReadException - { - Metadata result; - - Reader reader = null; - try - { - reader = ReaderFactory.newXmlReader( mappingFile ); - - MetadataXpp3Reader mappingReader = new MetadataXpp3Reader(); - - result = mappingReader.read( reader, false ); - } - catch ( FileNotFoundException e ) - { - throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "'", e ); - } - catch ( IOException e ) - { - throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " - + e.getMessage(), e ); - } - catch ( XmlPullParserException e ) - { - throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " - + e.getMessage(), e ); - } - finally - { - IOUtil.close( reader ); - } - - return result; - } - - /** - * Ensures the last updated timestamp of the specified metadata does not refer to the future and fixes the local - * metadata if necessary to allow proper merging/updating of metadata during deployment. - */ - private void fixTimestamp( File metadataFile, Metadata metadata, Metadata reference ) - { - boolean changed = false; - - if ( metadata != null && reference != null ) - { - Versioning versioning = metadata.getVersioning(); - Versioning versioningRef = reference.getVersioning(); - if ( versioning != null && versioningRef != null ) - { - String lastUpdated = versioning.getLastUpdated(); - String now = versioningRef.getLastUpdated(); - if ( lastUpdated != null && now != null && now.compareTo( lastUpdated ) < 0 ) - { - getLogger().warn( - "The last updated timestamp in " + metadataFile + " refers to the future (now = " - + now + ", lastUpdated = " + lastUpdated - + "). Please verify that the clocks of all" - + " deploying machines are reasonably synchronized." ); - versioning.setLastUpdated( now ); - changed = true; - } - } - } - - if ( changed ) - { - getLogger().debug( "Repairing metadata in " + metadataFile ); - - Writer writer = null; - try - { - writer = WriterFactory.newXmlWriter( metadataFile ); - new MetadataXpp3Writer().write( writer, metadata ); - } - catch ( IOException e ) - { - String msg = "Could not write fixed metadata to " + metadataFile + ": " + e.getMessage(); - if ( getLogger().isDebugEnabled() ) - { - getLogger().warn( msg, e ); - } - else - { - getLogger().warn( msg ); - } - } - finally - { - IOUtil.close( writer ); - } - } - } - - public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, - ArtifactRepository remoteRepository ) - throws RepositoryMetadataResolutionException - { - File file; - try - { - file = getArtifactMetadataFromDeploymentRepository( metadata, localRepository, remoteRepository ); - } - catch ( TransferFailedException e ) - { - throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: " - + remoteRepository.getId() + " due to an error: " + e.getMessage(), e ); - } - - try - { - if ( file.exists() ) - { - Metadata prevMetadata = readMetadata( file ); - metadata.setMetadata( prevMetadata ); - } - } - catch ( RepositoryMetadataReadException e ) - { - throw new RepositoryMetadataResolutionException( e.getMessage(), e ); - } - } - - private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, - ArtifactRepository localRepo, - ArtifactRepository remoteRepository ) - throws TransferFailedException - { - File file = - new File( localRepo.getBasedir(), localRepo.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) ); - - try - { - wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN ); - } - catch ( ResourceDoesNotExistException e ) - { - getLogger().info( metadata + " could not be found on repository: " + remoteRepository.getId() - + ", so will be created" ); - - // delete the local copy so the old details aren't used. - if ( file.exists() ) - { - if ( !file.delete() ) - { - // sleep for 10ms just in case this is windows holding a file lock - try - { - Thread.sleep( 10 ); - } - catch ( InterruptedException ie ) - { - // ignore - } - file.delete(); // if this fails, forget about it - } - } - } - finally - { - if ( metadata instanceof RepositoryMetadata ) - { - updateCheckManager.touch( (RepositoryMetadata) metadata, remoteRepository, file ); - } - } - return file; - } - - public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, - ArtifactRepository deploymentRepository ) - throws RepositoryMetadataDeploymentException - { - File file; - if ( metadata instanceof RepositoryMetadata ) - { - getLogger().info( "Retrieving previous metadata from " + deploymentRepository.getId() ); - try - { - file = getArtifactMetadataFromDeploymentRepository( metadata, localRepository, deploymentRepository ); - } - catch ( TransferFailedException e ) - { - throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: " - + deploymentRepository.getId() + " due to an error: " + e.getMessage(), e ); - } - - if ( file.isFile() ) - { - try - { - fixTimestamp( file, readMetadata( file ), ( (RepositoryMetadata) metadata ).getMetadata() ); - } - catch ( RepositoryMetadataReadException e ) - { - // will be reported via storeInlocalRepository - } - } - } - else - { - // It's a POM - we don't need to retrieve it first - file = - new File( localRepository.getBasedir(), - localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) ); - } - - try - { - metadata.storeInLocalRepository( localRepository, deploymentRepository ); - } - catch ( RepositoryMetadataStoreException e ) - { - throw new RepositoryMetadataDeploymentException( "Error installing metadata: " + e.getMessage(), e ); - } - - try - { - wagonManager.putArtifactMetadata( file, metadata, deploymentRepository ); - } - catch ( TransferFailedException e ) - { - throw new RepositoryMetadataDeploymentException( "Error while deploying metadata: " + e.getMessage(), e ); - } - } - - public void install( ArtifactMetadata metadata, ArtifactRepository localRepository ) - throws RepositoryMetadataInstallationException - { - try - { - metadata.storeInLocalRepository( localRepository, localRepository ); - } - catch ( RepositoryMetadataStoreException e ) - { - throw new RepositoryMetadataInstallationException( "Error installing metadata: " + e.getMessage(), e ); - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java deleted file mode 100644 index 490b47f3..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.apache.maven.artifact.repository.metadata; - -/* - * 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.repository.ArtifactRepository; - -import java.util.Iterator; -import java.util.List; - -/** - * Metadata for the group directory of the repository. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class GroupRepositoryMetadata - extends AbstractRepositoryMetadata -{ - private final String groupId; - - public GroupRepositoryMetadata( String groupId ) - { - super( new Metadata() ); - this.groupId = groupId; - } - - public boolean storedInGroupDirectory() - { - return true; - } - - public boolean storedInArtifactVersionDirectory() - { - return false; - } - - public String getGroupId() - { - return groupId; - } - - public String getArtifactId() - { - return null; - } - - public String getBaseVersion() - { - return null; - } - - public void addPluginMapping( String goalPrefix, - String artifactId ) - { - addPluginMapping( goalPrefix, artifactId, artifactId ); - } - - public void addPluginMapping( String goalPrefix, - String artifactId, - String name ) - { - List plugins = getMetadata().getPlugins(); - boolean found = false; - for ( Iterator i = plugins.iterator(); i.hasNext() && !found; ) - { - Plugin plugin = (Plugin) i.next(); - if ( plugin.getPrefix().equals( goalPrefix ) ) - { - found = true; - } - } - if ( !found ) - { - Plugin plugin = new Plugin(); - plugin.setPrefix( goalPrefix ); - plugin.setArtifactId( artifactId ); - plugin.setName( name ); - - - getMetadata().addPlugin( plugin ); - } - } - - public Object getKey() - { - return groupId; - } - - public boolean isSnapshot() - { - return false; - } - - public ArtifactRepository getRepository() - { - return null; - } - - public void setRepository( ArtifactRepository remoteRepository ) - { - // intentionally blank - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java deleted file mode 100644 index bf199218..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.apache.maven.artifact.repository.metadata; - -/* - * 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.Collections; -import java.util.Map; - -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.codehaus.plexus.util.FileUtils; -import org.eclipse.aether.RepositoryException; -import org.eclipse.aether.metadata.AbstractMetadata; -import org.eclipse.aether.metadata.MergeableMetadata; -import org.eclipse.aether.metadata.Metadata; - -/** - * <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 final class MetadataBridge - extends AbstractMetadata - implements MergeableMetadata -{ - - private ArtifactMetadata metadata; - - private boolean merged; - - public MetadataBridge( ArtifactMetadata metadata ) - { - this.metadata = metadata; - } - - public void merge( File current, File result ) - throws RepositoryException - { - try - { - if ( current.exists() ) - { - FileUtils.copyFile( current, result ); - } - ArtifactRepository localRepo = new MetadataRepository( result ); - metadata.storeInLocalRepository( localRepo, localRepo ); - merged = true; - } - catch ( Exception e ) - { - throw new RepositoryException( e.getMessage(), e ); - } - } - - public boolean isMerged() - { - return merged; - } - - public String getGroupId() - { - return emptify( metadata.getGroupId() ); - } - - public String getArtifactId() - { - return metadata.storedInGroupDirectory() ? "" : emptify( metadata.getArtifactId() ); - } - - public String getVersion() - { - return metadata.storedInArtifactVersionDirectory() ? emptify( metadata.getBaseVersion() ) : ""; - } - - public String getType() - { - return metadata.getRemoteFilename(); - } - - private String emptify( String string ) - { - return ( string != null ) ? string : ""; - } - - public File getFile() - { - return null; - } - - public MetadataBridge setFile( File file ) - { - return this; - } - - public Nature getNature() - { - if ( metadata instanceof RepositoryMetadata ) - { - switch ( ( (RepositoryMetadata) metadata ).getNature() ) - { - case RepositoryMetadata.RELEASE_OR_SNAPSHOT: - return Nature.RELEASE_OR_SNAPSHOT; - case RepositoryMetadata.SNAPSHOT: - return Nature.SNAPSHOT; - default: - return Nature.RELEASE; - } - } - else - { - return Nature.RELEASE; - } - } - - public Map<String, String> getProperties() - { - return Collections.emptyMap(); - } - - @Override - public Metadata setProperties( Map<String, String> properties ) - { - return this; - } - - @SuppressWarnings( "deprecation" ) - static class MetadataRepository - extends DefaultArtifactRepository - { - - private File metadataFile; - - public MetadataRepository( File metadataFile ) - { - super( "local", "", null ); - this.metadataFile = metadataFile; - } - - @Override - public String getBasedir() - { - return metadataFile.getParent(); - } - - @Override - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return metadataFile.getName(); - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java deleted file mode 100644 index bdc4a795..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.artifact.repository.metadata; - -/* - * 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. - */ - -/** - * Assists in handling repository metadata. - * - * @author Benjamin Bentmann - */ -class MetadataUtils -{ - - public static Metadata cloneMetadata( Metadata src ) - { - if ( src == null ) - { - return null; - } - return src.clone(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java deleted file mode 100644 index 23e59841..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.artifact.repository.metadata; - -/* - * 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. - */ - -/** - * Problem storing the repository metadata in the local repository. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class RepositoryMetadataReadException - extends Exception -{ - public RepositoryMetadataReadException( String message ) - { - super( message ); - } - - public RepositoryMetadataReadException( String message, - Exception e ) - { - super( message, e ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java deleted file mode 100644 index 359ab2ce..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.apache.maven.artifact.repository.metadata; - -/* - * 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.repository.ArtifactRepository; - -/** - * Metadata for the artifact version directory of the repository. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @todo split instantiation (versioning, plugin mappings) from definition - */ -public class SnapshotArtifactRepositoryMetadata - extends AbstractRepositoryMetadata -{ - private Artifact artifact; - - public SnapshotArtifactRepositoryMetadata( Artifact artifact ) - { - super( createMetadata( artifact, null ) ); - this.artifact = artifact; - } - - public SnapshotArtifactRepositoryMetadata( Artifact artifact, - Snapshot snapshot ) - { - super( createMetadata( artifact, createVersioning( snapshot ) ) ); - this.artifact = artifact; - } - - public boolean storedInGroupDirectory() - { - return false; - } - - public boolean storedInArtifactVersionDirectory() - { - return true; - } - - public String getGroupId() - { - return artifact.getGroupId(); - } - - public String getArtifactId() - { - return artifact.getArtifactId(); - } - - public String getBaseVersion() - { - return artifact.getBaseVersion(); - } - - public Object getKey() - { - return "snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion(); - } - - public boolean isSnapshot() - { - return artifact.isSnapshot(); - } - - public int getNature() - { - return isSnapshot() ? SNAPSHOT : RELEASE; - } - - public ArtifactRepository getRepository() - { - return artifact.getRepository(); - } - - public void setRepository( ArtifactRepository remoteRepository ) - { - artifact.setRepository( remoteRepository ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java deleted file mode 100644 index 5ef86022..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; - -@Deprecated -public interface ArtifactCollector - extends org.apache.maven.repository.legacy.resolver.LegacyArtifactCollector -{ - - @Deprecated - ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ) - throws ArtifactResolutionException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java deleted file mode 100644 index 0ca940a1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.wagon.events.TransferListener; - -/** - * @author Jason van Zyl - */ -// Just hide the one method we want behind the RepositorySystem interface. -public interface ArtifactResolver -{ - - ArtifactResolutionResult resolve( ArtifactResolutionRequest request ); - - // The rest is deprecated - - // USED BY MAVEN ASSEMBLY PLUGIN 2.2-beta-2 - @Deprecated - String ROLE = ArtifactResolver.class.getName(); - - // USED BY SUREFIRE, DEPENDENCY PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY MAVEN ASSEMBLY PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY MAVEN ASSEMBLY PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - @Deprecated - ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, ArtifactMetadataSource source ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - @Deprecated - ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - @Deprecated - ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, ArtifactMetadataSource source, - List<ResolutionListener> listeners ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY REMOTE RESOURCES PLUGIN, DEPENDENCY PLUGIN - @Deprecated - void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY REMOTE RESOURCES PLUGIN - @Deprecated - void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository, - TransferListener downloadMonitor ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY DEPENDENCY PLUGIN, ARCHETYPE DOWNLOADER - @Deprecated - void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java deleted file mode 100644 index b066e4c0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * 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.HashSet; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.plexus.logging.Logger; - -/** - * Send resolution events to the debug log. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class DebugResolutionListener - implements ResolutionListener, ResolutionListenerForDepMgmt -{ - private Logger logger; - - private String indent = ""; - - private static Set<Artifact> ignoredArtifacts = new HashSet<Artifact>(); - - public DebugResolutionListener( Logger logger ) - { - this.logger = logger; - } - - public void testArtifact( Artifact node ) - { - } - - public void startProcessChildren( Artifact artifact ) - { - indent += " "; - } - - public void endProcessChildren( Artifact artifact ) - { - indent = indent.substring( 2 ); - } - - public void includeArtifact( Artifact artifact ) - { - logger.debug( indent + artifact + " (selected for " + artifact.getScope() + ")" ); - } - - public void omitForNearer( Artifact omitted, Artifact kept ) - { - String omittedVersion = omitted.getVersion(); - String keptVersion = kept.getVersion(); - - if ( omittedVersion != null ? !omittedVersion.equals( keptVersion ) : keptVersion != null ) - { - logger.debug( indent + omitted + " (removed - nearer found: " + kept.getVersion() + ")" ); - } - } - - public void omitForCycle( Artifact omitted ) - { - logger.debug( indent + omitted + " (removed - causes a cycle in the graph)" ); - } - - public void updateScopeCurrentPom( Artifact artifact, String ignoredScope ) - { - logger.debug( indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope " - + artifact.getScope() + " wins)" ); - - // TODO: better way than static? this might hide messages in a reactor - if ( !ignoredArtifacts.contains( artifact ) ) - { - logger.warn( "\n\tArtifact " + artifact + " retains local artifactScope '" + artifact.getScope() - + "' overriding broader artifactScope '" + ignoredScope + "'\n" - + "\tgiven by a dependency. If this is not intended, modify or remove the local artifactScope.\n" ); - ignoredArtifacts.add( artifact ); - } - } - - public void updateScope( Artifact artifact, String scope ) - { - logger.debug( indent + artifact + " (setting artifactScope to: " + scope + ")" ); - } - - public void selectVersionFromRange( Artifact artifact ) - { - logger.debug( indent + artifact + " (setting version to: " + artifact.getVersion() + " from range: " - + artifact.getVersionRange() + ")" ); - } - - public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange ) - { - logger.debug( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: " - + replacement.getVersionRange() + " to: " + newRange + " )" ); - } - - /** - * The logic used here used to be a copy of the logic used in the DefaultArtifactCollector, and this method was - * called right before the actual version/artifactScope changes were done. However, a different set of conditionals (and - * more information) is needed to be able to determine when and if the version and/or artifactScope changes. See the two - * added methods, manageArtifactVersion and manageArtifactScope. - */ - public void manageArtifact( Artifact artifact, Artifact replacement ) - { - String msg = indent + artifact; - msg += " ("; - if ( replacement.getVersion() != null ) - { - msg += "applying version: " + replacement.getVersion() + ";"; - } - if ( replacement.getScope() != null ) - { - msg += "applying artifactScope: " + replacement.getScope(); - } - msg += ")"; - logger.debug( msg ); - } - - public void manageArtifactVersion( Artifact artifact, Artifact replacement ) - { - // only show msg if a change is actually taking place - if ( !replacement.getVersion().equals( artifact.getVersion() ) ) - { - String msg = indent + artifact + " (applying version: " + replacement.getVersion() + ")"; - logger.debug( msg ); - } - } - - public void manageArtifactScope( Artifact artifact, Artifact replacement ) - { - // only show msg if a change is actually taking place - if ( !replacement.getScope().equals( artifact.getScope() ) ) - { - String msg = indent + artifact + " (applying artifactScope: " + replacement.getScope() + ")"; - logger.debug( msg ); - } - } - - public void manageArtifactSystemPath( Artifact artifact, Artifact replacement ) - { - // only show msg if a change is actually taking place - if ( !replacement.getScope().equals( artifact.getScope() ) ) - { - String msg = indent + artifact + " (applying system path: " + replacement.getFile() + ")"; - logger.debug( msg ); - } - } - -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java deleted file mode 100644 index cefb9e28..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * 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.codehaus.plexus.component.annotations.Component; - -@Deprecated -@Component( role = ArtifactCollector.class ) -public class DefaultArtifactCollector - extends org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector - implements ArtifactCollector -{ -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java deleted file mode 100644 index 1631a013..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ /dev/null @@ -1,643 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * 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.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.regex.Matcher; - -import org.apache.maven.RepositoryUtils; -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.LegacyLocalRepositoryManager; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; -import org.apache.maven.wagon.events.TransferListener; -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.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResult; - -/** - * @author Jason van Zyl - */ -@Component( role = ArtifactResolver.class ) -public class DefaultArtifactResolver - implements ArtifactResolver, Disposable -{ - @Requirement - private Logger logger; - - @Requirement - protected ArtifactFactory artifactFactory; - - @Requirement - private ArtifactCollector artifactCollector; - - @Requirement - private ResolutionErrorHandler resolutionErrorHandler; - - @Requirement - private ArtifactMetadataSource source; - - @Requirement - private PlexusContainer container; - - @Requirement - private LegacySupport legacySupport; - - @Requirement - private RepositorySystem repoSystem; - - private final Executor executor; - - public DefaultArtifactResolver() - { - int threads = Integer.getInteger( "maven.artifact.threads", 5 ); - if ( threads <= 1 ) - { - executor = new Executor() - { - public void execute( Runnable command ) - { - command.run(); - } - }; - } - else - { - executor = - new ThreadPoolExecutor( threads, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), - new DaemonThreadCreator() ); - } - } - - private RepositorySystemSession getSession( ArtifactRepository localRepository ) - { - return LegacyLocalRepositoryManager.overlay( localRepository, legacySupport.getRepositorySession(), repoSystem ); - } - - private void injectSession1( RepositoryRequest request, MavenSession session ) - { - if ( session != null ) - { - request.setOffline( session.isOffline() ); - request.setForceUpdate( session.getRequest().isUpdateSnapshots() ); - } - } - - private void injectSession2( ArtifactResolutionRequest request, MavenSession session ) - { - injectSession1( request, session ); - - if ( session != null ) - { - request.setServers( session.getRequest().getServers() ); - request.setMirrors( session.getRequest().getMirrors() ); - request.setProxies( session.getRequest().getProxies() ); - } - } - - public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, TransferListener resolutionListener ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - resolve( artifact, remoteRepositories, getSession( localRepository ) ); - } - - public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - resolve( artifact, remoteRepositories, getSession( localRepository ) ); - } - - private void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, - RepositorySystemSession session ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - if ( artifact == null ) - { - return; - } - - if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) ) - { - File systemFile = artifact.getFile(); - - if ( systemFile == null ) - { - throw new ArtifactNotFoundException( "System artifact: " + artifact + " has no file attached", artifact ); - } - - if ( !systemFile.exists() ) - { - throw new ArtifactNotFoundException( "System artifact: " + artifact + " not found in path: " + systemFile, artifact ); - } - - if ( !systemFile.isFile() ) - { - throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile, artifact ); - } - - artifact.setResolved( true ); - - return; - } - - if ( !artifact.isResolved() ) - { - ArtifactResult result; - - try - { - ArtifactRequest artifactRequest = new ArtifactRequest(); - artifactRequest.setArtifact( RepositoryUtils.toArtifact( artifact ) ); - artifactRequest.setRepositories( RepositoryUtils.toRepos( remoteRepositories ) ); - - // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not - LocalRepositoryManager lrm = session.getLocalRepositoryManager(); - String path = lrm.getPathForLocalArtifact( artifactRequest.getArtifact() ); - artifact.setFile( new File( lrm.getRepository().getBasedir(), path ) ); - - result = repoSystem.resolveArtifact( session, artifactRequest ); - } - catch ( org.eclipse.aether.resolution.ArtifactResolutionException e ) - { - if ( e.getCause() instanceof org.eclipse.aether.transfer.ArtifactNotFoundException ) - { - throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e ); - } - else - { - throw new ArtifactResolutionException( e.getMessage(), artifact, remoteRepositories, e ); - } - } - - artifact.selectVersion( result.getArtifact().getVersion() ); - artifact.setFile( result.getArtifact().getFile() ); - artifact.setResolved( true ); - - if ( artifact.isSnapshot() ) - { - Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() ); - if ( matcher.matches() ) - { - Snapshot snapshot = new Snapshot(); - snapshot.setTimestamp( matcher.group( 2 ) ); - try - { - snapshot.setBuildNumber( Integer.parseInt( matcher.group( 3 ) ) ); - artifact.addMetadata( new SnapshotArtifactRepositoryMetadata( artifact, snapshot ) ); - } - catch ( NumberFormatException e ) - { - logger.warn( "Invalid artifact version " + artifact.getVersion() + ": " + e.getMessage() ); - } - } - } - } - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, - remoteRepositories, source, filter ); - - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, - remoteRepositories, source, null ); - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, - remoteRepositories, source, filter, null ); - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null ); - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source, - List<ResolutionListener> listeners ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, - remoteRepositories, source, null, listeners ); - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, - remoteRepositories, source, filter, listeners, null ); - } - - public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners, - List<ConflictResolver> conflictResolvers ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - ArtifactResolutionRequest request = new ArtifactResolutionRequest() - .setArtifact( originatingArtifact ) - .setResolveRoot( false ) - // This is required by the surefire plugin - .setArtifactDependencies( artifacts ) - .setManagedVersionMap( managedVersions ) - .setLocalRepository( localRepository ) - .setRemoteRepositories( remoteRepositories ) - .setCollectionFilter( filter ) - .setListeners( listeners ); - - injectSession2( request, legacySupport.getSession() ); - - return resolveWithExceptions( request ); - } - - public ArtifactResolutionResult resolveWithExceptions( ArtifactResolutionRequest request ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - ArtifactResolutionResult result = resolve( request ); - - // We have collected all the problems so let's mimic the way the old code worked and just blow up right here. - // That's right lets just let it rip right here and send a big incomprehensible blob of text at unsuspecting - // users. Bad dog! - - resolutionErrorHandler.throwErrors( request, result ); - - return result; - } - - // ------------------------------------------------------------------------ - // - // ------------------------------------------------------------------------ - - public ArtifactResolutionResult resolve( ArtifactResolutionRequest request ) - { - Artifact rootArtifact = request.getArtifact(); - Set<Artifact> artifacts = request.getArtifactDependencies(); - Map<String, Artifact> managedVersions = request.getManagedVersionMap(); - List<ResolutionListener> listeners = request.getListeners(); - ArtifactFilter collectionFilter = request.getCollectionFilter(); - ArtifactFilter resolutionFilter = request.getResolutionFilter(); - RepositorySystemSession session = getSession( request.getLocalRepository() ); - - //TODO: hack because metadata isn't generated in m2e correctly and i want to run the maven i have in the workspace - if ( source == null ) - { - try - { - source = container.lookup( ArtifactMetadataSource.class ); - } - catch ( ComponentLookupException e ) - { - // won't happen - } - } - - if ( listeners == null ) - { - listeners = new ArrayList<ResolutionListener>(); - - if ( logger.isDebugEnabled() ) - { - listeners.add( new DebugResolutionListener( logger ) ); - } - - listeners.add( new WarningResolutionListener( logger ) ); - } - - ArtifactResolutionResult result = new ArtifactResolutionResult(); - - // The root artifact may, or may not be resolved so we need to check before we attempt to resolve. - // This is often an artifact like a POM that is taken from disk and we already have hold of the - // file reference. But this may be a Maven Plugin that we need to resolve from a remote repository - // as well as its dependencies. - - if ( request.isResolveRoot() /* && rootArtifact.getFile() == null */ ) - { - try - { - resolve( rootArtifact, request.getRemoteRepositories(), session ); - } - catch ( ArtifactResolutionException e ) - { - result.addErrorArtifactException( e ); - return result; - } - catch ( ArtifactNotFoundException e ) - { - result.addMissingArtifact( request.getArtifact() ); - return result; - } - } - - ArtifactResolutionRequest collectionRequest = request; - - if ( request.isResolveTransitively() ) - { - MetadataResolutionRequest metadataRequest = new DefaultMetadataResolutionRequest( request ); - - metadataRequest.setArtifact( rootArtifact ); - metadataRequest.setResolveManagedVersions( managedVersions == null ); - - try - { - ResolutionGroup resolutionGroup = source.retrieve( metadataRequest ); - - if ( managedVersions == null ) - { - managedVersions = resolutionGroup.getManagedVersions(); - } - - Set<Artifact> directArtifacts = resolutionGroup.getArtifacts(); - - if ( artifacts == null || artifacts.isEmpty() ) - { - artifacts = directArtifacts; - } - else - { - List<Artifact> allArtifacts = new ArrayList<Artifact>(); - allArtifacts.addAll( artifacts ); - allArtifacts.addAll( directArtifacts ); - - Map<String, Artifact> mergedArtifacts = new LinkedHashMap<String, Artifact>(); - for ( Artifact artifact : allArtifacts ) - { - String conflictId = artifact.getDependencyConflictId(); - if ( !mergedArtifacts.containsKey( conflictId ) ) - { - mergedArtifacts.put( conflictId, artifact ); - } - } - - artifacts = new LinkedHashSet<Artifact>( mergedArtifacts.values() ); - } - - collectionRequest = new ArtifactResolutionRequest( request ); - collectionRequest.setServers( request.getServers() ); - collectionRequest.setMirrors( request.getMirrors() ); - collectionRequest.setProxies( request.getProxies() ); - collectionRequest.setRemoteRepositories( resolutionGroup.getResolutionRepositories() ); - } - catch ( ArtifactMetadataRetrievalException e ) - { - ArtifactResolutionException are = - new ArtifactResolutionException( "Unable to get dependency information for " + rootArtifact.getId() - + ": " + e.getMessage(), rootArtifact, metadataRequest.getRemoteRepositories(), e ); - result.addMetadataResolutionException( are ); - return result; - } - } - - if ( artifacts == null || artifacts.isEmpty() ) - { - if ( request.isResolveRoot() ) - { - result.addArtifact( rootArtifact ); - } - return result; - } - - // After the collection we will have the artifact object in the result but they will not be resolved yet. - result = - artifactCollector.collect( artifacts, rootArtifact, managedVersions, collectionRequest, source, - collectionFilter, listeners, null ); - - // We have metadata retrieval problems, or there are cycles that have been detected - // so we give this back to the calling code and let them deal with this information - // appropriately. - - if ( result.hasMetadataResolutionExceptions() || result.hasVersionRangeViolations() || result.hasCircularDependencyExceptions() ) - { - return result; - } - - if ( result.getArtifactResolutionNodes() != null ) - { - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - - CountDownLatch latch = new CountDownLatch( result.getArtifactResolutionNodes().size() ); - - for ( ResolutionNode node : result.getArtifactResolutionNodes() ) - { - Artifact artifact = node.getArtifact(); - - if ( resolutionFilter == null || resolutionFilter.include( artifact ) ) - { - executor.execute( new ResolveTask( classLoader, latch, artifact, session, - node.getRemoteRepositories(), result ) ); - } - else - { - latch.countDown(); - } - } - try - { - latch.await(); - } - catch ( InterruptedException e ) - { - result.addErrorArtifactException( new ArtifactResolutionException( "Resolution interrupted", - rootArtifact, e ) ); - } - } - - // We want to send the root artifact back in the result but we need to do this after the other dependencies - // have been resolved. - if ( request.isResolveRoot() ) - { - // Add the root artifact (as the first artifact to retain logical order of class path!) - Set<Artifact> allArtifacts = new LinkedHashSet<Artifact>(); - allArtifacts.add( rootArtifact ); - allArtifacts.addAll( result.getArtifacts() ); - result.setArtifacts( allArtifacts ); - } - - return result; - } - - public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - resolve( artifact, remoteRepositories, localRepository, null ); - } - - /** - * ThreadCreator for creating daemon threads with fixed ThreadGroup-name. - */ - static final class DaemonThreadCreator - implements ThreadFactory - { - static final String THREADGROUP_NAME = "org.apache.maven.artifact.resolver.DefaultArtifactResolver"; - - static final ThreadGroup GROUP = new ThreadGroup( THREADGROUP_NAME ); - - static final AtomicInteger THREAD_NUMBER = new AtomicInteger( 1 ); - - public Thread newThread( Runnable r ) - { - Thread newThread = new Thread( GROUP, r, "resolver-" + THREAD_NUMBER.getAndIncrement() ); - newThread.setDaemon( true ); - newThread.setContextClassLoader( null ); - return newThread; - } - } - - private class ResolveTask - implements Runnable - { - - private final ClassLoader classLoader; - - private final CountDownLatch latch; - - private final Artifact artifact; - - private final RepositorySystemSession session; - - private final List<ArtifactRepository> remoteRepositories; - - private final ArtifactResolutionResult result; - - public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact, RepositorySystemSession session, - List<ArtifactRepository> remoteRepositories, ArtifactResolutionResult result ) - { - this.classLoader = classLoader; - this.latch = latch; - this.artifact = artifact; - this.session = session; - this.remoteRepositories = remoteRepositories; - this.result = result; - } - - public void run() - { - ClassLoader old = Thread.currentThread().getContextClassLoader(); - try - { - Thread.currentThread().setContextClassLoader( classLoader ); - resolve( artifact, remoteRepositories, session ); - } - catch ( ArtifactNotFoundException anfe ) - { - // These are cases where the artifact just isn't present in any of the remote repositories - // because it wasn't deployed, or it was deployed in the wrong place. - - synchronized ( result ) - { - result.addMissingArtifact( artifact ); - } - } - catch ( ArtifactResolutionException e ) - { - // This is really a wagon TransferFailedException so something went wrong after we successfully - // retrieved the metadata. - - synchronized ( result ) - { - result.addErrorArtifactException( e ); - } - } - finally - { - latch.countDown(); - Thread.currentThread().setContextClassLoader( old ); - - } - } - - } - - @Override - public void dispose() - { - if ( executor instanceof ExecutorService ) - { - ( (ExecutorService) executor ).shutdownNow(); - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java deleted file mode 100644 index 06da7e3e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * 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; - -/** - * Do not use! - * <p/> - * Should only be implmemented by DebugResolutionListener. Remove this - * when the ResolutionListener interface deprecation of the manageArtifact - * method (and the [yet to be done] addition of these methods to that - * interface) has had a chance to propagate to all interested plugins. - */ -@Deprecated -public interface ResolutionListenerForDepMgmt -{ - void manageArtifactVersion( Artifact artifact, - Artifact replacement ); - - void manageArtifactScope( Artifact artifact, - Artifact replacement ); - - void manageArtifactSystemPath( Artifact artifact, - Artifact replacement ); -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java deleted file mode 100644 index b9ccf706..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * 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; - -/** - * A simple recording of the Artifacts that could not be resolved for a given resolution request, along with - * the remote repositories where attempts were made to resolve the artifacts. - * - * @author Jason van Zyl - */ -public class UnresolvedArtifacts -{ - private Artifact originatingArtifact; - - private List<Artifact> artifacts; - - private List<ArtifactRepository> remoteRepositories; - - public UnresolvedArtifacts( Artifact originatingArtifact, - List<Artifact> artifacts, - List<ArtifactRepository> remoteRepositories ) - { - this.originatingArtifact = originatingArtifact; - - this.artifacts = artifacts; - - this.remoteRepositories = remoteRepositories; - } - - public Artifact getOriginatingArtifact() - { - return originatingArtifact; - } - - public List<Artifact> getArtifacts() - { - return artifacts; - } - - public List<ArtifactRepository> getRemoteRepositories() - { - return remoteRepositories; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java deleted file mode 100644 index 825d595a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.apache.maven.artifact.resolver; - -/* - * 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.versioning.VersionRange; -import org.codehaus.plexus.logging.Logger; - -/** - * Send resolution warning events to the warning log. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class WarningResolutionListener - implements ResolutionListener -{ - private Logger logger; - - public WarningResolutionListener( Logger logger ) - { - this.logger = logger; - } - - public void testArtifact( Artifact node ) - { - } - - public void startProcessChildren( Artifact artifact ) - { - } - - public void endProcessChildren( Artifact artifact ) - { - } - - public void includeArtifact( Artifact artifact ) - { - } - - public void omitForNearer( Artifact omitted, - Artifact kept ) - { - } - - public void omitForCycle( Artifact omitted ) - { - } - - public void updateScopeCurrentPom( Artifact artifact, - String scope ) - { - } - - public void updateScope( Artifact artifact, - String scope ) - { - } - - public void manageArtifact( Artifact artifact, - Artifact replacement ) - { - } - - public void selectVersionFromRange( Artifact artifact ) - { - } - - public void restrictRange( Artifact artifact, - Artifact replacement, - VersionRange newRange ) - { - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java deleted file mode 100644 index 0499db51..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.maven.artifact.resolver.filter; - -/* - * 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; - -public class InversionArtifactFilter - implements ArtifactFilter -{ - private final ArtifactFilter toInvert; - - public InversionArtifactFilter( ArtifactFilter toInvert ) - { - this.toInvert = toInvert; - } - - public boolean include( Artifact artifact ) - { - return !toInvert.include( artifact ); - } - - @Override - public int hashCode() - { - int hash = 17; - hash = hash * 31 + toInvert.hashCode(); - return hash; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - - if ( !( obj instanceof InversionArtifactFilter ) ) - { - return false; - } - - InversionArtifactFilter other = (InversionArtifactFilter) obj; - - return toInvert.equals( other.toInvert ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java deleted file mode 100644 index 8cd02ccf..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.apache.maven.artifact.resolver.filter; - -/* - * 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.LinkedHashSet; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; - -/** - * Apply multiple filters, accepting an artifact if at least one of the filters accepts it. - * - * @author Benjamin Bentmann - */ -public class OrArtifactFilter - implements ArtifactFilter -{ - - private Set<ArtifactFilter> filters; - - public OrArtifactFilter() - { - this.filters = new LinkedHashSet<ArtifactFilter>(); - } - - public OrArtifactFilter( Collection<ArtifactFilter> filters ) - { - this.filters = new LinkedHashSet<ArtifactFilter>( filters ); - } - - public boolean include( Artifact artifact ) - { - for ( ArtifactFilter filter : filters ) - { - if ( filter.include( artifact ) ) - { - return true; - } - } - - return false; - } - - public void add( ArtifactFilter artifactFilter ) - { - filters.add( artifactFilter ); - } - - @Override - public int hashCode() - { - int hash = 17; - hash = hash * 31 + filters.hashCode(); - return hash; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - - if ( !( obj instanceof OrArtifactFilter ) ) - { - return false; - } - - OrArtifactFilter other = (OrArtifactFilter) obj; - - return filters.equals( other.filters ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java deleted file mode 100644 index 76c39ec3..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.apache.maven.artifact.resolver.filter; - -/* - * 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; - -/** Artifact Filter which filters on artifact type */ -public class TypeArtifactFilter - implements ArtifactFilter -{ - private String type = "jar"; - - public TypeArtifactFilter( String type ) - { - this.type = type; - } - - public boolean include( Artifact artifact ) - { - return type.equals( artifact.getType() ); - } - - @Override - public int hashCode() - { - int hash = 17; - hash = hash * 31 + type.hashCode(); - return hash; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - { - return true; - } - - if ( !( obj instanceof TypeArtifactFilter ) ) - { - return false; - } - - TypeArtifactFilter other = (TypeArtifactFilter) obj; - - return type.equals( other.type ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java deleted file mode 100644 index 86b49499..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.maven.artifact.versioning; - -/* - * 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.Iterator; -import java.util.Map; - -import org.apache.maven.artifact.Artifact; - -@Deprecated -public class ManagedVersionMap - extends HashMap<String, Artifact> -{ - public ManagedVersionMap( Map<String, Artifact> map ) - { - super(); - if ( map != null ) - { - putAll( map ); - } - } - - public String toString() - { - StringBuilder buffer = new StringBuilder( "ManagedVersionMap (" + size() + " entries)\n" ); - Iterator<String> iter = keySet().iterator(); - while ( iter.hasNext() ) - { - String key = iter.next(); - buffer.append( key ).append( "=" ).append( get( key ) ); - if ( iter.hasNext() ) - { - buffer.append( "\n" ); - } - } - return buffer.toString(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java deleted file mode 100644 index 7767aff1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.apache.maven.execution; - -/* - * 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.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; -import org.codehaus.plexus.util.StringUtils; - -/** - * Describes runtime information about the application. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -@Deprecated -@Component( role = RuntimeInformation.class ) -public class DefaultRuntimeInformation - implements RuntimeInformation, Initializable -{ - - @Requirement - private org.apache.maven.rtinfo.RuntimeInformation rtInfo; - - private ArtifactVersion applicationVersion; - - public ArtifactVersion getApplicationVersion() - { - return applicationVersion; - } - - public void initialize() - throws InitializationException - { - String mavenVersion = rtInfo.getMavenVersion(); - - if ( StringUtils.isEmpty( mavenVersion ) ) - { - throw new InitializationException( "Unable to read Maven version from maven-core" ); - } - - applicationVersion = new DefaultArtifactVersion( mavenVersion ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java deleted file mode 100644 index 22e522d2..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.maven.execution; - -/* - * 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.versioning.ArtifactVersion; - -/** - * Describes runtime information about the application. - * - * @deprecated Use {@link org.apache.maven.rtinfo.RuntimeInformation} instead. - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -@Deprecated -public interface RuntimeInformation -{ - ArtifactVersion getApplicationVersion(); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java deleted file mode 100644 index 4745749b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.apache.maven.profiles; - -/* - * 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.profiles.io.xpp3.ProfilesXpp3Reader; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.interpolation.EnvarBasedValueSource; -import org.codehaus.plexus.interpolation.RegexBasedInterpolator; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.util.IOUtil; -import org.codehaus.plexus.util.ReaderFactory; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; - -@Deprecated -@Component( role = MavenProfilesBuilder.class ) -public class DefaultMavenProfilesBuilder - extends AbstractLogEnabled - implements MavenProfilesBuilder -{ - private static final String PROFILES_XML_FILE = "profiles.xml"; - - public ProfilesRoot buildProfiles( File basedir ) - throws IOException, XmlPullParserException - { - File profilesXml = new File( basedir, PROFILES_XML_FILE ); - - ProfilesRoot profilesRoot = null; - - if ( profilesXml.exists() ) - { - ProfilesXpp3Reader reader = new ProfilesXpp3Reader(); - Reader profileReader = null; - try - { - profileReader = ReaderFactory.newXmlReader( profilesXml ); - - StringWriter sWriter = new StringWriter(); - - IOUtil.copy( profileReader, sWriter ); - - String rawInput = sWriter.toString(); - - try - { - RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); - interpolator.addValueSource( new EnvarBasedValueSource() ); - - rawInput = interpolator.interpolate( rawInput, "settings" ); - } - catch ( Exception e ) - { - getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment " - + "substitution in " + PROFILES_XML_FILE + "." ); - getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e ); - } - - StringReader sReader = new StringReader( rawInput ); - - profilesRoot = reader.read( sReader ); - } - finally - { - IOUtil.close( profileReader ); - } - } - - return profilesRoot; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java deleted file mode 100644 index 3b99e9e2..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.apache.maven.profiles; - -/* - * 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.model.Activation; -import org.apache.maven.model.Profile; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.profile.DefaultProfileActivationContext; -import org.apache.maven.model.profile.ProfileSelector; -import org.apache.maven.profiles.activation.ProfileActivationException; -import org.codehaus.plexus.MutablePlexusContainer; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import org.apache.maven.model.building.ModelProblemCollectorRequest; - -@Deprecated -public class DefaultProfileManager - implements ProfileManager -{ - - @Requirement - private Logger logger; - - @Requirement - private ProfileSelector profileSelector; - - private List activatedIds = new ArrayList(); - - private List deactivatedIds = new ArrayList(); - - private List defaultIds = new ArrayList(); - - private Map profilesById = new LinkedHashMap(); - - private Properties requestProperties; - - /** - * @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work - * correctly in embedded envirnments. - */ - public DefaultProfileManager( PlexusContainer container ) - { - this( container, null ); - } - - /** - * the properties passed to the profile manager are the props that - * are passed to maven, possibly containing profile activator properties - * - */ - public DefaultProfileManager( PlexusContainer container, Properties props ) - { - try - { - this.profileSelector = container.lookup( ProfileSelector.class ); - this.logger = ( (MutablePlexusContainer) container ).getLogger(); - } - catch ( ComponentLookupException e ) - { - throw new IllegalStateException( e ); - } - this.requestProperties = props; - } - - public Properties getRequestProperties() - { - return requestProperties; - } - - public Map getProfilesById() - { - return profilesById; - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#addProfile(org.apache.maven.model.Profile) - */ - public void addProfile( Profile profile ) - { - String profileId = profile.getId(); - - Profile existing = (Profile) profilesById.get( profileId ); - if ( existing != null ) - { - logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() - + ") with new instance from source: " + profile.getSource() ); - } - - profilesById.put( profile.getId(), profile ); - - Activation activation = profile.getActivation(); - - if ( activation != null && activation.isActiveByDefault() ) - { - activateAsDefault( profileId ); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyActivate(java.lang.String) - */ - public void explicitlyActivate( String profileId ) - { - if ( !activatedIds.contains( profileId ) ) - { - logger.debug( "Profile with id: \'" + profileId + "\' has been explicitly activated." ); - - activatedIds.add( profileId ); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyActivate(java.util.List) - */ - public void explicitlyActivate( List profileIds ) - { - for ( Object profileId1 : profileIds ) - { - String profileId = (String) profileId1; - - explicitlyActivate( profileId ); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyDeactivate(java.lang.String) - */ - public void explicitlyDeactivate( String profileId ) - { - if ( !deactivatedIds.contains( profileId ) ) - { - logger.debug( "Profile with id: \'" + profileId + "\' has been explicitly deactivated." ); - - deactivatedIds.add( profileId ); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyDeactivate(java.util.List) - */ - public void explicitlyDeactivate( List profileIds ) - { - for ( Object profileId1 : profileIds ) - { - String profileId = (String) profileId1; - - explicitlyDeactivate( profileId ); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#getActiveProfiles() - */ - public List getActiveProfiles() - throws ProfileActivationException - { - DefaultProfileActivationContext context = new DefaultProfileActivationContext(); - context.setActiveProfileIds( activatedIds ); - context.setInactiveProfileIds( deactivatedIds ); - context.setSystemProperties( System.getProperties() ); - context.setUserProperties( requestProperties ); - - final List<ProfileActivationException> errors = new ArrayList<ProfileActivationException>(); - - List<Profile> profiles = - profileSelector.getActiveProfiles( profilesById.values(), context, new ModelProblemCollector() - { - - public void add( ModelProblemCollectorRequest req ) - { - if ( !ModelProblem.Severity.WARNING.equals( req.getSeverity() ) ) - { - errors.add( new ProfileActivationException( req.getMessage(), req.getException() ) ); - } - } - } ); - - if ( !errors.isEmpty() ) - { - throw errors.get( 0 ); - } - - return profiles; - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#addProfiles(java.util.List) - */ - public void addProfiles( List profiles ) - { - for ( Object profile1 : profiles ) - { - Profile profile = (Profile) profile1; - - addProfile( profile ); - } - } - - public void activateAsDefault( String profileId ) - { - if ( !defaultIds.contains( profileId ) ) - { - defaultIds.add( profileId ); - } - } - - public List getExplicitlyActivatedIds() - { - return activatedIds; - } - - public List getExplicitlyDeactivatedIds() - { - return deactivatedIds; - } - - public List getIdsActivatedByDefault() - { - return defaultIds; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java deleted file mode 100644 index 32fb6aaa..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.maven.profiles; - -/* - * 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.codehaus.plexus.util.xml.pull.XmlPullParserException; - -import java.io.File; -import java.io.IOException; - -/** - * @author jdcasey - */ -@Deprecated -public interface MavenProfilesBuilder -{ - String ROLE = MavenProfilesBuilder.class.getName(); - - ProfilesRoot buildProfiles( File basedir ) - throws IOException, XmlPullParserException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java deleted file mode 100644 index ddda3d7f..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.maven.profiles; - -/* - * 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.model.Profile; -import org.apache.maven.profiles.activation.ProfileActivationException; - -import java.util.List; -import java.util.Map; -import java.util.Properties; - -@Deprecated -public interface ProfileManager -{ - - void addProfile( Profile profile ); - - void explicitlyActivate( String profileId ); - - void explicitlyActivate( List profileIds ); - - void explicitlyDeactivate( String profileId ); - - void explicitlyDeactivate( List profileIds ); - - List getActiveProfiles() - throws ProfileActivationException; - - void addProfiles( List profiles ); - - Map getProfilesById(); - - List getExplicitlyActivatedIds(); - - List getExplicitlyDeactivatedIds(); - - List getIdsActivatedByDefault(); - - Properties getRequestProperties(); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java deleted file mode 100644 index 72527b09..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.apache.maven.profiles; - -/* - * 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.model.Activation; -import org.apache.maven.model.ActivationFile; -import org.apache.maven.model.ActivationProperty; -import org.apache.maven.model.Profile; -import org.apache.maven.model.Repository; - -import java.util.List; - -@Deprecated -public class ProfilesConversionUtils -{ - private ProfilesConversionUtils() - { - } - - public static Profile convertFromProfileXmlProfile( org.apache.maven.profiles.Profile profileXmlProfile ) - { - Profile profile = new Profile(); - - profile.setId( profileXmlProfile.getId() ); - - profile.setSource( "profiles.xml" ); - - org.apache.maven.profiles.Activation profileActivation = profileXmlProfile.getActivation(); - - if ( profileActivation != null ) - { - Activation activation = new Activation(); - - activation.setActiveByDefault( profileActivation.isActiveByDefault() ); - - activation.setJdk( profileActivation.getJdk() ); - - org.apache.maven.profiles.ActivationProperty profileProp = profileActivation.getProperty(); - - if ( profileProp != null ) - { - ActivationProperty prop = new ActivationProperty(); - - prop.setName( profileProp.getName() ); - prop.setValue( profileProp.getValue() ); - - activation.setProperty( prop ); - } - - - ActivationOS profileOs = profileActivation.getOs(); - - if ( profileOs != null ) - { - org.apache.maven.model.ActivationOS os = new org.apache.maven.model.ActivationOS(); - - os.setArch( profileOs.getArch() ); - os.setFamily( profileOs.getFamily() ); - os.setName( profileOs.getName() ); - os.setVersion( profileOs.getVersion() ); - - activation.setOs( os ); - } - - org.apache.maven.profiles.ActivationFile profileFile = profileActivation.getFile(); - - if ( profileFile != null ) - { - ActivationFile file = new ActivationFile(); - - file.setExists( profileFile.getExists() ); - file.setMissing( profileFile.getMissing() ); - - activation.setFile( file ); - } - - profile.setActivation( activation ); - } - - profile.setProperties( profileXmlProfile.getProperties() ); - - List repos = profileXmlProfile.getRepositories(); - if ( repos != null ) - { - for ( Object repo : repos ) - { - profile.addRepository( convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) repo ) ); - } - } - - List pluginRepos = profileXmlProfile.getPluginRepositories(); - if ( pluginRepos != null ) - { - for ( Object pluginRepo : pluginRepos ) - { - profile.addPluginRepository( - convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) pluginRepo ) ); - } - } - - return profile; - } - - private static Repository convertFromProfileXmlRepository( org.apache.maven.profiles.Repository profileXmlRepo ) - { - Repository repo = new Repository(); - - repo.setId( profileXmlRepo.getId() ); - repo.setLayout( profileXmlRepo.getLayout() ); - repo.setName( profileXmlRepo.getName() ); - repo.setUrl( profileXmlRepo.getUrl() ); - - if ( profileXmlRepo.getSnapshots() != null ) - { - repo.setSnapshots( convertRepositoryPolicy( profileXmlRepo.getSnapshots() ) ); - } - if ( profileXmlRepo.getReleases() != null ) - { - repo.setReleases( convertRepositoryPolicy( profileXmlRepo.getReleases() ) ); - } - - return repo; - } - - private static org.apache.maven.model.RepositoryPolicy convertRepositoryPolicy( RepositoryPolicy profileXmlRepo ) - { - org.apache.maven.model.RepositoryPolicy policy = new org.apache.maven.model.RepositoryPolicy(); - policy.setEnabled( profileXmlRepo.isEnabled() ); - policy.setUpdatePolicy( profileXmlRepo.getUpdatePolicy() ); - policy.setChecksumPolicy( profileXmlRepo.getChecksumPolicy() ); - return policy; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java deleted file mode 100644 index 5d6a8bf6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Profile; - -@Deprecated -public abstract class DetectedProfileActivator - implements ProfileActivator -{ - public boolean canDetermineActivation( Profile profile ) - { - return canDetectActivation( profile ); - } - - protected abstract boolean canDetectActivation( Profile profile ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java deleted file mode 100644 index de4ba2ed..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.IOException; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationFile; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.interpolation.EnvarBasedValueSource; -import org.codehaus.plexus.interpolation.InterpolationException; -import org.codehaus.plexus.interpolation.MapBasedValueSource; -import org.codehaus.plexus.interpolation.RegexBasedInterpolator; -import org.codehaus.plexus.logging.LogEnabled; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.FileUtils; -import org.codehaus.plexus.util.StringUtils; - -@Deprecated -public class FileProfileActivator - extends DetectedProfileActivator - implements LogEnabled -{ - private Logger logger; - - protected boolean canDetectActivation( Profile profile ) - { - return profile.getActivation() != null && profile.getActivation().getFile() != null; - } - - public boolean isActive( Profile profile ) - { - Activation activation = profile.getActivation(); - - ActivationFile actFile = activation.getFile(); - - if ( actFile != null ) - { - // check if the file exists, if it does then the profile will be active - String fileString = actFile.getExists(); - - RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); - try - { - interpolator.addValueSource( new EnvarBasedValueSource() ); - } - catch ( IOException e ) - { - // ignored - } - interpolator.addValueSource( new MapBasedValueSource( System.getProperties() ) ); - - try - { - if ( StringUtils.isNotEmpty( fileString ) ) - { - fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" ); - return FileUtils.fileExists( fileString ); - } - - // check if the file is missing, if it is then the profile will be active - fileString = actFile.getMissing(); - - if ( StringUtils.isNotEmpty( fileString ) ) - { - fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" ); - return !FileUtils.fileExists( fileString ); - } - } - catch ( InterpolationException e ) - { - if ( logger.isDebugEnabled() ) - { - logger.debug( "Failed to interpolate missing file location for profile activator: " + fileString, - e ); - } - else - { - logger.warn( "Failed to interpolate missing file location for profile activator: " + fileString - + ". Run in debug mode (-X) for more information." ); - } - } - } - - return false; - } - - public void enableLogging( Logger logger ) - { - this.logger = logger; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java deleted file mode 100644 index dfae95f6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.model.Activation; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.util.StringUtils; - -@Deprecated -public class JdkPrefixProfileActivator - extends DetectedProfileActivator -{ - private static final String JDK_VERSION = System.getProperty( "java.version" ); - - public boolean isActive( Profile profile ) - throws ProfileActivationException - { - Activation activation = profile.getActivation(); - - String jdk = activation.getJdk(); - - // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here. - if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) ) - { - try - { - return matchJdkVersionRange( jdk ); - } - catch ( InvalidVersionSpecificationException e ) - { - throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': " - + e.getMessage() ); - } - } - - boolean reverse = false; - - if ( jdk.startsWith( "!" ) ) - { - reverse = true; - jdk = jdk.substring( 1 ); - } - - if ( getJdkVersion().startsWith( jdk ) ) - { - return !reverse; - } - else - { - return reverse; - } - } - - private boolean matchJdkVersionRange( String jdk ) - throws InvalidVersionSpecificationException - { - VersionRange jdkVersionRange = VersionRange.createFromVersionSpec( convertJdkToMavenVersion( jdk ) ); - DefaultArtifactVersion jdkVersion = new DefaultArtifactVersion( convertJdkToMavenVersion( getJdkVersion() ) ); - return jdkVersionRange.containsVersion( jdkVersion ); - } - - private String convertJdkToMavenVersion( String jdk ) - { - return jdk.replaceAll( "_", "-" ); - } - - protected String getJdkVersion() - { - return JDK_VERSION; - } - - protected boolean canDetectActivation( Profile profile ) - { - return profile.getActivation() != null && StringUtils.isNotEmpty( profile.getActivation().getJdk() ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java deleted file mode 100644 index 7464a303..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Activation; -import org.apache.maven.model.ActivationOS; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.util.Os; - -@Deprecated -public class OperatingSystemProfileActivator - implements ProfileActivator -{ - - public boolean canDetermineActivation( Profile profile ) - { - Activation activation = profile.getActivation(); - return activation != null && activation.getOs() != null; - } - - public boolean isActive( Profile profile ) - { - Activation activation = profile.getActivation(); - ActivationOS os = activation.getOs(); - - boolean result = ensureAtLeastOneNonNull( os ); - - if ( result && os.getFamily() != null ) - { - result = determineFamilyMatch( os.getFamily() ); - } - if ( result && os.getName() != null ) - { - result = determineNameMatch( os.getName() ); - } - if ( result && os.getArch() != null ) - { - result = determineArchMatch( os.getArch() ); - } - if ( result && os.getVersion() != null ) - { - result = determineVersionMatch( os.getVersion() ); - } - return result; - } - - private boolean ensureAtLeastOneNonNull( ActivationOS os ) - { - return os.getArch() != null || os.getFamily() != null || os.getName() != null || os.getVersion() != null; - } - - private boolean determineVersionMatch( String version ) - { - String test = version; - boolean reverse = false; - - if ( test.startsWith( "!" ) ) - { - reverse = true; - test = test.substring( 1 ); - } - - boolean result = Os.isVersion( test ); - - if ( reverse ) - { - return !result; - } - else - { - return result; - } - } - - private boolean determineArchMatch( String arch ) - { - String test = arch; - boolean reverse = false; - - if ( test.startsWith( "!" ) ) - { - reverse = true; - test = test.substring( 1 ); - } - - boolean result = Os.isArch( test ); - - if ( reverse ) - { - return !result; - } - else - { - return result; - } - } - - private boolean determineNameMatch( String name ) - { - String test = name; - boolean reverse = false; - - if ( test.startsWith( "!" ) ) - { - reverse = true; - test = test.substring( 1 ); - } - - boolean result = Os.isName( test ); - - if ( reverse ) - { - return !result; - } - else - { - return result; - } - } - - private boolean determineFamilyMatch( String family ) - { - String test = family; - boolean reverse = false; - - if ( test.startsWith( "!" ) ) - { - reverse = true; - test = test.substring( 1 ); - } - - boolean result = Os.isFamily( test ); - - if ( reverse ) - { - return !result; - } - else - { - return result; - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java deleted file mode 100644 index 7fc372cb..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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. - */ - -@Deprecated -public class ProfileActivationException - extends Exception -{ - - private static final long serialVersionUID = -90820222109103638L; - - public ProfileActivationException( String message, Throwable cause ) - { - super( message, cause ); - } - - public ProfileActivationException( String message ) - { - super( message ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java deleted file mode 100644 index d0a9ecb5..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Profile; - -@Deprecated -public interface ProfileActivator -{ - final String ROLE = ProfileActivator.class.getName(); - - boolean canDetermineActivation( Profile profile ); - - boolean isActive( Profile profile ) - throws ProfileActivationException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java deleted file mode 100644 index a03267dc..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.Properties; -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationProperty; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.context.Context; -import org.codehaus.plexus.context.ContextException; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; -import org.codehaus.plexus.util.StringUtils; - -@Deprecated -public class SystemPropertyProfileActivator - extends DetectedProfileActivator implements Contextualizable -{ - private Properties properties; - - public void contextualize( Context context ) - throws ContextException - { - properties = (Properties) context.get( "SystemProperties" ); - } - - protected boolean canDetectActivation( Profile profile ) - { - return profile.getActivation() != null && profile.getActivation().getProperty() != null; - } - - public boolean isActive( Profile profile ) - throws ProfileActivationException - { - Activation activation = profile.getActivation(); - - ActivationProperty property = activation.getProperty(); - - if ( property != null ) - { - String name = property.getName(); - boolean reverseName = false; - - if ( name == null ) - { - throw new ProfileActivationException( "The property name is required to activate the profile '" - + profile.getId() + "'" ); - } - - if ( name.startsWith( "!" ) ) - { - reverseName = true; - name = name.substring( 1 ); - } - - String sysValue = properties.getProperty( name ); - - String propValue = property.getValue(); - if ( StringUtils.isNotEmpty( propValue ) ) - { - boolean reverseValue = false; - if ( propValue.startsWith( "!" ) ) - { - reverseValue = true; - propValue = propValue.substring( 1 ); - } - - // we have a value, so it has to match the system value... - boolean result = propValue.equals( sysValue ); - - if ( reverseValue ) - { - return !result; - } - else - { - return result; - } - } - else - { - boolean result = StringUtils.isNotEmpty( sysValue ); - - if ( reverseName ) - { - return !result; - } - else - { - return result; - } - } - } - - return false; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java deleted file mode 100644 index fff2de10..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ /dev/null @@ -1,324 +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.Arrays; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Repository; -import org.apache.maven.model.building.ModelBuildingException; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelSource; -import org.apache.maven.model.building.UrlModelSource; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.profiles.ProfileManager; -import org.apache.maven.properties.internal.EnvironmentUtils; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.wagon.events.TransferListener; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - */ -@Component( role = MavenProjectBuilder.class ) -@Deprecated -public class DefaultMavenProjectBuilder - implements MavenProjectBuilder -{ - - @Requirement - private ProjectBuilder projectBuilder; - - @Requirement - private RepositorySystem repositorySystem; - - @Requirement - private LegacySupport legacySupport; - - // ---------------------------------------------------------------------- - // MavenProjectBuilder Implementation - // ---------------------------------------------------------------------- - - private ProjectBuildingRequest toRequest( ProjectBuilderConfiguration configuration ) - { - DefaultProjectBuildingRequest request = new DefaultProjectBuildingRequest(); - - request.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ); - request.setResolveDependencies( false ); - - request.setLocalRepository( configuration.getLocalRepository() ); - request.setBuildStartTime( configuration.getBuildStartTime() ); - request.setUserProperties( configuration.getUserProperties() ); - request.setSystemProperties( configuration.getExecutionProperties() ); - - ProfileManager profileManager = configuration.getGlobalProfileManager(); - if ( profileManager != null ) - { - request.setActiveProfileIds( profileManager.getExplicitlyActivatedIds() ); - request.setInactiveProfileIds( profileManager.getExplicitlyDeactivatedIds() ); - } - else - { - /* - * MNG-4900: Hack to workaround deficiency of legacy API which makes it impossible for plugins to access the - * global profile manager which is required to build a POM like a CLI invocation does. Failure to consider - * the activated profiles can cause repo declarations to be lost which in turn will result in artifact - * resolution failures, in particular when using the enhanced local repo which guards access to local files - * based on the configured remote repos. - */ - MavenSession session = legacySupport.getSession(); - if ( session != null ) - { - MavenExecutionRequest req = session.getRequest(); - if ( req != null ) - { - request.setActiveProfileIds( req.getActiveProfiles() ); - request.setInactiveProfileIds( req.getInactiveProfiles() ); - } - } - } - - return request; - } - - private ProjectBuildingRequest injectSession( ProjectBuildingRequest request ) - { - MavenSession session = legacySupport.getSession(); - if ( session != null ) - { - request.setRepositorySession( session.getRepositorySession() ); - request.setSystemProperties( session.getSystemProperties() ); - if ( request.getUserProperties().isEmpty() ) - { - request.setUserProperties( session.getUserProperties() ); - } - - MavenExecutionRequest req = session.getRequest(); - if ( req != null ) - { - request.setRemoteRepositories( req.getRemoteRepositories() ); - } - } - else - { - Properties props = new Properties(); - EnvironmentUtils.addEnvVars( props ); - props.putAll( System.getProperties() ); - request.setSystemProperties( props ); - } - - return request; - } - - @SuppressWarnings( "unchecked" ) - private List<ArtifactRepository> normalizeToArtifactRepositories( List<?> repositories, - ProjectBuildingRequest request ) - throws ProjectBuildingException - { - /* - * This provides backward-compat with 2.x that allowed plugins like the maven-remote-resources-plugin:1.0 to - * populate the builder configuration with model repositories instead of artifact repositories. - */ - - if ( repositories != null ) - { - boolean normalized = false; - - List<ArtifactRepository> repos = new ArrayList<ArtifactRepository>( repositories.size() ); - - for ( Object repository : repositories ) - { - if ( repository instanceof Repository ) - { - try - { - ArtifactRepository repo = repositorySystem.buildArtifactRepository( (Repository) repository ); - repositorySystem.injectMirror( request.getRepositorySession(), Arrays.asList( repo ) ); - repositorySystem.injectProxy( request.getRepositorySession(), Arrays.asList( repo ) ); - repositorySystem.injectAuthentication( request.getRepositorySession(), Arrays.asList( repo ) ); - repos.add( repo ); - } - catch ( InvalidRepositoryException e ) - { - throw new ProjectBuildingException( "", "Invalid remote repository " + repository, e ); - } - normalized = true; - } - else - { - repos.add( (ArtifactRepository) repository ); - } - } - - if ( normalized ) - { - return repos; - } - } - - return (List<ArtifactRepository>) repositories; - } - - private ProjectBuildingException transformError( ProjectBuildingException e ) - { - if ( e.getCause() instanceof ModelBuildingException ) - { - return new InvalidProjectModelException( e.getProjectId(), e.getMessage(), e.getPomFile() ); - } - - return e; - } - - public MavenProject build( File pom, ProjectBuilderConfiguration configuration ) - throws ProjectBuildingException - { - ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); - - try - { - return projectBuilder.build( pom, request ).getProject(); - } - catch ( ProjectBuildingException e ) - { - throw transformError( e ); - } - } - - // This is used by the SITE plugin. - public MavenProject build( File pom, ArtifactRepository localRepository, ProfileManager profileManager ) - throws ProjectBuildingException - { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository( localRepository ); - configuration.setGlobalProfileManager( profileManager ); - - return build( pom, configuration ); - } - - public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ProjectBuilderConfiguration configuration, boolean allowStubModel ) - throws ProjectBuildingException - { - ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); - request.setRemoteRepositories( normalizeToArtifactRepositories( remoteRepositories, request ) ); - request.setProcessPlugins( false ); - request.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); - - try - { - return projectBuilder.build( artifact, allowStubModel, request ).getProject(); - } - catch ( ProjectBuildingException e ) - { - throw transformError( e ); - } - } - - public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, boolean allowStubModel ) - throws ProjectBuildingException - { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository( localRepository ); - - return buildFromRepository( artifact, remoteRepositories, configuration, allowStubModel ); - } - - public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ProjectBuildingException - { - return buildFromRepository( artifact, remoteRepositories, localRepository, true ); - } - - /** - * This is used for pom-less execution like running archetype:generate. I am taking out the profile handling and the - * interpolation of the base directory until we spec this out properly. - */ - public MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration configuration ) - throws ProjectBuildingException - { - ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); - request.setProcessPlugins( false ); - request.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); - - ModelSource modelSource = new UrlModelSource( getClass().getResource( "standalone.xml" ) ); - - MavenProject project = projectBuilder.build( modelSource, request ).getProject(); - project.setExecutionRoot( true ); - return project; - } - - public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository ) - throws ProjectBuildingException - { - return buildStandaloneSuperProject( localRepository, null ); - } - - public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, ProfileManager profileManager ) - throws ProjectBuildingException - { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository( localRepository ); - configuration.setGlobalProfileManager( profileManager ); - - return buildStandaloneSuperProject( configuration ); - } - - public MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository, - ProfileManager profileManager, TransferListener transferListener ) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException - { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository( localRepository ); - configuration.setGlobalProfileManager( profileManager ); - - ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); - - request.setResolveDependencies( true ); - - try - { - return projectBuilder.build( pom, request ).getProject(); - } - catch ( ProjectBuildingException e ) - { - throw transformError( e ); - } - } - - public MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository, - ProfileManager profileManager ) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException - { - return buildWithDependencies( pom, localRepository, profileManager, null ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java deleted file mode 100644 index d08f18e0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java +++ /dev/null @@ -1,107 +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.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.profiles.ProfileManager; - -@Deprecated -public class DefaultProjectBuilderConfiguration - implements ProjectBuilderConfiguration -{ - - private ProfileManager globalProfileManager; - - private ArtifactRepository localRepository; - - private Properties userProperties; - - private Properties executionProperties = System.getProperties(); - - private Date buildStartTime; - - public DefaultProjectBuilderConfiguration() - { - } - - public ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager ) - { - this.globalProfileManager = globalProfileManager; - return this; - } - - public ProfileManager getGlobalProfileManager() - { - return globalProfileManager; - } - - public ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository ) - { - this.localRepository = localRepository; - return this; - } - - public ArtifactRepository getLocalRepository() - { - return localRepository; - } - - public ProjectBuilderConfiguration setUserProperties( Properties userProperties ) - { - this.userProperties = userProperties; - return this; - } - - public Properties getUserProperties() - { - if ( userProperties == null ) - { - userProperties = new Properties(); - } - - return userProperties; - } - - public Properties getExecutionProperties() - { - return executionProperties; - } - - public ProjectBuilderConfiguration setExecutionProperties( Properties executionProperties ) - { - this.executionProperties = executionProperties; - return this; - } - - public Date getBuildStartTime() - { - return buildStartTime; - } - - public ProjectBuilderConfiguration setBuildStartTime( Date buildStartTime ) - { - this.buildStartTime = buildStartTime; - return this; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java deleted file mode 100644 index cf85aa9e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.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 org.apache.maven.project.validation.ModelValidationResult; - -@Deprecated -public class InvalidProjectModelException - extends ProjectBuildingException -{ - private ModelValidationResult validationResult; - - public InvalidProjectModelException( String projectId, String message, File pomLocation ) - { - super( projectId, message, pomLocation ); - } - - /** - * @param projectId - * @param pomLocation absolute path of the pom file - * @param message - * @param validationResult - * @deprecated use {@link File} constructor for pomLocation - */ - public InvalidProjectModelException( String projectId, String pomLocation, String message, - ModelValidationResult validationResult ) - { - this( projectId, message, new File( pomLocation ), validationResult ); - } - - public InvalidProjectModelException( String projectId, String message, File pomFile, - ModelValidationResult validationResult ) - { - super( projectId, message, pomFile ); - - this.validationResult = validationResult; - } - - /** - * @param projectId - * @param pomLocation absolute path of the pom file - * @param message - * @deprecated use {@link File} constructor for pomLocation - */ - public InvalidProjectModelException( String projectId, String pomLocation, String message ) - { - this( projectId, message, new File( pomLocation ) ); - } - - public final ModelValidationResult getValidationResult() - { - return validationResult; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java deleted file mode 100644 index c44d8dbc..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.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; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.profiles.ProfileManager; -import org.apache.maven.wagon.events.TransferListener; - -/** - * @deprecated use {@link ProjectBuilder} instead - */ -@Deprecated -public interface MavenProjectBuilder -{ - - MavenProject build( File pom, ProjectBuilderConfiguration configuration ) - throws ProjectBuildingException; - - //TODO maven-site-plugin -- Vincent, Dennis and Lukas are checking but this doesn't appear to be required anymore. - MavenProject build( File pom, ArtifactRepository localRepository, ProfileManager profileManager ) - throws ProjectBuildingException; - - //TODO remote-resources-plugin - MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ProjectBuildingException; - - //TODO remote-resources-plugin - MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository, boolean allowStubModel ) - throws ProjectBuildingException; - - // TODO: this is only to provide a project for plugins that don't need a project to execute but need some - // of the values from a MavenProject. Ideally this should be something internal and nothing outside Maven - // would ever need this so it should not be exposed in a public API - MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration configuration ) - throws ProjectBuildingException; - - MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository ) - throws ProjectBuildingException; - - MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, ProfileManager profileManager ) - throws ProjectBuildingException; - - MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository, - ProfileManager globalProfileManager, TransferListener transferListener ) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException; - - MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository, - ProfileManager globalProfileManager ) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java deleted file mode 100644 index 17c267e3..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java +++ /dev/null @@ -1,38 +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.InvalidRepositoryException; - -public class MissingRepositoryElementException - extends InvalidRepositoryException -{ - - public MissingRepositoryElementException( String message, String repositoryId ) - { - super( message, repositoryId ); - } - - public MissingRepositoryElementException( String message ) - { - super( message, "-unknown-" ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java deleted file mode 100644 index 1af061d3..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java +++ /dev/null @@ -1,367 +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.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginContainer; -import org.apache.maven.model.PluginExecution; -import org.apache.maven.model.Repository; -import org.codehaus.plexus.util.xml.Xpp3Dom; - -/** @deprecated */ -@Deprecated -public final class ModelUtils -{ - - /** - * This should be the resulting ordering of plugins after merging: - * <p/> - * Given: - * <p/> - * parent: X -> A -> B -> D -> E - * child: Y -> A -> C -> D -> F - * <p/> - * Result: - * <p/> - * X -> Y -> A -> B -> C -> D -> E -> F - */ - public static void mergePluginLists( PluginContainer childContainer, PluginContainer parentContainer, - boolean handleAsInheritance ) - { - if ( ( childContainer == null ) || ( parentContainer == null ) ) - { - // nothing to do. - return; - } - - List<Plugin> parentPlugins = parentContainer.getPlugins(); - - if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() ) - { - parentPlugins = new ArrayList<Plugin>( parentPlugins ); - - // If we're processing this merge as an inheritance, we have to build up a list of - // plugins that were considered for inheritance. - if ( handleAsInheritance ) - { - for ( Iterator<Plugin> it = parentPlugins.iterator(); it.hasNext(); ) - { - Plugin plugin = it.next(); - - String inherited = plugin.getInherited(); - - if ( ( inherited != null ) && !Boolean.valueOf( inherited ) ) - { - it.remove(); - } - } - } - - List<Plugin> assembledPlugins = new ArrayList<Plugin>(); - - Map<String, Plugin> childPlugins = childContainer.getPluginsAsMap(); - - for ( Plugin parentPlugin : parentPlugins ) - { - String parentInherited = parentPlugin.getInherited(); - - // only merge plugin definition from the parent if at least one - // of these is true: - // 1. we're not processing the plugins in an inheritance-based merge - // 2. the parent's <inherited/> flag is not set - // 3. the parent's <inherited/> flag is set to true - if ( !handleAsInheritance || ( parentInherited == null ) - || Boolean.valueOf( parentInherited ) ) - { - Plugin childPlugin = childPlugins.get( parentPlugin.getKey() ); - - if ( ( childPlugin != null ) && !assembledPlugins.contains( childPlugin ) ) - { - Plugin assembledPlugin = childPlugin; - - mergePluginDefinitions( childPlugin, parentPlugin, handleAsInheritance ); - - // fix for MNG-2221 (assembly cache was not being populated for later reference): - assembledPlugins.add( assembledPlugin ); - } - - // if we're processing this as an inheritance-based merge, and - // the parent's <inherited/> flag is not set, then we need to - // clear the inherited flag in the merge result. - if ( handleAsInheritance && ( parentInherited == null ) ) - { - parentPlugin.unsetInheritanceApplied(); - } - } - - // very important to use the parentPlugins List, rather than parentContainer.getPlugins() - // since this list is a local one, and may have been modified during processing. - List<Plugin> results = - ModelUtils.orderAfterMerge( assembledPlugins, parentPlugins, childContainer.getPlugins() ); - - childContainer.setPlugins( results ); - - childContainer.flushPluginMap(); - } - } - } - - public static List<Plugin> orderAfterMerge( List<Plugin> merged, List<Plugin> highPrioritySource, - List<Plugin> lowPrioritySource ) - { - List<Plugin> results = new ArrayList<Plugin>(); - - if ( !merged.isEmpty() ) - { - results.addAll( merged ); - } - - List<Plugin> missingFromResults = new ArrayList<Plugin>(); - - List<List<Plugin>> sources = new ArrayList<List<Plugin>>(); - - sources.add( highPrioritySource ); - sources.add( lowPrioritySource ); - - for ( List<Plugin> source : sources ) - { - for ( Plugin item : source ) - { - if ( results.contains( item ) ) - { - if ( !missingFromResults.isEmpty() ) - { - int idx = results.indexOf( item ); - - if ( idx < 0 ) - { - idx = 0; - } - - results.addAll( idx, missingFromResults ); - - missingFromResults.clear(); - } - } - else - { - missingFromResults.add( item ); - } - } - - if ( !missingFromResults.isEmpty() ) - { - results.addAll( missingFromResults ); - - missingFromResults.clear(); - } - } - - return results; - } - - - public static void mergePluginDefinitions( Plugin child, Plugin parent, boolean handleAsInheritance ) - { - if ( ( child == null ) || ( parent == null ) ) - { - // nothing to do. - return; - } - - if ( parent.isExtensions() ) - { - child.setExtensions( true ); - } - - if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) ) - { - child.setVersion( parent.getVersion() ); - } - - Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); - Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); - - childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); - - child.setConfiguration( childConfiguration ); - - child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) ); - - // from here to the end of the method is dealing with merging of the <executions/> section. - String parentInherited = parent.getInherited(); - - boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ); - - List<PluginExecution> parentExecutions = parent.getExecutions(); - - if ( ( parentExecutions != null ) && !parentExecutions.isEmpty() ) - { - List<PluginExecution> mergedExecutions = new ArrayList<PluginExecution>(); - - Map<String, PluginExecution> assembledExecutions = new TreeMap<String, PluginExecution>(); - - Map<String, PluginExecution> childExecutions = child.getExecutionsAsMap(); - - for ( PluginExecution parentExecution : parentExecutions ) - { - String inherited = parentExecution.getInherited(); - - boolean parentExecInherited = - parentIsInherited && ( ( inherited == null ) || Boolean.valueOf( inherited ) ); - - if ( !handleAsInheritance || parentExecInherited ) - { - PluginExecution assembled = parentExecution; - - PluginExecution childExecution = childExecutions.get( parentExecution.getId() ); - - if ( childExecution != null ) - { - mergePluginExecutionDefinitions( childExecution, parentExecution ); - - assembled = childExecution; - } - else if ( handleAsInheritance && ( parentInherited == null ) ) - { - parentExecution.unsetInheritanceApplied(); - } - - assembledExecutions.put( assembled.getId(), assembled ); - mergedExecutions.add( assembled ); - } - } - - for ( PluginExecution childExecution : child.getExecutions() ) - { - if ( !assembledExecutions.containsKey( childExecution.getId() ) ) - { - mergedExecutions.add( childExecution ); - } - } - - child.setExecutions( mergedExecutions ); - - child.flushExecutionMap(); - } - - } - - private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent ) - { - if ( child.getPhase() == null ) - { - child.setPhase( parent.getPhase() ); - } - - List<String> parentGoals = parent.getGoals(); - List<String> childGoals = child.getGoals(); - - List<String> goals = new ArrayList<String>(); - - if ( ( childGoals != null ) && !childGoals.isEmpty() ) - { - goals.addAll( childGoals ); - } - - if ( parentGoals != null ) - { - for ( String goal : parentGoals ) - { - if ( !goals.contains( goal ) ) - { - goals.add( goal ); - } - } - } - - child.setGoals( goals ); - - Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); - Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); - - childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); - - child.setConfiguration( childConfiguration ); - } - - public static List<Repository> mergeRepositoryLists( List<Repository> dominant, List<Repository> recessive ) - { - List<Repository> repositories = new ArrayList<Repository>(); - - for ( Repository repository : dominant ) - { - repositories.add( repository ); - } - - for ( Repository repository : recessive ) - { - if ( !repositories.contains( repository ) ) - { - repositories.add( repository ); - } - } - - return repositories; - } - - public static void mergeFilterLists( List<String> childFilters, List<String> parentFilters ) - { - for ( String f : parentFilters ) - { - if ( !childFilters.contains( f ) ) - { - childFilters.add( f ); - } - } - } - - private static List<Dependency> mergeDependencyList( List<Dependency> child, List<Dependency> parent ) - { - Map<String, Dependency> depsMap = new LinkedHashMap<String, Dependency>(); - - if ( parent != null ) - { - for ( Dependency dependency : parent ) - { - depsMap.put( dependency.getManagementKey(), dependency ); - } - } - - if ( child != null ) - { - for ( Dependency dependency : child ) - { - depsMap.put( dependency.getManagementKey(), dependency ); - } - } - - return new ArrayList<Dependency>( depsMap.values() ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java deleted file mode 100644 index ddfad3cb..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java +++ /dev/null @@ -1,55 +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.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.profiles.ProfileManager; - -/** - * @deprecated use {@link ProjectBuildingRequest} instead - */ -@Deprecated -public interface ProjectBuilderConfiguration -{ - - ArtifactRepository getLocalRepository(); - - ProfileManager getGlobalProfileManager(); - - Properties getUserProperties(); - - Properties getExecutionProperties(); - - ProjectBuilderConfiguration setGlobalProfileManager( ProfileManager globalProfileManager ); - - ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository ); - - ProjectBuilderConfiguration setUserProperties( Properties userProperties ); - - ProjectBuilderConfiguration setExecutionProperties( Properties executionProperties ); - - Date getBuildStartTime(); - - ProjectBuilderConfiguration setBuildStartTime( Date buildStartTime ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java deleted file mode 100644 index b70d3cff..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java +++ /dev/null @@ -1,118 +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.List; - -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; -import org.apache.maven.model.DeploymentRepository; -import org.apache.maven.model.Repository; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.eclipse.aether.RepositorySystemSession; - -// This class needs to stick around because it was exposed the the remote resources plugin started using it instead of -// getting the repositories from the project. - -@Deprecated -public final class ProjectUtils -{ - - private ProjectUtils() - { - } - - public static List<ArtifactRepository> buildArtifactRepositories( List<Repository> repositories, - ArtifactRepositoryFactory artifactRepositoryFactory, - PlexusContainer c ) - throws InvalidRepositoryException - { - - List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>(); - - for ( Repository r : repositories ) - { - remoteRepositories.add( buildArtifactRepository( r, artifactRepositoryFactory, c ) ); - } - - return remoteRepositories; - } - - public static ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo, - ArtifactRepositoryFactory artifactRepositoryFactory, - PlexusContainer c ) - throws InvalidRepositoryException - { - return buildArtifactRepository( repo, artifactRepositoryFactory, c ); - } - - public static ArtifactRepository buildArtifactRepository( Repository repo, - ArtifactRepositoryFactory artifactRepositoryFactory, - PlexusContainer c ) - throws InvalidRepositoryException - { - RepositorySystem repositorySystem = rs( c ); - RepositorySystemSession session = rss( c ); - - ArtifactRepository repository = repositorySystem.buildArtifactRepository( repo ); - - if ( session != null ) - { - repositorySystem.injectMirror( session, Arrays.asList( repository ) ); - repositorySystem.injectProxy( session, Arrays.asList( repository ) ); - repositorySystem.injectAuthentication( session, Arrays.asList( repository ) ); - } - - return repository; - } - - private static RepositorySystem rs( PlexusContainer c ) - { - try - { - return c.lookup( RepositorySystem.class ); - } - catch ( ComponentLookupException e ) - { - throw new IllegalStateException( e ); - } - } - - private static RepositorySystemSession rss( PlexusContainer c ) - { - try - { - LegacySupport legacySupport = c.lookup( LegacySupport.class ); - - return legacySupport.getRepositorySession(); - } - catch ( ComponentLookupException e ) - { - throw new IllegalStateException( e ); - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java deleted file mode 100644 index 4b08eb96..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java +++ /dev/null @@ -1,752 +0,0 @@ -package org.apache.maven.project.inheritance; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.TreeMap; - -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.DistributionManagement; -import org.apache.maven.model.Extension; -import org.apache.maven.model.Model; -import org.apache.maven.model.PluginManagement; -import org.apache.maven.model.ReportPlugin; -import org.apache.maven.model.ReportSet; -import org.apache.maven.model.Reporting; -import org.apache.maven.model.Resource; -import org.apache.maven.model.Scm; -import org.apache.maven.model.Site; -import org.apache.maven.project.ModelUtils; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.util.StringUtils; -import org.codehaus.plexus.util.xml.Xpp3Dom; - -@Component( role = ModelInheritanceAssembler.class ) -public class DefaultModelInheritanceAssembler - implements ModelInheritanceAssembler -{ - // TODO: Remove this! - @SuppressWarnings( "unchecked" ) - public void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheritance ) - { - // The build has been set but we want to step in here and fill in - // values that have not been set by the child. - - if ( childBuild.getSourceDirectory() == null ) - { - childBuild.setSourceDirectory( parentBuild.getSourceDirectory() ); - } - - if ( childBuild.getScriptSourceDirectory() == null ) - { - childBuild.setScriptSourceDirectory( parentBuild.getScriptSourceDirectory() ); - } - - if ( childBuild.getTestSourceDirectory() == null ) - { - childBuild.setTestSourceDirectory( parentBuild.getTestSourceDirectory() ); - } - - if ( childBuild.getOutputDirectory() == null ) - { - childBuild.setOutputDirectory( parentBuild.getOutputDirectory() ); - } - - if ( childBuild.getTestOutputDirectory() == null ) - { - childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() ); - } - - // Extensions are accumulated - mergeExtensionLists( childBuild, parentBuild ); - - if ( childBuild.getDirectory() == null ) - { - childBuild.setDirectory( parentBuild.getDirectory() ); - } - - if ( childBuild.getDefaultGoal() == null ) - { - childBuild.setDefaultGoal( parentBuild.getDefaultGoal() ); - } - - if ( childBuild.getFinalName() == null ) - { - childBuild.setFinalName( parentBuild.getFinalName() ); - } - - ModelUtils.mergeFilterLists( childBuild.getFilters(), parentBuild.getFilters() ); - - List<Resource> resources = childBuild.getResources(); - if ( ( resources == null ) || resources.isEmpty() ) - { - childBuild.setResources( parentBuild.getResources() ); - } - - resources = childBuild.getTestResources(); - if ( ( resources == null ) || resources.isEmpty() ) - { - childBuild.setTestResources( parentBuild.getTestResources() ); - } - - // Plugins are aggregated if Plugin.inherit != false - ModelUtils.mergePluginLists( childBuild, parentBuild, handleAsInheritance ); - - // Plugin management :: aggregate - PluginManagement dominantPM = childBuild.getPluginManagement(); - PluginManagement recessivePM = parentBuild.getPluginManagement(); - - if ( ( dominantPM == null ) && ( recessivePM != null ) ) - { - // FIXME: Filter out the inherited == false stuff! - childBuild.setPluginManagement( recessivePM ); - } - else - { - ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(), false ); - } - } - - private void assembleScmInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) - { - if ( parent.getScm() != null ) - { - Scm parentScm = parent.getScm(); - - Scm childScm = child.getScm(); - - if ( childScm == null ) - { - childScm = new Scm(); - - child.setScm( childScm ); - } - - if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) ) - { - childScm.setConnection( - appendPath( parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); - } - - if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) - && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) ) - { - childScm - .setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), - childPathAdjustment, appendPaths ) ); - } - - if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) ) - { - childScm.setUrl( - appendPath( parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); - } - } - } - - public void copyModel( Model dest, Model source ) - { - assembleModelInheritance( dest, source, null, false ); - } - - public void assembleModelInheritance( Model child, Model parent, String childPathAdjustment ) - { - assembleModelInheritance( child, parent, childPathAdjustment, true ); - } - - public void assembleModelInheritance( Model child, Model parent ) - { - assembleModelInheritance( child, parent, null, true ); - } - - private void assembleModelInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) - { - // cannot inherit from null parent. - if ( parent == null ) - { - return; - } - - // Group id - if ( child.getGroupId() == null ) - { - child.setGroupId( parent.getGroupId() ); - } - - // version - if ( child.getVersion() == null ) - { - // The parent version may have resolved to something different, so we take what we asked for... - // instead of - child.setVersion( parent.getVersion() ); - - if ( child.getParent() != null ) - { - child.setVersion( child.getParent().getVersion() ); - } - } - - // inceptionYear - if ( child.getInceptionYear() == null ) - { - child.setInceptionYear( parent.getInceptionYear() ); - } - - // url - if ( child.getUrl() == null ) - { - if ( parent.getUrl() != null ) - { - child.setUrl( appendPath( parent.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); - } - else - { - child.setUrl( parent.getUrl() ); - } - } - - assembleDistributionInheritence( child, parent, childPathAdjustment, appendPaths ); - - // issueManagement - if ( child.getIssueManagement() == null ) - { - child.setIssueManagement( parent.getIssueManagement() ); - } - - // description - if ( child.getDescription() == null ) - { - child.setDescription( parent.getDescription() ); - } - - // Organization - if ( child.getOrganization() == null ) - { - child.setOrganization( parent.getOrganization() ); - } - - // Scm - assembleScmInheritance( child, parent, childPathAdjustment, appendPaths ); - - // ciManagement - if ( child.getCiManagement() == null ) - { - child.setCiManagement( parent.getCiManagement() ); - } - - // developers - if ( child.getDevelopers().size() == 0 ) - { - child.setDevelopers( parent.getDevelopers() ); - } - - // licenses - if ( child.getLicenses().size() == 0 ) - { - child.setLicenses( parent.getLicenses() ); - } - - // developers - if ( child.getContributors().size() == 0 ) - { - child.setContributors( parent.getContributors() ); - } - - // mailingLists - if ( child.getMailingLists().size() == 0 ) - { - child.setMailingLists( parent.getMailingLists() ); - } - - // Build - assembleBuildInheritance( child, parent ); - - assembleDependencyInheritance( child, parent ); - - child.setRepositories( ModelUtils.mergeRepositoryLists( child.getRepositories(), parent.getRepositories() ) ); -// child.setPluginRepositories( -// ModelUtils.mergeRepositoryLists( child.getPluginRepositories(), parent.getPluginRepositories() ) ); - - assembleReportingInheritance( child, parent ); - - assembleDependencyManagementInheritance( child, parent ); - - Properties props = new Properties(); - props.putAll( parent.getProperties() ); - props.putAll( child.getProperties() ); - - child.setProperties( props ); - } - - // TODO: Remove this! - @SuppressWarnings( "unchecked" ) - private void assembleDependencyManagementInheritance( Model child, Model parent ) - { - DependencyManagement parentDepMgmt = parent.getDependencyManagement(); - - DependencyManagement childDepMgmt = child.getDependencyManagement(); - - if ( parentDepMgmt != null ) - { - if ( childDepMgmt == null ) - { - child.setDependencyManagement( parentDepMgmt ); - } - else - { - List<Dependency> childDeps = childDepMgmt.getDependencies(); - - Map<String, Dependency> mappedChildDeps = new TreeMap<String, Dependency>(); - for ( Dependency dep : childDeps ) - { - mappedChildDeps.put( dep.getManagementKey(), dep ); - } - - for ( Dependency dep : parentDepMgmt.getDependencies() ) - { - if ( !mappedChildDeps.containsKey( dep.getManagementKey() ) ) - { - childDepMgmt.addDependency( dep ); - } - } - } - } - } - - private void assembleReportingInheritance( Model child, Model parent ) - { - // Reports :: aggregate - Reporting childReporting = child.getReporting(); - Reporting parentReporting = parent.getReporting(); - - if ( parentReporting != null ) - { - if ( childReporting == null ) - { - childReporting = new Reporting(); - child.setReporting( childReporting ); - } - - childReporting.setExcludeDefaults( parentReporting.isExcludeDefaults() ); - - if ( StringUtils.isEmpty( childReporting.getOutputDirectory() ) ) - { - childReporting.setOutputDirectory( parentReporting.getOutputDirectory() ); - } - - mergeReportPluginLists( childReporting, parentReporting, true ); - } - } - - private static void mergeReportPluginLists( Reporting child, Reporting parent, boolean handleAsInheritance ) - { - if ( ( child == null ) || ( parent == null ) ) - { - // nothing to do. - return; - } - - List<ReportPlugin> parentPlugins = parent.getPlugins(); - - if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() ) - { - Map<String, ReportPlugin> assembledPlugins = new TreeMap<String, ReportPlugin>(); - - Map<String, ReportPlugin> childPlugins = child.getReportPluginsAsMap(); - - for ( ReportPlugin parentPlugin : parentPlugins ) - { - String parentInherited = parentPlugin.getInherited(); - - if ( !handleAsInheritance || ( parentInherited == null ) || Boolean.valueOf( parentInherited ) ) - { - - ReportPlugin assembledPlugin = parentPlugin; - - ReportPlugin childPlugin = childPlugins.get( parentPlugin.getKey() ); - - if ( childPlugin != null ) - { - assembledPlugin = childPlugin; - - mergeReportPluginDefinitions( childPlugin, parentPlugin, handleAsInheritance ); - } - - if ( handleAsInheritance && ( parentInherited == null ) ) - { - assembledPlugin.unsetInheritanceApplied(); - } - - assembledPlugins.put( assembledPlugin.getKey(), assembledPlugin ); - } - } - - for ( ReportPlugin childPlugin : childPlugins.values() ) - { - if ( !assembledPlugins.containsKey( childPlugin.getKey() ) ) - { - assembledPlugins.put( childPlugin.getKey(), childPlugin ); - } - } - - child.setPlugins( new ArrayList<ReportPlugin>( assembledPlugins.values() ) ); - - child.flushReportPluginMap(); - } - } - - private static void mergeReportSetDefinitions( ReportSet child, ReportSet parent ) - { - List<String> parentReports = parent.getReports(); - List<String> childReports = child.getReports(); - - List<String> reports = new ArrayList<String>(); - - if ( ( childReports != null ) && !childReports.isEmpty() ) - { - reports.addAll( childReports ); - } - - if ( parentReports != null ) - { - for ( String report : parentReports ) - { - if ( !reports.contains( report ) ) - { - reports.add( report ); - } - } - } - - child.setReports( reports ); - - Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); - Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); - - childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); - - child.setConfiguration( childConfiguration ); - } - - - public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent, - boolean handleAsInheritance ) - { - if ( ( child == null ) || ( parent == null ) ) - { - // nothing to do. - return; - } - - if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) ) - { - child.setVersion( parent.getVersion() ); - } - - // from here to the end of the method is dealing with merging of the <executions/> section. - String parentInherited = parent.getInherited(); - - boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ); - - List<ReportSet> parentReportSets = parent.getReportSets(); - - if ( ( parentReportSets != null ) && !parentReportSets.isEmpty() ) - { - Map<String, ReportSet> assembledReportSets = new TreeMap<String, ReportSet>(); - - Map<String, ReportSet> childReportSets = child.getReportSetsAsMap(); - - for ( Object parentReportSet1 : parentReportSets ) - { - ReportSet parentReportSet = (ReportSet) parentReportSet1; - - if ( !handleAsInheritance || parentIsInherited ) - { - ReportSet assembledReportSet = parentReportSet; - - ReportSet childReportSet = childReportSets.get( parentReportSet.getId() ); - - if ( childReportSet != null ) - { - mergeReportSetDefinitions( childReportSet, parentReportSet ); - - assembledReportSet = childReportSet; - } - else if ( handleAsInheritance && ( parentInherited == null ) ) - { - parentReportSet.unsetInheritanceApplied(); - } - - assembledReportSets.put( assembledReportSet.getId(), assembledReportSet ); - } - } - - for ( Map.Entry<String, ReportSet> entry : childReportSets.entrySet() ) - { - String id = entry.getKey(); - - if ( !assembledReportSets.containsKey( id ) ) - { - assembledReportSets.put( id, entry.getValue() ); - } - } - - child.setReportSets( new ArrayList<ReportSet>( assembledReportSets.values() ) ); - - child.flushReportSetMap(); - } - - } - - // TODO: Remove this! - @SuppressWarnings( "unchecked" ) - private void assembleDependencyInheritance( Model child, Model parent ) - { - Map<String, Dependency> depsMap = new LinkedHashMap<String, Dependency>(); - - List<Dependency> deps = parent.getDependencies(); - - if ( deps != null ) - { - for ( Dependency dependency : deps ) - { - depsMap.put( dependency.getManagementKey(), dependency ); - } - } - - deps = child.getDependencies(); - - if ( deps != null ) - { - for ( Dependency dependency : deps ) - { - depsMap.put( dependency.getManagementKey(), dependency ); - } - } - - child.setDependencies( new ArrayList<Dependency>( depsMap.values() ) ); - } - - private void assembleBuildInheritance( Model child, Model parent ) - { - Build childBuild = child.getBuild(); - Build parentBuild = parent.getBuild(); - - if ( parentBuild != null ) - { - if ( childBuild == null ) - { - childBuild = new Build(); - child.setBuild( childBuild ); - } - - assembleBuildInheritance( childBuild, parentBuild, true ); - } - } - - private void assembleDistributionInheritence( Model child, Model parent, String childPathAdjustment, - boolean appendPaths ) - { - if ( parent.getDistributionManagement() != null ) - { - DistributionManagement parentDistMgmt = parent.getDistributionManagement(); - - DistributionManagement childDistMgmt = child.getDistributionManagement(); - - if ( childDistMgmt == null ) - { - childDistMgmt = new DistributionManagement(); - - child.setDistributionManagement( childDistMgmt ); - } - - if ( childDistMgmt.getSite() == null ) - { - if ( parentDistMgmt.getSite() != null ) - { - Site site = new Site(); - - childDistMgmt.setSite( site ); - - site.setId( parentDistMgmt.getSite().getId() ); - - site.setName( parentDistMgmt.getSite().getName() ); - - site.setUrl( parentDistMgmt.getSite().getUrl() ); - - if ( site.getUrl() != null ) - { - site.setUrl( - appendPath( site.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); - } - } - } - - if ( childDistMgmt.getRepository() == null ) - { - if ( parentDistMgmt.getRepository() != null ) - { - DeploymentRepository repository = copyDistributionRepository( parentDistMgmt.getRepository() ); - childDistMgmt.setRepository( repository ); - } - } - - if ( childDistMgmt.getSnapshotRepository() == null ) - { - if ( parentDistMgmt.getSnapshotRepository() != null ) - { - DeploymentRepository repository = - copyDistributionRepository( parentDistMgmt.getSnapshotRepository() ); - childDistMgmt.setSnapshotRepository( repository ); - } - } - - if ( StringUtils.isEmpty( childDistMgmt.getDownloadUrl() ) ) - { - childDistMgmt.setDownloadUrl( parentDistMgmt.getDownloadUrl() ); - } - - // NOTE: We SHOULD NOT be inheriting status, since this is an assessment of the POM quality. - // NOTE: We SHOULD NOT be inheriting relocation, since this relates to a single POM - } - } - - private static DeploymentRepository copyDistributionRepository( DeploymentRepository parentRepository ) - { - DeploymentRepository repository = new DeploymentRepository(); - - repository.setId( parentRepository.getId() ); - - repository.setName( parentRepository.getName() ); - - repository.setUrl( parentRepository.getUrl() ); - - repository.setLayout( parentRepository.getLayout() ); - - repository.setUniqueVersion( parentRepository.isUniqueVersion() ); - - return repository; - } - - // TODO: This should eventually be migrated to DefaultPathTranslator. - protected String appendPath( String parentPath, String childPath, String pathAdjustment, boolean appendPaths ) - { - String uncleanPath = parentPath; - - if ( appendPaths ) - { - if ( pathAdjustment != null ) - { - uncleanPath += "/" + pathAdjustment; - } - - if ( childPath != null ) - { - uncleanPath += "/" + childPath; - } - } - - String cleanedPath = ""; - - int protocolIdx = uncleanPath.indexOf( "://" ); - - if ( protocolIdx > -1 ) - { - cleanedPath = uncleanPath.substring( 0, protocolIdx + 3 ); - uncleanPath = uncleanPath.substring( protocolIdx + 3 ); - } - - if ( uncleanPath.startsWith( "/" ) ) - { - cleanedPath += "/"; - } - - return cleanedPath + resolvePath( uncleanPath ); - } - - // TODO: Move this to plexus-utils' PathTool. - private static String resolvePath( String uncleanPath ) - { - LinkedList<String> pathElements = new LinkedList<String>(); - - StringTokenizer tokenizer = new StringTokenizer( uncleanPath, "/" ); - - while ( tokenizer.hasMoreTokens() ) - { - String token = tokenizer.nextToken(); - - if ( token.equals( "" ) ) - { - // Empty path entry ("...//.."), remove. - } - else if ( token.equals( ".." ) ) - { - if ( pathElements.isEmpty() ) - { - // FIXME: somehow report to the user - // that there are too many '..' elements. - // For now, ignore the extra '..'. - } - else - { - pathElements.removeLast(); - } - } - else - { - pathElements.addLast( token ); - } - } - - StringBuilder cleanedPath = new StringBuilder(); - - while ( !pathElements.isEmpty() ) - { - cleanedPath.append( pathElements.removeFirst() ); - if ( !pathElements.isEmpty() ) - { - cleanedPath.append( '/' ); - } - } - - return cleanedPath.toString(); - } - - private static void mergeExtensionLists( Build childBuild, Build parentBuild ) - { - for ( Extension e : parentBuild.getExtensions() ) - { - if ( !childBuild.getExtensions().contains( e ) ) - { - childBuild.addExtension( e ); - } - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java deleted file mode 100644 index ef4edca5..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.apache.maven.project.inheritance; - -/* - * 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.model.Build; -import org.apache.maven.model.Model; - -/** - * @author Jason van Zyl - * @deprecated - */ -@Deprecated -public interface ModelInheritanceAssembler -{ - String ROLE = ModelInheritanceAssembler.class.getName(); - - void assembleModelInheritance( Model child, Model parent, String childPathAdjustment ); - - void assembleModelInheritance( Model child, Model parent ); - - void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheriance ); - - void copyModel( Model dest, Model source ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java deleted file mode 100644 index dfc3deec..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java +++ /dev/null @@ -1,407 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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.model.Model; -import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.model.io.xpp3.MavenXpp3Writer; -import org.apache.maven.project.DefaultProjectBuilderConfiguration; -import org.apache.maven.project.ProjectBuilderConfiguration; -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.interpolation.AbstractValueSource; -import org.codehaus.plexus.interpolation.InterpolationException; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.MapBasedValueSource; -import org.codehaus.plexus.interpolation.ObjectBasedValueSource; -import org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor; -import org.codehaus.plexus.interpolation.PrefixedObjectValueSource; -import org.codehaus.plexus.interpolation.PrefixedValueSourceWrapper; -import org.codehaus.plexus.interpolation.RecursionInterceptor; -import org.codehaus.plexus.interpolation.ValueSource; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -/** - * Use a regular expression search to find and resolve expressions within the POM. - * - * @author jdcasey Created on Feb 3, 2005 - * @todo Consolidate this logic with the PluginParameterExpressionEvaluator, minus deprecations/bans. - */ -@Deprecated -public abstract class AbstractStringBasedModelInterpolator - extends AbstractLogEnabled - implements ModelInterpolator, Initializable -{ - private static final List<String> PROJECT_PREFIXES = Arrays.asList( "pom.", "project." ); - - private static final List<String> TRANSLATED_PATH_EXPRESSIONS; - - static - { - List<String> translatedPrefixes = new ArrayList<String>(); - - // MNG-1927, MNG-2124, MNG-3355: - // If the build section is present and the project directory is non-null, we should make - // sure interpolation of the directories below uses translated paths. - // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the - // code below... - translatedPrefixes.add( "build.directory" ); - translatedPrefixes.add( "build.outputDirectory" ); - translatedPrefixes.add( "build.testOutputDirectory" ); - translatedPrefixes.add( "build.sourceDirectory" ); - translatedPrefixes.add( "build.testSourceDirectory" ); - translatedPrefixes.add( "build.scriptSourceDirectory" ); - translatedPrefixes.add( "reporting.outputDirectory" ); - - TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes; - } - - @Requirement - private PathTranslator pathTranslator; - - private Interpolator interpolator; - - private RecursionInterceptor recursionInterceptor; - - // for testing. - protected AbstractStringBasedModelInterpolator( PathTranslator pathTranslator ) - { - this.pathTranslator = pathTranslator; - } - - /** - * @todo: Remove the throws clause. - * @throws IOException This exception is not thrown any more, and needs to be removed. - */ - protected AbstractStringBasedModelInterpolator() - { - } - - public Model interpolate( Model model, Map<String, ?> context ) - throws ModelInterpolationException - { - return interpolate( model, context, true ); - } - - /** - * Serialize the inbound Model instance to a StringWriter, perform the regex replacement to resolve - * POM expressions, then re-parse into the resolved Model instance. - * <br/> - * <b>NOTE:</b> This will result in a different instance of Model being returned!!! - * - * @param model The inbound Model instance, to serialize and reference for expression resolution - * @param context The other context map to be used during resolution - * @return The resolved instance of the inbound Model. This is a different instance! - * - * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. - */ - public Model interpolate( Model model, Map<String, ?> context, boolean strict ) - throws ModelInterpolationException - { - Properties props = new Properties(); - props.putAll( context ); - - return interpolate( model, - null, - new DefaultProjectBuilderConfiguration().setExecutionProperties( props ), - true ); - } - - public Model interpolate( Model model, - File projectDir, - ProjectBuilderConfiguration config, - boolean debugEnabled ) - throws ModelInterpolationException - { - StringWriter sWriter = new StringWriter( 1024 ); - - MavenXpp3Writer writer = new MavenXpp3Writer(); - try - { - writer.write( sWriter, model ); - } - catch ( IOException e ) - { - throw new ModelInterpolationException( "Cannot serialize project model for interpolation.", e ); - } - - String serializedModel = sWriter.toString(); - serializedModel = interpolate( serializedModel, model, projectDir, config, debugEnabled ); - - StringReader sReader = new StringReader( serializedModel ); - - MavenXpp3Reader modelReader = new MavenXpp3Reader(); - try - { - model = modelReader.read( sReader ); - } - catch ( IOException e ) - { - throw new ModelInterpolationException( - "Cannot read project model from interpolating filter of serialized version.", e ); - } - catch ( XmlPullParserException e ) - { - throw new ModelInterpolationException( - "Cannot read project model from interpolating filter of serialized version.", e ); - } - - return model; - } - - /** - * Interpolates all expressions in the src parameter. - * <p> - * The algorithm used for each expression is: - * <ul> - * <li>If it starts with either "pom." or "project.", the expression is evaluated against the model.</li> - * <li>If the value is null, get the value from the context.</li> - * <li>If the value is null, but the context contains the expression, don't replace the expression string - * with the value, and continue to find other expressions.</li> - * <li>If the value is null, get it from the model properties.</li> - * <li> - * @param overrideContext - * @param outputDebugMessages - */ - public String interpolate( String src, - Model model, - final File projectDir, - ProjectBuilderConfiguration config, - boolean debug ) - throws ModelInterpolationException - { - try - { - List<ValueSource> valueSources = createValueSources( model, projectDir, config ); - List<InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config ); - - return interpolateInternal( src, valueSources, postProcessors, debug ); - } - finally - { - interpolator.clearAnswers(); - } - } - - protected List<ValueSource> createValueSources( final Model model, final File projectDir, - final ProjectBuilderConfiguration config ) - { - String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT; - - Properties modelProperties = model.getProperties(); - if ( modelProperties != null ) - { - timestampFormat = modelProperties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY, timestampFormat ); - } - - ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false ); - ValueSource modelValueSource2 = new ObjectBasedValueSource( model ); - - ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ) - { - public Object getValue( String expression ) - { - if ( projectDir != null && "basedir".equals( expression ) ) - { - return projectDir.getAbsolutePath(); - } - return null; - } - }, PROJECT_PREFIXES, true ); - ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ) - { - public Object getValue( String expression ) - { - if ( projectDir != null && "baseUri".equals( expression ) ) - { - return projectDir.getAbsoluteFile().toURI().toString(); - } - return null; - } - }, PROJECT_PREFIXES, false ); - - List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 ); - - // NOTE: Order counts here! - valueSources.add( basedirValueSource ); - valueSources.add( baseUriValueSource ); - valueSources.add( new BuildTimestampValueSource( config.getBuildStartTime(), timestampFormat ) ); - valueSources.add( modelValueSource1 ); - valueSources.add( new MapBasedValueSource( config.getUserProperties() ) ); - valueSources.add( new MapBasedValueSource( modelProperties ) ); - valueSources.add( new MapBasedValueSource( config.getExecutionProperties() ) ); - valueSources.add( new AbstractValueSource( false ) - { - public Object getValue( String expression ) - { - return config.getExecutionProperties().getProperty( "env." + expression ); - } - } ); - valueSources.add( modelValueSource2 ); - - return valueSources; - } - - protected List<InterpolationPostProcessor> createPostProcessors( final Model model, final File projectDir, - final ProjectBuilderConfiguration config ) - { - return Collections.singletonList( (InterpolationPostProcessor) new PathTranslatingPostProcessor( - PROJECT_PREFIXES, - TRANSLATED_PATH_EXPRESSIONS, - projectDir, - pathTranslator ) ); - } - - @SuppressWarnings( "unchecked" ) - protected String interpolateInternal( String src, List<ValueSource> valueSources, - List<InterpolationPostProcessor> postProcessors, boolean debug ) - throws ModelInterpolationException - { - if ( !src.contains( "${" ) ) - { - return src; - } - - Logger logger = getLogger(); - - String result = src; - synchronized ( this ) - { - - for ( ValueSource vs : valueSources ) - { - interpolator.addValueSource( vs ); - } - - for ( InterpolationPostProcessor postProcessor : postProcessors ) - { - interpolator.addPostProcessor( postProcessor ); - } - - try - { - try - { - result = interpolator.interpolate( result, recursionInterceptor ); - } - catch ( InterpolationException e ) - { - throw new ModelInterpolationException( e.getMessage(), e ); - } - - if ( debug ) - { - List<Object> feedback = interpolator.getFeedback(); - if ( feedback != null && !feedback.isEmpty() ) - { - logger.debug( "Maven encountered the following problems during initial POM interpolation:" ); - - Object last = null; - for ( Object next : feedback ) - { - if ( next instanceof Throwable ) - { - if ( last == null ) - { - logger.debug( "", ( (Throwable) next ) ); - } - else - { - logger.debug( String.valueOf( last ), ( (Throwable) next ) ); - } - } - else - { - if ( last != null ) - { - logger.debug( String.valueOf( last ) ); - } - - last = next; - } - } - - if ( last != null ) - { - logger.debug( String.valueOf( last ) ); - } - } - } - - interpolator.clearFeedback(); - } - finally - { - for ( ValueSource vs : valueSources ) - { - interpolator.removeValuesSource( vs ); - } - - for ( InterpolationPostProcessor postProcessor : postProcessors ) - { - interpolator.removePostProcessor( postProcessor ); - } - } - } - - return result; - } - - protected RecursionInterceptor getRecursionInterceptor() - { - return recursionInterceptor; - } - - protected void setRecursionInterceptor( RecursionInterceptor recursionInterceptor ) - { - this.recursionInterceptor = recursionInterceptor; - } - - protected abstract Interpolator createInterpolator(); - - public void initialize() - throws InitializationException - { - interpolator = createInterpolator(); - recursionInterceptor = new PrefixAwareRecursionInterceptor( PROJECT_PREFIXES ); - } - - protected final Interpolator getInterpolator() - { - return interpolator; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java deleted file mode 100644 index f6319fa6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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.text.SimpleDateFormat; -import java.util.Date; - -import org.codehaus.plexus.interpolation.AbstractValueSource; - -/** - * - */ -@Deprecated -public class BuildTimestampValueSource - extends AbstractValueSource -{ - - private final Date startTime; - - private final String format; - - private String formattedDate; - - public BuildTimestampValueSource( Date startTime, String format ) - { - super( false ); - this.startTime = startTime; - this.format = format; - } - - public Object getValue( String expression ) - { - if ( "build.timestamp".equals( expression ) || "maven.build.timestamp".equals( expression ) ) - { - if ( formattedDate == null && startTime != null ) - { - formattedDate = new SimpleDateFormat( format ).format( startTime ); - } - - return formattedDate; - } - - return null; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java deleted file mode 100644 index 5b02880b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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 jdcasey - * <p/> - * Created on Feb 2, 2005 - */ -@SuppressWarnings( "serial" ) -@Deprecated -public class ModelInterpolationException - extends Exception -{ - private String expression; - - private String originalMessage; - - public ModelInterpolationException( String message ) - { - super( message ); - } - - public ModelInterpolationException( String message, Throwable cause ) - { - super( message, cause ); - } - - public ModelInterpolationException( String expression, String message, Throwable cause ) - { - super( "The POM expression: " + expression + " could not be evaluated. Reason: " + message, cause ); - - this.expression = expression; - this.originalMessage = message; - } - - public ModelInterpolationException( String expression, String message ) - { - super( "The POM expression: " + expression + " could not be evaluated. Reason: " + message ); - - this.expression = expression; - this.originalMessage = message; - } - - public String getExpression() - { - return expression; - } - - public String getOriginalMessage() - { - return originalMessage; - } - -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java deleted file mode 100644 index e1556eaf..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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.model.Model; -import org.apache.maven.project.ProjectBuilderConfiguration; - -import java.io.File; -import java.util.Map; - -/** - * @author jdcasey - * <p/> - * Created on Feb 2, 2005 - */ -@Deprecated -public interface ModelInterpolator -{ - String DEFAULT_BUILD_TIMESTAMP_FORMAT = "yyyyMMdd-HHmm"; - - String BUILD_TIMESTAMP_FORMAT_PROPERTY = "maven.build.timestamp.format"; - - String ROLE = ModelInterpolator.class.getName(); - - /** - * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. - */ - Model interpolate( Model project, Map<String, ?> context ) - throws ModelInterpolationException; - - /** - * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. - */ - Model interpolate( Model model, Map<String, ?> context, boolean strict ) - throws ModelInterpolationException; - - Model interpolate( Model model, - File projectDir, - ProjectBuilderConfiguration config, - boolean debugEnabled ) - throws ModelInterpolationException; - - String interpolate( String src, - Model model, - File projectDir, - ProjectBuilderConfiguration config, - boolean debugEnabled ) - throws ModelInterpolationException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java deleted file mode 100644 index da2ba056..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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.project.path.PathTranslator; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.util.ValueSourceUtils; - -import java.io.File; -import java.util.List; - -/** - * - */ -@Deprecated -public class PathTranslatingPostProcessor - implements InterpolationPostProcessor -{ - - private final List<String> unprefixedPathKeys; - private final File projectDir; - private final PathTranslator pathTranslator; - private final List<String> expressionPrefixes; - - public PathTranslatingPostProcessor( List<String> expressionPrefixes, List<String> unprefixedPathKeys, - File projectDir, PathTranslator pathTranslator ) - { - this.expressionPrefixes = expressionPrefixes; - this.unprefixedPathKeys = unprefixedPathKeys; - this.projectDir = projectDir; - this.pathTranslator = pathTranslator; - } - - public Object execute( String expression, - Object value ) - { - expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true ); - - if ( projectDir != null && value != null && unprefixedPathKeys.contains( expression ) ) - { - return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir ); - } - - return value; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java deleted file mode 100644 index 4e251aee..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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.IOException; -import java.util.Properties; - -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.RegexBasedInterpolator; - -/** - * Use a regular expression search to find and resolve expressions within the POM. - * - * @author jdcasey Created on Feb 3, 2005 - * @todo Consolidate this logic with the PluginParameterExpressionEvaluator, minus deprecations/bans. - */ -@Deprecated -public class RegexBasedModelInterpolator - extends AbstractStringBasedModelInterpolator -{ - - public RegexBasedModelInterpolator() - throws IOException - { - } - - public RegexBasedModelInterpolator( PathTranslator pathTranslator ) - { - super( pathTranslator ); - } - - public RegexBasedModelInterpolator( Properties envars ) - { - } - - protected Interpolator createInterpolator() - { - return new RegexBasedInterpolator( true ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java deleted file mode 100644 index 864f57f0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java +++ /dev/null @@ -1,410 +0,0 @@ -package org.apache.maven.project.interpolation; - -/* - * 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.model.Model; -import org.apache.maven.project.ProjectBuilderConfiguration; -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.StringSearchInterpolator; -import org.codehaus.plexus.interpolation.ValueSource; -import org.codehaus.plexus.logging.Logger; - -import java.io.File; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; - -@Deprecated -@Component( role = ModelInterpolator.class ) -public class StringSearchModelInterpolator - extends AbstractStringBasedModelInterpolator -{ - - private static final Map<Class<?>, Field[]> fieldsByClass = new WeakHashMap<Class<?>, Field[]>(); - private static final Map<Class<?>, Boolean> fieldIsPrimitiveByClass = new WeakHashMap<Class<?>, Boolean>(); - - public StringSearchModelInterpolator() - { - } - - public StringSearchModelInterpolator( PathTranslator pathTranslator ) - { - super( pathTranslator ); - } - - public Model interpolate( Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled ) - throws ModelInterpolationException - { - interpolateObject( model, model, projectDir, config, debugEnabled ); - - return model; - } - - protected void interpolateObject( Object obj, Model model, File projectDir, ProjectBuilderConfiguration config, - boolean debugEnabled ) - throws ModelInterpolationException - { - try - { - List<ValueSource> valueSources = createValueSources( model, projectDir, config ); - List<InterpolationPostProcessor> postProcessors = createPostProcessors( model, projectDir, config ); - - InterpolateObjectAction action = - new InterpolateObjectAction( obj, valueSources, postProcessors, debugEnabled, - this, getLogger() ); - - ModelInterpolationException error = AccessController.doPrivileged( action ); - - if ( error != null ) - { - throw error; - } - } - finally - { - getInterpolator().clearAnswers(); - } - } - - protected Interpolator createInterpolator() - { - StringSearchInterpolator interpolator = new StringSearchInterpolator(); - interpolator.setCacheAnswers( true ); - - return interpolator; - } - - private static final class InterpolateObjectAction implements PrivilegedAction<ModelInterpolationException> - { - - private final boolean debugEnabled; - private final LinkedList<Object> interpolationTargets; - private final StringSearchModelInterpolator modelInterpolator; - private final Logger logger; - private final List<ValueSource> valueSources; - private final List<InterpolationPostProcessor> postProcessors; - - public InterpolateObjectAction( Object target, List<ValueSource> valueSources, - List<InterpolationPostProcessor> postProcessors, boolean debugEnabled, - StringSearchModelInterpolator modelInterpolator, Logger logger ) - { - this.valueSources = valueSources; - this.postProcessors = postProcessors; - this.debugEnabled = debugEnabled; - - this.interpolationTargets = new LinkedList<Object>(); - interpolationTargets.add( target ); - - this.modelInterpolator = modelInterpolator; - this.logger = logger; - } - - public ModelInterpolationException run() - { - while ( !interpolationTargets.isEmpty() ) - { - Object obj = interpolationTargets.removeFirst(); - - try - { - traverseObjectWithParents( obj.getClass(), obj ); - } - catch ( ModelInterpolationException e ) - { - return e; - } - } - - return null; - } - - @SuppressWarnings( "unchecked" ) - private void traverseObjectWithParents( Class<?> cls, Object target ) - throws ModelInterpolationException - { - if ( cls == null ) - { - return; - } - - - if ( cls.isArray() ) - { - evaluateArray( target ); - } - else if ( isQualifiedForInterpolation( cls ) ) - { - Field[] fields = fieldsByClass.get( cls ); - if ( fields == null ) - { - fields = cls.getDeclaredFields(); - fieldsByClass.put( cls, fields ); - } - - for ( Field field : fields ) - { - Class<?> type = field.getType(); - if ( isQualifiedForInterpolation( field, type ) ) - { - boolean isAccessible = field.isAccessible(); - field.setAccessible( true ); - try - { - try - { - if ( String.class == type ) - { - String value = (String) field.get( target ); - if ( value != null ) - { - String interpolated = - modelInterpolator.interpolateInternal( value, valueSources, postProcessors, - debugEnabled ); - - if ( !interpolated.equals( value ) ) - { - field.set( target, interpolated ); - } - } - } - else if ( Collection.class.isAssignableFrom( type ) ) - { - Collection<Object> c = (Collection<Object>) field.get( target ); - if ( c != null && !c.isEmpty() ) - { - List<Object> originalValues = new ArrayList<Object>( c ); - try - { - c.clear(); - } - catch ( UnsupportedOperationException e ) - { - if ( debugEnabled && logger != null ) - { - logger.debug( "Skipping interpolation of field: " + field + " in: " - + cls.getName() - + "; it is an unmodifiable collection." ); - } - continue; - } - - for ( Object value : originalValues ) - { - if ( value != null ) - { - if ( String.class == value.getClass() ) - { - String interpolated = - modelInterpolator.interpolateInternal( (String) value, - valueSources, - postProcessors, - debugEnabled ); - - if ( !interpolated.equals( value ) ) - { - c.add( interpolated ); - } - else - { - c.add( value ); - } - } - else - { - c.add( value ); - if ( value.getClass().isArray() ) - { - evaluateArray( value ); - } - else - { - interpolationTargets.add( value ); - } - } - } - else - { - // add the null back in...not sure what else to do... - c.add( value ); - } - } - } - } - else if ( Map.class.isAssignableFrom( type ) ) - { - Map<Object, Object> m = (Map<Object, Object>) field.get( target ); - if ( m != null && !m.isEmpty() ) - { - for ( Map.Entry<Object, Object> entry : m.entrySet() ) - { - Object value = entry.getValue(); - - if ( value != null ) - { - if ( String.class == value.getClass() ) - { - String interpolated = - modelInterpolator.interpolateInternal( (String) value, - valueSources, - postProcessors, - debugEnabled ); - - if ( !interpolated.equals( value ) ) - { - try - { - entry.setValue( interpolated ); - } - catch ( UnsupportedOperationException e ) - { - if ( debugEnabled && logger != null ) - { - logger.debug( - "Skipping interpolation of field: " + field - + " (key: " + entry.getKey() + ") in: " - + cls.getName() - + "; it is an unmodifiable collection." ); - } - } - } - } - else - { - if ( value.getClass().isArray() ) - { - evaluateArray( value ); - } - else - { - interpolationTargets.add( value ); - } - } - } - } - } - } - else - { - Object value = field.get( target ); - if ( value != null ) - { - if ( field.getType().isArray() ) - { - evaluateArray( value ); - } - else - { - interpolationTargets.add( value ); - } - } - } - } - catch ( IllegalArgumentException e ) - { - throw new ModelInterpolationException( - "Failed to interpolate field: " + field + " on class: " + cls.getName(), e ); - } - catch ( IllegalAccessException e ) - { - throw new ModelInterpolationException( - "Failed to interpolate field: " + field + " on class: " + cls.getName(), e ); - } - } - finally - { - field.setAccessible( isAccessible ); - } - } - } - - traverseObjectWithParents( cls.getSuperclass(), target ); - } - } - - private boolean isQualifiedForInterpolation( Class<?> cls ) - { - return !cls.getPackage().getName().startsWith( "java" ); - } - - private boolean isQualifiedForInterpolation( Field field, Class<?> fieldType ) - { - if ( !fieldIsPrimitiveByClass.containsKey( fieldType ) ) - { - fieldIsPrimitiveByClass.put( fieldType, fieldType.isPrimitive() ); - } - - if ( fieldIsPrimitiveByClass.get( fieldType ) ) - { - return false; - } - -// if ( fieldType.isPrimitive() ) -// { -// return false; -// } - - if ( "parent".equals( field.getName() ) ) - { - return false; - } - - return true; - } - - private void evaluateArray( Object target ) - throws ModelInterpolationException - { - int len = Array.getLength( target ); - for ( int i = 0; i < len; i++ ) - { - Object value = Array.get( target, i ); - if ( value != null ) - { - if ( String.class == value.getClass() ) - { - String interpolated = - modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, - debugEnabled ); - - if ( !interpolated.equals( value ) ) - { - Array.set( target, i, interpolated ); - } - } - else - { - interpolationTargets.add( value ); - } - } - } - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java deleted file mode 100644 index ece7c397..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java +++ /dev/null @@ -1,261 +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 java.util.ArrayList; -import java.util.List; - -import org.apache.maven.model.Build; -import org.apache.maven.model.Model; -import org.apache.maven.model.Reporting; -import org.apache.maven.model.Resource; -import org.codehaus.plexus.component.annotations.Component; - -@Deprecated -@Component( role = PathTranslator.class ) -public class DefaultPathTranslator - implements PathTranslator -{ - private static final String[] BASEDIR_EXPRESSIONS = {"${basedir}", "${pom.basedir}", "${project.basedir}"}; - - public void alignToBaseDirectory( Model model, File basedir ) - { - if ( basedir == null ) - { - return; - } - - Build build = model.getBuild(); - - if ( build != null ) - { - build.setDirectory( alignToBaseDirectory( build.getDirectory(), basedir ) ); - - build.setSourceDirectory( alignToBaseDirectory( build.getSourceDirectory(), basedir ) ); - - build.setTestSourceDirectory( alignToBaseDirectory( build.getTestSourceDirectory(), basedir ) ); - - for ( Resource resource : build.getResources() ) - { - resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); - } - - for ( Resource resource : build.getTestResources() ) - { - resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); - } - - if ( build.getFilters() != null ) - { - List<String> filters = new ArrayList<String>(); - for ( String filter : build.getFilters() ) - { - filters.add( alignToBaseDirectory( filter, basedir ) ); - } - build.setFilters( filters ); - } - - build.setOutputDirectory( alignToBaseDirectory( build.getOutputDirectory(), basedir ) ); - - build.setTestOutputDirectory( alignToBaseDirectory( build.getTestOutputDirectory(), basedir ) ); - } - - Reporting reporting = model.getReporting(); - - if ( reporting != null ) - { - reporting.setOutputDirectory( alignToBaseDirectory( reporting.getOutputDirectory(), basedir ) ); - } - } - - public String alignToBaseDirectory( String path, File basedir ) - { - if ( basedir == null ) - { - return path; - } - - if ( path == null ) - { - return null; - } - - String s = stripBasedirToken( path ); - - File file = new File( s ); - if ( file.isAbsolute() ) - { - // path was already absolute, just normalize file separator and we're done - s = file.getPath(); - } - else if ( file.getPath().startsWith( File.separator ) ) - { - // drive-relative Windows path, don't align with project directory but with drive root - s = file.getAbsolutePath(); - } - else - { - // an ordinary relative path, align with project directory - s = new File( new File( basedir, s ).toURI().normalize() ).getAbsolutePath(); - } - - return s; - } - - private String stripBasedirToken( String s ) - { - if ( s != null ) - { - String basedirExpr = null; - for ( String BASEDIR_EXPRESSION : BASEDIR_EXPRESSIONS ) - { - basedirExpr = BASEDIR_EXPRESSION; - if ( s.startsWith( basedirExpr ) ) - { - break; - } - else - { - basedirExpr = null; - } - } - - if ( basedirExpr != null ) - { - if ( s.length() > basedirExpr.length() ) - { - // Take out basedir expression and the leading slash - s = chopLeadingFileSeparator( s.substring( basedirExpr.length() ) ); - } - else - { - s = "."; - } - } - } - - return s; - } - - /** - * Removes the leading directory separator from the specified filesystem path (if any). For platform-independent - * behavior, this method accepts both the forward slash and the backward slash as separator. - * - * @param path The filesystem path, may be <code>null</code>. - * @return The altered filesystem path or <code>null</code> if the input path was <code>null</code>. - */ - private String chopLeadingFileSeparator( String path ) - { - if ( path != null ) - { - if ( path.startsWith( "/" ) || path.startsWith( "\\" ) ) - { - path = path.substring( 1 ); - } - } - return path; - } - - public void unalignFromBaseDirectory( Model model, File basedir ) - { - if ( basedir == null ) - { - return; - } - - Build build = model.getBuild(); - - if ( build != null ) - { - build.setDirectory( unalignFromBaseDirectory( build.getDirectory(), basedir ) ); - - build.setSourceDirectory( unalignFromBaseDirectory( build.getSourceDirectory(), basedir ) ); - - build.setTestSourceDirectory( unalignFromBaseDirectory( build.getTestSourceDirectory(), basedir ) ); - - for ( Resource resource : build.getResources() ) - { - resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) ); - } - - for ( Resource resource : build.getTestResources() ) - { - resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) ); - } - - if ( build.getFilters() != null ) - { - List<String> filters = new ArrayList<String>(); - for ( String filter : build.getFilters() ) - { - filters.add( unalignFromBaseDirectory( filter, basedir ) ); - } - build.setFilters( filters ); - } - - build.setOutputDirectory( unalignFromBaseDirectory( build.getOutputDirectory(), basedir ) ); - - build.setTestOutputDirectory( unalignFromBaseDirectory( build.getTestOutputDirectory(), basedir ) ); - } - - Reporting reporting = model.getReporting(); - - if ( reporting != null ) - { - reporting.setOutputDirectory( unalignFromBaseDirectory( reporting.getOutputDirectory(), basedir ) ); - } - } - - public String unalignFromBaseDirectory( String path, File basedir ) - { - if ( basedir == null ) - { - return path; - } - - if ( path == null ) - { - return null; - } - - path = path.trim(); - - String base = basedir.getAbsolutePath(); - if ( path.startsWith( base ) ) - { - path = chopLeadingFileSeparator( path.substring( base.length() ) ); - } - - if ( path.length() <= 0 ) - { - path = "."; - } - - if ( !new File( path ).isAbsolute() ) - { - path = path.replace( '\\', '/' ); - } - - return path; - } - -} - diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java deleted file mode 100644 index 0095f803..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.apache.maven.project.validation; - -/* - * 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.model.Model; -import org.apache.maven.model.building.DefaultModelBuildingRequest; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.building.ModelProblemCollectorRequest; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> - */ -@Component( role = ModelValidator.class ) -@Deprecated -public class DefaultModelValidator - implements ModelValidator -{ - - @Requirement - private org.apache.maven.model.validation.ModelValidator modelValidator; - - public ModelValidationResult validate( Model model ) - { - ModelValidationResult result = new ModelValidationResult(); - - ModelBuildingRequest request = - new DefaultModelBuildingRequest().setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 ); - - SimpleModelProblemCollector problems = new SimpleModelProblemCollector( result ); - - modelValidator.validateEffectiveModel( model, request, problems ); - - return result; - } - - private static class SimpleModelProblemCollector - implements ModelProblemCollector - { - - ModelValidationResult result; - - public SimpleModelProblemCollector( ModelValidationResult result ) - { - this.result = result; - } - - public void add( ModelProblemCollectorRequest req ) - { - if ( !ModelProblem.Severity.WARNING.equals( req.getSeverity() ) ) - { - result.addMessage( req.getMessage() ); - } - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java deleted file mode 100644 index cb8c6012..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.apache.maven.project.validation; - -/* - * 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.List; - -/** - * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> - */ -public class ModelValidationResult -{ - - /** */ - private static final String NEWLINE = System.getProperty( "line.separator" ); - - /** */ - private List<String> messages; - - public ModelValidationResult() - { - messages = new ArrayList<String>(); - } - - public int getMessageCount() - { - return messages.size(); - } - - public String getMessage( int i ) - { - return messages.get( i ); - } - - public List<String> getMessages() - { - return Collections.unmodifiableList( messages ); - } - - public void addMessage( String message ) - { - messages.add( message ); - } - - public String toString() - { - return render( "" ); - } - - public String render( String indentation ) - { - if ( messages.size() == 0 ) - { - return indentation + "There were no validation errors."; - } - - StringBuilder message = new StringBuilder(); - -// if ( messages.size() == 1 ) -// { -// message.append( "There was 1 validation error: " ); -// } -// else -// { -// message.append( "There was " + messages.size() + " validation errors: " + NEWLINE ); -// } -// - for ( int i = 0; i < messages.size(); i++ ) - { - message.append( indentation ).append( "[" ).append( i ).append( "] " ).append( messages.get( i ) ).append( - NEWLINE ); - } - - return message.toString(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java deleted file mode 100644 index 54fd04ca..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.maven.project.validation; - -/* - * 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.model.Model; - -/** - * Checks the model for missing or invalid values. - * - * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a> - */ -@Deprecated -public interface ModelValidator -{ - - String ROLE = ModelValidator.class.getName(); - - ModelValidationResult validate( Model model ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java deleted file mode 100644 index af27a840..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.reporting; - -/* - * 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. - */ - -/** - * An exception occurring during the execution of a Maven report. - * - * @author Brett Porter - * @author <a href="evenisse@apache.org">Emmanuel Venisse</a> - */ -public class MavenReportException extends Exception -{ - public MavenReportException( String msg ) - { - super( msg ); - } - - public MavenReportException( String msg, Exception e ) - { - super( msg, e ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java deleted file mode 100644 index 53e7bd4a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java +++ /dev/null @@ -1,205 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.settings.Mirror; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.util.StringUtils; - -@Component( role = MirrorSelector.class ) -public class DefaultMirrorSelector - implements MirrorSelector -{ - - private static final String WILDCARD = "*"; - - private static final String EXTERNAL_WILDCARD = "external:*"; - - public Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors ) - { - String repoId = repository.getId(); - - if ( repoId != null && mirrors != null ) - { - for ( Mirror mirror : mirrors ) - { - if ( repoId.equals( mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) ) - { - return mirror; - } - } - - for ( Mirror mirror : mirrors ) - { - if ( matchPattern( repository, mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) ) - { - return mirror; - } - } - } - - return null; - } - - /** - * This method checks if the pattern matches the originalRepository. Valid patterns: * = - * everything external:* = everything not on the localhost and not file based. repo,repo1 = repo - * or repo1 *,!repo1 = everything except repo1 - * - * @param originalRepository to compare for a match. - * @param pattern used for match. Currently only '*' is supported. - * @return true if the repository is a match to this pattern. - */ - static boolean matchPattern( ArtifactRepository originalRepository, String pattern ) - { - boolean result = false; - String originalId = originalRepository.getId(); - - // simple checks first to short circuit processing below. - if ( WILDCARD.equals( pattern ) || pattern.equals( originalId ) ) - { - result = true; - } - else - { - // process the list - String[] repos = pattern.split( "," ); - for ( String repo : repos ) - { - repo = repo.trim(); - // see if this is a negative match - if ( repo.length() > 1 && repo.startsWith( "!" ) ) - { - if ( repo.substring( 1 ).equals( originalId ) ) - { - // explicitly exclude. Set result and stop processing. - result = false; - break; - } - } - // check for exact match - else if ( repo.equals( originalId ) ) - { - result = true; - break; - } - // check for external:* - else if ( EXTERNAL_WILDCARD.equals( repo ) && isExternalRepo( originalRepository ) ) - { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } - else if ( WILDCARD.equals( repo ) ) - { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } - } - } - return result; - } - - /** - * Checks the URL to see if this repository refers to an external repository - * - * @param originalRepository - * @return true if external. - */ - static boolean isExternalRepo( ArtifactRepository originalRepository ) - { - try - { - URL url = new URL( originalRepository.getUrl() ); - return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) - || url.getProtocol().equals( "file" ) ); - } - catch ( MalformedURLException e ) - { - // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it - return false; - } - } - - static boolean matchesLayout( ArtifactRepository repository, Mirror mirror ) - { - return matchesLayout( RepositoryUtils.getLayout( repository ), mirror.getMirrorOfLayouts() ); - } - - /** - * Checks whether the layouts configured for a mirror match with the layout of the repository. - * - * @param repoLayout The layout of the repository, may be {@code null}. - * @param mirrorLayout The layouts supported by the mirror, may be {@code null}. - * @return {@code true} if the layouts associated with the mirror match the layout of the original repository, - * {@code false} otherwise. - */ - static boolean matchesLayout( String repoLayout, String mirrorLayout ) - { - boolean result = false; - - // simple checks first to short circuit processing below. - if ( StringUtils.isEmpty( mirrorLayout ) || WILDCARD.equals( mirrorLayout ) ) - { - result = true; - } - else if ( mirrorLayout.equals( repoLayout ) ) - { - result = true; - } - else - { - // process the list - String[] layouts = mirrorLayout.split( "," ); - for ( String layout : layouts ) - { - // see if this is a negative match - if ( layout.length() > 1 && layout.startsWith( "!" ) ) - { - if ( layout.substring( 1 ).equals( repoLayout ) ) - { - // explicitly exclude. Set result and stop processing. - result = false; - break; - } - } - // check for exact match - else if ( layout.equals( repoLayout ) ) - { - result = true; - break; - } - else if ( WILDCARD.equals( layout ) ) - { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } - } - } - - return result; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java deleted file mode 100644 index c507bf70..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * - * - * @author Oleg Gusakov - * - */ -public class MavenArtifactMetadata -{ - public static final String DEFAULT_TYPE = "jar"; - - String groupId; - String artifactId; - String version; - String classifier; - String type; - String scope; - - transient Object datum; - - public String getGroupId() - { - return groupId; - } - - public void setGroupId( String groupId ) - { - this.groupId = groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public void setArtifactId( String artifactId ) - { - this.artifactId = artifactId; - } - - public String getVersion() - { - return version; - } - - public void setVersion( String version ) - { - this.version = version; - } - - public String getClassifier() - { - return classifier; - } - - public void setClassifier( String classifier ) - { - this.classifier = classifier; - } - - public String getType() - { - return type; - } - - public void setType( String type ) - { - this.type = type; - } - - public Object getDatum() - { - return datum; - } - - public void setDatum( Object datum ) - { - this.datum = datum; - } - - public String getScope() - { - return scope; - } - - public void setScope( String scope ) - { - this.scope = scope; - } - - @Override - public String toString() - { - return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":" - + ( getClassifier() == null ? "" : getClassifier() ) + ":" - + ( getType() == null ? DEFAULT_TYPE : getType() ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java deleted file mode 100644 index fcaddd2c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collection; - -/** - * This is the main graph data structure used by the RepositorySystem to present tree and graph objects. - * - * @author Oleg Gusakov - * - */ -public class MetadataGraph -{ - /** all graph nodes */ - Collection<MetadataGraphNode> nodes; - - /** entry point for tree-like structures */ - MetadataGraphNode entry; - - public MetadataGraph( MetadataGraphNode entry ) - { - this(); - - this.entry = entry; - } - - public MetadataGraph() - { - nodes = new ArrayList<MetadataGraphNode>( 64 ); - } - - public void addNode( MetadataGraphNode node ) - { - nodes.add( node ); - } - - /** - * find a node by the GAV (metadata) - * - * @param md - * @return - */ - public MetadataGraphNode findNode( MavenArtifactMetadata md ) - { - for ( MetadataGraphNode mgn : nodes ) - { - if ( mgn.metadata.equals( md ) ) - { - return mgn; - } - } - - MetadataGraphNode node = new MetadataGraphNode( md ); - addNode( node ); - return node; - } - - /** - * getter - * - * @return - */ - public MetadataGraphNode getEntry() - { - return entry; - } - - /** - * getter - * - * @return - */ - public Collection<MetadataGraphNode> getNodes() - { - return nodes; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java deleted file mode 100644 index c8b9ab4e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.List; - -/** - * MetadataGraph node - as it's a directed graph - holds adjacency lists for incident and exident nodes - * - * @author Oleg Gusakov - * - */ -public class MetadataGraphNode -{ - /** node payload */ - MavenArtifactMetadata metadata; - - /** nodes, incident to this (depend on me) */ - List<MetadataGraphNode> inNodes; - - /** nodes, exident to this (I depend on) */ - List<MetadataGraphNode> exNodes; - - public MetadataGraphNode() - { - inNodes = new ArrayList<MetadataGraphNode>( 4 ); - exNodes = new ArrayList<MetadataGraphNode>( 8 ); - } - - public MetadataGraphNode( MavenArtifactMetadata metadata ) - { - this(); - this.metadata = metadata; - } - - public MetadataGraphNode addIncident( MetadataGraphNode node ) - { - inNodes.add( node ); - return this; - } - - public MetadataGraphNode addExident( MetadataGraphNode node ) - { - exNodes.add( node ); - return this; - } - - @Override - public boolean equals( Object obj ) - { - if ( obj == null ) - { - return false; - } - - if ( MetadataGraphNode.class.isAssignableFrom( obj.getClass() ) ) - { - MetadataGraphNode node2 = (MetadataGraphNode) obj; - - if ( node2.metadata == null ) - { - return metadata == null; - } - - return metadata != null && metadata.toString().equals( node2.metadata.toString() ); - } - else - { - return super.equals( obj ); - } - } - - @Override - public int hashCode() - { - if ( metadata == null ) - { - return super.hashCode(); - } - - return metadata.toString().hashCode(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java deleted file mode 100644 index c98dd053..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * - * - * @author Oleg Gusakov - * - */ -public class MetadataResolutionRequest -{ - private MavenArtifactMetadata mad; - - private String scope; - - // Needs to go away - private Set<Artifact> artifactDependencies; - - private ArtifactRepository localRepository; - - private List<ArtifactRepository> remoteRepositories; - - // This is like a filter but overrides all transitive versions - private Map managedVersionMap; - - /** result type - flat list; the default */ - private boolean asList = true; - - /** result type - dirty tree */ - private boolean asDirtyTree = false; - - /** result type - resolved tree */ - private boolean asResolvedTree = false; - - /** result type - graph */ - private boolean asGraph = false; - - public MetadataResolutionRequest() - { - } - - public MetadataResolutionRequest( MavenArtifactMetadata md, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - { - this.mad = md; - this.localRepository = localRepository; - this.remoteRepositories = remoteRepositories; - } - - public MavenArtifactMetadata getArtifactMetadata() - { - return mad; - } - - public MetadataResolutionRequest setArtifactMetadata( MavenArtifactMetadata md ) - { - this.mad = md; - - return this; - } - - public MetadataResolutionRequest setArtifactDependencies( Set<Artifact> artifactDependencies ) - { - this.artifactDependencies = artifactDependencies; - - return this; - } - - public Set<Artifact> getArtifactDependencies() - { - return artifactDependencies; - } - - public ArtifactRepository getLocalRepository() - { - return localRepository; - } - - public MetadataResolutionRequest setLocalRepository( ArtifactRepository localRepository ) - { - this.localRepository = localRepository; - - return this; - } - - public List<ArtifactRepository> getRemoteRepostories() - { - return remoteRepositories; - } - - public MetadataResolutionRequest setRemoteRepostories( List<ArtifactRepository> remoteRepostories ) - { - this.remoteRepositories = remoteRepostories; - - return this; - } - - public Map getManagedVersionMap() - { - return managedVersionMap; - } - - public MetadataResolutionRequest setManagedVersionMap( Map managedVersionMap ) - { - this.managedVersionMap = managedVersionMap; - - return this; - } - - public String toString() - { - StringBuilder sb = new StringBuilder() - .append( "REQUEST: " ).append( "\n" ) - .append( "artifact: " ).append( mad ).append( "\n" ) - .append( artifactDependencies ).append( "\n" ) - .append( "localRepository: " ).append( localRepository ).append( "\n" ) - .append( "remoteRepositories: " ).append( remoteRepositories ).append( "\n" ) - ; - - return sb.toString(); - } - - public boolean isAsList() - { - return asList; - } - - public MetadataResolutionRequest setAsList( boolean asList ) - { - this.asList = asList; - return this; - } - - public boolean isAsDirtyTree() - { - return asDirtyTree; - } - - public MetadataResolutionRequest setAsDirtyTree( boolean asDirtyTree ) - { - this.asDirtyTree = asDirtyTree; - return this; - } - - public boolean isAsResolvedTree() - { - return asResolvedTree; - } - - public MetadataResolutionRequest setAsResolvedTree( boolean asResolvedTree ) - { - this.asResolvedTree = asResolvedTree; - return this; - } - - public boolean isAsGraph() - { - return asGraph; - } - - public MetadataResolutionRequest setAsGraph( boolean asGraph ) - { - this.asGraph = asGraph; - return this; - } - - public MetadataResolutionRequest setScope( String scope ) - { - this.scope = scope; - return this; - } - - public String getScope() - { - return scope; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java deleted file mode 100644 index 209c36fa..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java +++ /dev/null @@ -1,356 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.CyclicDependencyException; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; - -/** - * - * - * @author Oleg Gusakov - * - */ -public class MetadataResolutionResult -{ - private Artifact originatingArtifact; - - private List<Artifact> missingArtifacts; - - // Exceptions - - private List<Exception> exceptions; - - private List<Exception> versionRangeViolations; - - private List<ArtifactResolutionException> metadataResolutionExceptions; - - private List<CyclicDependencyException> circularDependencyExceptions; - - private List<ArtifactResolutionException> errorArtifactExceptions; - - // file system errors - - private List<ArtifactRepository> repositories; - - private Set<Artifact> requestedArtifacts; - - private Set<Artifact> artifacts; - - private MetadataGraph dirtyTree; - - private MetadataGraph resolvedTree; - - private MetadataGraph resolvedGraph; - - public Artifact getOriginatingArtifact() - { - return originatingArtifact; - } - - public MetadataResolutionResult ListOriginatingArtifact( final Artifact originatingArtifact ) - { - this.originatingArtifact = originatingArtifact; - - return this; - } - - public void addArtifact( Artifact artifact ) - { - if ( artifacts == null ) - { - artifacts = new LinkedHashSet<Artifact>(); - } - - artifacts.add( artifact ); - } - - public Set<Artifact> getArtifacts() - { - return artifacts; - } - - public void addRequestedArtifact( Artifact artifact ) - { - if ( requestedArtifacts == null ) - { - requestedArtifacts = new LinkedHashSet<Artifact>(); - } - - requestedArtifacts.add( artifact ); - } - - public Set<Artifact> getRequestedArtifacts() - { - return requestedArtifacts; - } - - public boolean hasMissingArtifacts() - { - return missingArtifacts != null && !missingArtifacts.isEmpty(); - } - - public List<Artifact> getMissingArtifacts() - { - return missingArtifacts == null ? Collections.<Artifact> emptyList() : missingArtifacts; - } - - public MetadataResolutionResult addMissingArtifact( Artifact artifact ) - { - missingArtifacts = initList( missingArtifacts ); - - missingArtifacts.add( artifact ); - - return this; - } - - public MetadataResolutionResult setUnresolvedArtifacts( final List<Artifact> unresolvedArtifacts ) - { - this.missingArtifacts = unresolvedArtifacts; - - return this; - } - - // ------------------------------------------------------------------------ - // Exceptions - // ------------------------------------------------------------------------ - - public boolean hasExceptions() - { - return exceptions != null && !exceptions.isEmpty(); - } - - public List<Exception> getExceptions() - { - return exceptions == null ? Collections.<Exception> emptyList() : exceptions; - } - - // ------------------------------------------------------------------------ - // Version Range Violations - // ------------------------------------------------------------------------ - - public boolean hasVersionRangeViolations() - { - return versionRangeViolations != null; - } - - /** - * @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by - * {@link #getVersionRangeViolation(int)} but it's not used like that in - * {@link DefaultLegacyArtifactCollector} - */ - public MetadataResolutionResult addVersionRangeViolation( Exception e ) - { - versionRangeViolations = initList( versionRangeViolations ); - - versionRangeViolations.add( e ); - - exceptions = initList( exceptions ); - - exceptions.add( e ); - - return this; - } - - public OverConstrainedVersionException getVersionRangeViolation( int i ) - { - return (OverConstrainedVersionException) versionRangeViolations.get( i ); - } - - public List<Exception> getVersionRangeViolations() - { - return versionRangeViolations == null ? Collections.<Exception> emptyList() : versionRangeViolations; - } - - // ------------------------------------------------------------------------ - // Metadata Resolution Exceptions: ArtifactResolutionExceptions - // ------------------------------------------------------------------------ - - public boolean hasMetadataResolutionExceptions() - { - return metadataResolutionExceptions != null; - } - - public MetadataResolutionResult addMetadataResolutionException( ArtifactResolutionException e ) - { - metadataResolutionExceptions = initList( metadataResolutionExceptions ); - - metadataResolutionExceptions.add( e ); - - exceptions = initList( exceptions ); - - exceptions.add( e ); - - return this; - } - - public ArtifactResolutionException getMetadataResolutionException( int i ) - { - return metadataResolutionExceptions.get( i ); - } - - public List<ArtifactResolutionException> getMetadataResolutionExceptions() - { - return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException> emptyList() - : metadataResolutionExceptions; - } - - // ------------------------------------------------------------------------ - // ErrorArtifactExceptions: ArtifactResolutionExceptions - // ------------------------------------------------------------------------ - - public boolean hasErrorArtifactExceptions() - { - return errorArtifactExceptions != null; - } - - public MetadataResolutionResult addError( Exception e ) - { - if ( exceptions == null ) - { - initList( exceptions ); - } - - exceptions.add( e ); - - return this; - } - - public List<ArtifactResolutionException> getErrorArtifactExceptions() - { - if ( errorArtifactExceptions == null ) - { - return Collections.emptyList(); - } - - return errorArtifactExceptions; - } - - // ------------------------------------------------------------------------ - // Circular Dependency Exceptions - // ------------------------------------------------------------------------ - - public boolean hasCircularDependencyExceptions() - { - return circularDependencyExceptions != null; - } - - public MetadataResolutionResult addCircularDependencyException( CyclicDependencyException e ) - { - circularDependencyExceptions = initList( circularDependencyExceptions ); - - circularDependencyExceptions.add( e ); - - exceptions = initList( exceptions ); - - exceptions.add( e ); - - return this; - } - - public CyclicDependencyException getCircularDependencyException( int i ) - { - return circularDependencyExceptions.get( i ); - } - - public List<CyclicDependencyException> getCircularDependencyExceptions() - { - if ( circularDependencyExceptions == null ) - { - return Collections.emptyList(); - } - - return circularDependencyExceptions; - } - - // ------------------------------------------------------------------------ - // Repositories - // ------------------------------------------------------------------------ - - public List<ArtifactRepository> getRepositories() - { - if ( repositories == null ) - { - return Collections.emptyList(); - } - - return repositories; - } - - public MetadataResolutionResult setRepositories( final List<ArtifactRepository> repositories ) - { - this.repositories = repositories; - - return this; - } - - // - // Internal - // - - private <T> List<T> initList( final List<T> l ) - { - if ( l == null ) - { - return new ArrayList<T>(); - } - return l; - } - - public String toString() - { - StringBuilder sb = new StringBuilder(); - - if ( artifacts != null ) - { - int i = 1; - sb.append( "---------" ).append( "\n" ); - sb.append( artifacts.size() ).append( "\n" ); - for ( Artifact a : artifacts ) - { - sb.append( i ).append( " " ).append( a ).append( "\n" ); - i++; - } - sb.append( "---------" ).append( "\n" ); - } - - return sb.toString(); - } - - public MetadataGraph getResolvedTree() - { - return resolvedTree; - } - - public void setResolvedTree( MetadataGraph resolvedTree ) - { - this.resolvedTree = resolvedTree; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java deleted file mode 100644 index c15899ed..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.settings.Mirror; - -/** - * Handles the selection of mirrors for repositories. - * - * @author Benjamin Bentmann - */ -public interface MirrorSelector -{ - - /** - * Determines the mirror for the specified repository. - * - * @param repository The repository to determine the mirror for, must not be {@code null}. - * @param mirrors The available mirrors, may be {@code null}. - * @return The mirror specification for the repository or {@code null} if no mirror matched. - */ - Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java deleted file mode 100644 index 70d3e0a0..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; - -public class UserLocalArtifactRepository - extends LocalArtifactRepository -{ - private ArtifactRepository localRepository; - - public UserLocalArtifactRepository( ArtifactRepository localRepository ) - { - this.localRepository = localRepository; - setLayout( localRepository.getLayout() ); - } - - @Override - public Artifact find( Artifact artifact ) - { - File artifactFile = new File( localRepository.getBasedir(), pathOf( artifact ) ); - - // We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal - // with multiple local repository implementations yet. - artifact.setFile( artifactFile ); - - return artifact; - } - - @Override - public String getId() - { - return localRepository.getId(); - } - - @Override - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return localRepository.pathOfLocalRepositoryMetadata( metadata, repository ); - } - - @Override - public String pathOf( Artifact artifact ) - { - return localRepository.pathOf( artifact ); - } - - @Override - public boolean hasLocalMetadata() - { - return true; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java deleted file mode 100644 index 77b1af12..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.apache.maven.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; - -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.model.Dependency; - -/** - * Thrown if a dependency has an invalid version. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class VersionNotFoundException - extends Exception -{ - private Dependency dependency; - - private String projectId; - private File pomFile; - private InvalidVersionSpecificationException cause; - - public VersionNotFoundException( String projectId, Dependency dependency, File pomFile, - InvalidVersionSpecificationException cause ) - { - super( projectId + ", " + formatLocationInPom( dependency ) + " " + dependency.getVersion() + ", pom file " - + pomFile, cause ); - - this.projectId = projectId; - - this.pomFile = pomFile; - - this.cause = cause; - - this.dependency = dependency; - } - - private static String formatLocationInPom( Dependency dependency ) - { - return "Dependency: " + ArtifactUtils.versionlessKey( dependency.getGroupId(), dependency.getArtifactId() ); - } - - public Dependency getDependency() - { - return dependency; - } - - public String getProjectId() - { - return projectId; - } - - public File getPomFile() - { - return pomFile; - } - - public InvalidVersionSpecificationException getCauseException() - { - return cause; - } - - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java deleted file mode 100644 index 4e0c4a6b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.wagon.TransferFailedException; - -/** - * Occurs when a download checksum fails. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -public class ChecksumFailedException - extends TransferFailedException -{ - public ChecksumFailedException( String s ) - { - super( s ); - } - - public ChecksumFailedException( String message, - Throwable cause ) - { - super( message, cause ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java deleted file mode 100644 index 57b307ef..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java +++ /dev/null @@ -1,438 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.channels.FileLock; -import java.util.Date; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.Authentication; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.repository.Proxy; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.IOUtil; - -@Component( role = UpdateCheckManager.class ) -public class DefaultUpdateCheckManager - extends AbstractLogEnabled - implements UpdateCheckManager -{ - - private static final String ERROR_KEY_SUFFIX = ".error"; - - public DefaultUpdateCheckManager() - { - - } - - public DefaultUpdateCheckManager( Logger logger ) - { - enableLogging( logger ); - } - - public static final String LAST_UPDATE_TAG = ".lastUpdated"; - - private static final String TOUCHFILE_NAME = "resolver-status.properties"; - - public boolean isUpdateRequired( Artifact artifact, ArtifactRepository repository ) - { - File file = artifact.getFile(); - - ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases(); - - if ( !policy.isEnabled() ) - { - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( - "Skipping update check for " + artifact + " (" + file + ") from " - + repository.getId() + " (" + repository.getUrl() + ")" ); - } - - return false; - } - - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( - "Determining update check for " + artifact + " (" + file + ") from " - + repository.getId() + " (" + repository.getUrl() + ")" ); - } - - if ( file == null ) - { - // TODO throw something instead? - return true; - } - - Date lastCheckDate; - - if ( file.exists() ) - { - lastCheckDate = new Date ( file.lastModified() ); - } - else - { - File touchfile = getTouchfile( artifact ); - lastCheckDate = readLastUpdated( touchfile, getRepositoryKey( repository ) ); - } - - return ( lastCheckDate == null ) || policy.checkOutOfDate( lastCheckDate ); - } - - public boolean isUpdateRequired( RepositoryMetadata metadata, ArtifactRepository repository, File file ) - { - // Here, we need to determine which policy to use. Release updateInterval will be used when - // the metadata refers to a release artifact or meta-version, and snapshot updateInterval will be used when - // it refers to a snapshot artifact or meta-version. - // NOTE: Release metadata includes version information about artifacts that have been released, to allow - // meta-versions like RELEASE and LATEST to resolve, and also to allow retrieval of the range of valid, released - // artifacts available. - ArtifactRepositoryPolicy policy = metadata.getPolicy( repository ); - - if ( !policy.isEnabled() ) - { - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( - "Skipping update check for " + metadata.getKey() + " (" + file + ") from " - + repository.getId() + " (" + repository.getUrl() + ")" ); - } - - return false; - } - - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( - "Determining update check for " + metadata.getKey() + " (" + file + ") from " - + repository.getId() + " (" + repository.getUrl() + ")" ); - } - - if ( file == null ) - { - // TODO throw something instead? - return true; - } - - Date lastCheckDate = readLastUpdated( metadata, repository, file ); - - return ( lastCheckDate == null ) || policy.checkOutOfDate( lastCheckDate ); - } - - private Date readLastUpdated( RepositoryMetadata metadata, ArtifactRepository repository, File file ) - { - File touchfile = getTouchfile( metadata, file ); - - String key = getMetadataKey( repository, file ); - - return readLastUpdated( touchfile, key ); - } - - public String getError( Artifact artifact, ArtifactRepository repository ) - { - File touchFile = getTouchfile( artifact ); - return getError( touchFile, getRepositoryKey( repository ) ); - } - - public void touch( Artifact artifact, ArtifactRepository repository, String error ) - { - File file = artifact.getFile(); - - File touchfile = getTouchfile( artifact ); - - if ( file.exists() ) - { - touchfile.delete(); - } - else - { - writeLastUpdated( touchfile, getRepositoryKey( repository ), error ); - } - } - - public void touch( RepositoryMetadata metadata, ArtifactRepository repository, File file ) - { - File touchfile = getTouchfile( metadata, file ); - - String key = getMetadataKey( repository, file ); - - writeLastUpdated( touchfile, key, null ); - } - - String getMetadataKey( ArtifactRepository repository, File file ) - { - return repository.getId() + '.' + file.getName() + LAST_UPDATE_TAG; - } - - String getRepositoryKey( ArtifactRepository repository ) - { - StringBuilder buffer = new StringBuilder( 256 ); - - Proxy proxy = repository.getProxy(); - if ( proxy != null ) - { - if ( proxy.getUserName() != null ) - { - int hash = ( proxy.getUserName() + proxy.getPassword() ).hashCode(); - buffer.append( hash ).append( '@' ); - } - buffer.append( proxy.getHost() ).append( ':' ).append( proxy.getPort() ).append( '>' ); - } - - // consider the username&password because a repo manager might block artifacts depending on authorization - Authentication auth = repository.getAuthentication(); - if ( auth != null ) - { - int hash = ( auth.getUsername() + auth.getPassword() ).hashCode(); - buffer.append( hash ).append( '@' ); - } - - // consider the URL (instead of the id) as this most closely relates to the contents in the repo - buffer.append( repository.getUrl() ); - - return buffer.toString(); - } - - private void writeLastUpdated( File touchfile, String key, String error ) - { - synchronized ( touchfile.getAbsolutePath().intern() ) - { - if ( !touchfile.getParentFile().exists() && !touchfile.getParentFile().mkdirs() ) - { - getLogger().debug( "Failed to create directory: " + touchfile.getParent() - + " for tracking artifact metadata resolution." ); - return; - } - - FileChannel channel = null; - FileLock lock = null; - try - { - Properties props = new Properties(); - - channel = new RandomAccessFile( touchfile, "rw" ).getChannel(); - lock = channel.lock( 0, channel.size(), false ); - - if ( touchfile.canRead() ) - { - getLogger().debug( "Reading resolution-state from: " + touchfile ); - ByteBuffer buffer = ByteBuffer.allocate( (int) channel.size() ); - - channel.read( buffer ); - buffer.flip(); - - ByteArrayInputStream stream = new ByteArrayInputStream( buffer.array() ); - props.load( stream ); - } - - props.setProperty( key, Long.toString( System.currentTimeMillis() ) ); - - if ( error != null ) - { - props.setProperty( key + ERROR_KEY_SUFFIX, error ); - } - else - { - props.remove( key + ERROR_KEY_SUFFIX ); - } - - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - getLogger().debug( "Writing resolution-state to: " + touchfile ); - props.store( stream, "Last modified on: " + new Date() ); - - byte[] data = stream.toByteArray(); - ByteBuffer buffer = ByteBuffer.allocate( data.length ); - buffer.put( data ); - buffer.flip(); - - channel.position( 0 ); - channel.write( buffer ); - } - catch ( IOException e ) - { - getLogger().debug( "Failed to record lastUpdated information for resolution.\nFile: " - + touchfile.toString() + "; key: " + key, e ); - } - finally - { - if ( lock != null ) - { - try - { - lock.release(); - } - catch ( IOException e ) - { - getLogger().debug( "Error releasing exclusive lock for resolution tracking file: " - + touchfile, e ); - } - } - - if ( channel != null ) - { - try - { - channel.close(); - } - catch ( IOException e ) - { - getLogger().debug( "Error closing FileChannel for resolution tracking file: " - + touchfile, e ); - } - } - } - } - } - - Date readLastUpdated( File touchfile, String key ) - { - getLogger().debug( "Searching for " + key + " in resolution tracking file." ); - - Properties props = read( touchfile ); - if ( props != null ) - { - String rawVal = props.getProperty( key ); - if ( rawVal != null ) - { - try - { - return new Date( Long.parseLong( rawVal ) ); - } - catch ( NumberFormatException e ) - { - getLogger().debug( "Cannot parse lastUpdated date: \'" + rawVal + "\'. Ignoring.", e ); - } - } - } - return null; - } - - private String getError( File touchFile, String key ) - { - Properties props = read( touchFile ); - if ( props != null ) - { - return props.getProperty( key + ERROR_KEY_SUFFIX ); - } - return null; - } - - private Properties read( File touchfile ) - { - if ( !touchfile.canRead() ) - { - getLogger().debug( "Skipped unreadable resolution tracking file " + touchfile ); - return null; - } - - synchronized ( touchfile.getAbsolutePath().intern() ) - { - FileLock lock = null; - FileChannel channel = null; - try - { - Properties props = new Properties(); - - FileInputStream stream = new FileInputStream( touchfile ); - try - { - channel = stream.getChannel(); - lock = channel.lock( 0, channel.size(), true ); - - getLogger().debug( "Reading resolution-state from: " + touchfile ); - props.load( stream ); - - return props; - } - finally - { - IOUtil.close( stream ); - } - } - catch ( IOException e ) - { - getLogger().debug( "Failed to read resolution tracking file " + touchfile, e ); - - return null; - } - finally - { - if ( lock != null ) - { - try - { - lock.release(); - } - catch ( IOException e ) - { - getLogger().debug( "Error releasing shared lock for resolution tracking file: " + touchfile, - e ); - } - } - - if ( channel != null ) - { - try - { - channel.close(); - } - catch ( IOException e ) - { - getLogger().debug( "Error closing FileChannel for resolution tracking file: " + touchfile, e ); - } - } - } - } - } - - File getTouchfile( Artifact artifact ) - { - StringBuilder sb = new StringBuilder( 128 ); - sb.append( artifact.getArtifactId() ); - sb.append( '-' ).append( artifact.getBaseVersion() ); - if ( artifact.getClassifier() != null ) - { - sb.append( '-' ).append( artifact.getClassifier() ); - } - sb.append( '.' ).append( artifact.getType() ).append( LAST_UPDATE_TAG ); - return new File( artifact.getFile().getParentFile(), sb.toString() ); - } - - File getTouchfile( RepositoryMetadata metadata, File file ) - { - return new File( file.getParent(), TOUCHFILE_NAME ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java deleted file mode 100644 index 2c4a60ec..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java +++ /dev/null @@ -1,823 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.lang.reflect.Method; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.authorization.AuthorizationException; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.observers.ChecksumObserver; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.repository.Repository; -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.ComponentLifecycleException; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.util.FileUtils; -import org.eclipse.aether.ConfigurationProperties; -import org.eclipse.aether.util.ConfigUtils; - -//TODO: remove the update check manager -//TODO: separate into retriever and publisher -//TODO: remove hardcoding of checksum logic -@Component( role = WagonManager.class ) -public class DefaultWagonManager - implements WagonManager -{ - private static final String[] CHECKSUM_IDS = { "md5", "sha1" }; - - /** have to match the CHECKSUM_IDS */ - private static final String[] CHECKSUM_ALGORITHMS = { "MD5", "SHA-1" }; - - @Requirement - private Logger logger; - - @Requirement - private PlexusContainer container; - - @Requirement - private UpdateCheckManager updateCheckManager; - - @Requirement - private LegacySupport legacySupport; - - - // - // Retriever - // - @Override - public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, - boolean force ) - throws TransferFailedException, ResourceDoesNotExistException - { - String remotePath = repository.pathOf( artifact ); - - ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases(); - - if ( !policy.isEnabled() ) - { - logger.debug( "Skipping disabled repository " + repository.getId() + " for resolution of " - + artifact.getId() ); - } - else if ( artifact.isSnapshot() || !artifact.getFile().exists() ) - { - if ( force || updateCheckManager.isUpdateRequired( artifact, repository ) ) - { - logger.debug( "Trying repository " + repository.getId() + " for resolution of " + artifact.getId() - + " from " + remotePath ); - - try - { - getRemoteFile( repository, artifact.getFile(), remotePath, downloadMonitor, - policy.getChecksumPolicy(), false ); - - updateCheckManager.touch( artifact, repository, null ); - } - catch ( ResourceDoesNotExistException e ) - { - updateCheckManager.touch( artifact, repository, null ); - throw e; - } - catch ( TransferFailedException e ) - { - String error = ( e.getMessage() != null ) ? e.getMessage() : e.getClass().getSimpleName(); - updateCheckManager.touch( artifact, repository, error ); - throw e; - } - - logger.debug( " Artifact " + artifact.getId() + " resolved to " + artifact.getFile() ); - - artifact.setResolved( true ); - } - else if ( !artifact.getFile().exists() ) - { - String error = updateCheckManager.getError( artifact, repository ); - if ( error != null ) - { - throw new TransferFailedException( "Failure to resolve " + remotePath + " from " - + repository.getUrl() + " was cached in the local repository. " - + "Resolution will not be reattempted until the update interval of " + repository.getId() - + " has elapsed or updates are forced. Original error: " + error ); - } - else - { - throw new ResourceDoesNotExistException( "Failure to resolve " + remotePath + " from " - + repository.getUrl() + " was cached in the local repository. " - + "Resolution will not be reattempted until the update interval of " + repository.getId() - + " has elapsed or updates are forced." ); - } - } - } - } - - @Override - public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, - TransferListener downloadMonitor, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException - { - TransferFailedException tfe = null; - - for ( ArtifactRepository repository : remoteRepositories ) - { - try - { - getArtifact( artifact, repository, downloadMonitor, force ); - - if ( artifact.isResolved() ) - { - artifact.setRepository( repository ); - break; - } - } - catch ( ResourceDoesNotExistException e ) - { - // This one we will eat when looking through remote repositories - // because we want to cycle through them all before squawking. - - logger.debug( "Unable to find artifact " + artifact.getId() + " in repository " + repository.getId() - + " (" + repository.getUrl() + ")", e ); - } - catch ( TransferFailedException e ) - { - tfe = e; - - String msg = - "Unable to get artifact " + artifact.getId() + " from repository " + repository.getId() + " (" - + repository.getUrl() + "): " + e.getMessage(); - if ( logger.isDebugEnabled() ) - { - logger.warn( msg, e ); - } - else - { - logger.warn( msg ); - } - } - } - - // if it already exists locally we were just trying to force it - ignore the update - if ( !artifact.getFile().exists() ) - { - if ( tfe != null ) - { - throw tfe; - } - else - { - throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" ); - } - } - } - - @Override - public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, - String checksumPolicy ) - throws TransferFailedException, ResourceDoesNotExistException - { - String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); - - getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true ); - } - - @Override - public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository, - File destination, String checksumPolicy ) - throws TransferFailedException, ResourceDoesNotExistException - { - String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); - - getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true ); - } - - /** - * Deal with connecting to a wagon repository taking into account authentication and proxies. - * - * @param wagon - * @param repository - * @throws ConnectionException - * @throws AuthenticationException - */ - private void connectWagon( Wagon wagon, ArtifactRepository repository ) - throws ConnectionException, AuthenticationException - { - // MNG-5509 - // See org.eclipse.aether.connector.wagon.WagonRepositoryConnector.connectWagon(Wagon) - if( legacySupport.getRepositorySession() != null ) - { - String userAgent = ConfigUtils.getString( legacySupport.getRepositorySession(), null, ConfigurationProperties.USER_AGENT ); - if( userAgent == null) - { - Properties headers = new Properties(); - - headers.put( "User-Agent", ConfigUtils.getString( legacySupport.getRepositorySession(), "Maven", - ConfigurationProperties.USER_AGENT ) ); - try - { - Method setHttpHeaders = wagon.getClass().getMethod( "setHttpHeaders", Properties.class ); - setHttpHeaders.invoke( wagon, headers ); - } - catch ( NoSuchMethodException e ) - { - // normal for non-http wagons - } - catch ( Exception e ) - { - logger.debug( "Could not set user agent for wagon " + wagon.getClass().getName() + ": " + e ); - } - } - } - - if ( repository.getProxy() != null && logger.isDebugEnabled() ) - { - logger.debug( "Using proxy " + repository.getProxy().getHost() + ":" + repository.getProxy().getPort() - + " for " + repository.getUrl() ); - } - - if ( repository.getAuthentication() != null && repository.getProxy() != null ) - { - wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ), - proxyInfo( repository ) ); - } - else if ( repository.getAuthentication() != null ) - { - wagon.connect( new Repository( repository.getId(), repository.getUrl() ), - authenticationInfo( repository ) ); - } - else if ( repository.getProxy() != null ) - { - wagon.connect( new Repository( repository.getId(), repository.getUrl() ), proxyInfo( repository ) ); - } - else - { - wagon.connect( new Repository( repository.getId(), repository.getUrl() ) ); - } - } - - private AuthenticationInfo authenticationInfo( ArtifactRepository repository ) - { - AuthenticationInfo ai = new AuthenticationInfo(); - ai.setUserName( repository.getAuthentication().getUsername() ); - ai.setPassword( repository.getAuthentication().getPassword() ); - return ai; - } - - private ProxyInfo proxyInfo( ArtifactRepository repository ) - { - ProxyInfo proxyInfo = new ProxyInfo(); - proxyInfo.setHost( repository.getProxy().getHost() ); - proxyInfo.setType( repository.getProxy().getProtocol() ); - proxyInfo.setPort( repository.getProxy().getPort() ); - proxyInfo.setNonProxyHosts( repository.getProxy().getNonProxyHosts() ); - proxyInfo.setUserName( repository.getProxy().getUserName() ); - proxyInfo.setPassword( repository.getProxy().getPassword() ); - return proxyInfo; - } - - @Override - public void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, - TransferListener downloadMonitor, String checksumPolicy, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException - { - String protocol = repository.getProtocol(); - - Wagon wagon; - - try - { - wagon = getWagon( protocol ); - } - catch ( UnsupportedProtocolException e ) - { - throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); - } - - if ( downloadMonitor != null ) - { - wagon.addTransferListener( downloadMonitor ); - } - - File temp = new File( destination + ".tmp" ); - - temp.deleteOnExit(); - - boolean downloaded = false; - - try - { - connectWagon( wagon, repository ); - - boolean firstRun = true; - boolean retry = true; - - // this will run at most twice. The first time, the firstRun flag is turned off, and if the retry flag - // is set on the first run, it will be turned off and not re-set on the second try. This is because the - // only way the retry flag can be set is if ( firstRun == true ). - while ( firstRun || retry ) - { - ChecksumObserver md5ChecksumObserver = null; - ChecksumObserver sha1ChecksumObserver = null; - try - { - // TODO: configure on repository - int i = 0; - - md5ChecksumObserver = addChecksumObserver( wagon, CHECKSUM_ALGORITHMS[i++] ); - sha1ChecksumObserver = addChecksumObserver( wagon, CHECKSUM_ALGORITHMS[i++] ); - - // reset the retry flag. - retry = false; - - // This should take care of creating destination directory now on - if ( destination.exists() && !force ) - { - try - { - downloaded = wagon.getIfNewer( remotePath, temp, destination.lastModified() ); - - if ( !downloaded ) - { - // prevent additional checks of this artifact until it expires again - destination.setLastModified( System.currentTimeMillis() ); - } - } - catch ( UnsupportedOperationException e ) - { - // older wagons throw this. Just get() instead - wagon.get( remotePath, temp ); - - downloaded = true; - } - } - else - { - wagon.get( remotePath, temp ); - downloaded = true; - } - } - finally - { - wagon.removeTransferListener( md5ChecksumObserver ); - wagon.removeTransferListener( sha1ChecksumObserver ); - } - - if ( downloaded ) - { - // keep the checksum files from showing up on the download monitor... - if ( downloadMonitor != null ) - { - wagon.removeTransferListener( downloadMonitor ); - } - - // try to verify the SHA-1 checksum for this file. - try - { - verifyChecksum( sha1ChecksumObserver, destination, temp, remotePath, ".sha1", wagon ); - } - catch ( ChecksumFailedException e ) - { - // if we catch a ChecksumFailedException, it means the transfer/read succeeded, but the checksum - // doesn't match. This could be a problem with the server (ibiblio HTTP-200 error page), so we'll - // try this up to two times. On the second try, we'll handle it as a bona-fide error, based on the - // repository's checksum checking policy. - if ( firstRun ) - { - logger.warn( "*** CHECKSUM FAILED - " + e.getMessage() + " - RETRYING" ); - retry = true; - } - else - { - handleChecksumFailure( checksumPolicy, e.getMessage(), e.getCause() ); - } - } - catch ( ResourceDoesNotExistException sha1TryException ) - { - logger.debug( "SHA1 not found, trying MD5: " + sha1TryException.getMessage() ); - - // if this IS NOT a ChecksumFailedException, it was a problem with transfer/read of the checksum - // file...we'll try again with the MD5 checksum. - try - { - verifyChecksum( md5ChecksumObserver, destination, temp, remotePath, ".md5", wagon ); - } - catch ( ChecksumFailedException e ) - { - // if we also fail to verify based on the MD5 checksum, and the checksum transfer/read - // succeeded, then we need to determine whether to retry or handle it as a failure. - if ( firstRun ) - { - retry = true; - } - else - { - handleChecksumFailure( checksumPolicy, e.getMessage(), e.getCause() ); - } - } - catch ( ResourceDoesNotExistException md5TryException ) - { - // this was a failed transfer, and we don't want to retry. - handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath, - md5TryException ); - } - } - - // reinstate the download monitor... - if ( downloadMonitor != null ) - { - wagon.addTransferListener( downloadMonitor ); - } - } - - // unset the firstRun flag, so we don't get caught in an infinite loop... - firstRun = false; - } - } - catch ( ConnectionException e ) - { - throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); - } - catch ( AuthenticationException e ) - { - throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e ); - } - catch ( AuthorizationException e ) - { - throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e ); - } - finally - { - // Remove remaining TransferListener instances (checksum handlers removed in above finally clause) - if ( downloadMonitor != null ) - { - wagon.removeTransferListener( downloadMonitor ); - } - - disconnectWagon( wagon ); - - releaseWagon( protocol, wagon ); - } - - if ( downloaded ) - { - if ( !temp.exists() ) - { - throw new ResourceDoesNotExistException( "Downloaded file does not exist: " + temp ); - } - - // The temporary file is named destination + ".tmp" and is done this way to ensure - // that the temporary file is in the same file system as the destination because the - // File.renameTo operation doesn't really work across file systems. - // So we will attempt to do a File.renameTo for efficiency and atomicity, if this fails - // then we will use a brute force copy and delete the temporary file. - - if ( !temp.renameTo( destination ) ) - { - try - { - FileUtils.copyFile( temp, destination ); - - if ( !temp.delete() ) - { - temp.deleteOnExit(); - } - } - catch ( IOException e ) - { - throw new TransferFailedException( "Error copying temporary file to the final destination: " - + e.getMessage(), e ); - } - } - } - } - - // - // Publisher - // - @Override - public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, - TransferListener downloadMonitor ) - throws TransferFailedException - { - putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); - } - - @Override - public void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository ) - throws TransferFailedException - { - logger.info( "Uploading " + artifactMetadata ); - putRemoteFile( repository, source, repository.pathOfRemoteRepositoryMetadata( artifactMetadata ), null ); - } - - @Override - public void putRemoteFile( ArtifactRepository repository, File source, String remotePath, - TransferListener downloadMonitor ) - throws TransferFailedException - { - String protocol = repository.getProtocol(); - - Wagon wagon; - try - { - wagon = getWagon( protocol ); - } - catch ( UnsupportedProtocolException e ) - { - throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); - } - - if ( downloadMonitor != null ) - { - wagon.addTransferListener( downloadMonitor ); - } - - Map<String, ChecksumObserver> checksums = new HashMap<String, ChecksumObserver>( 2 ); - - Map<String, String> sums = new HashMap<String, String>( 2 ); - - // TODO: configure these on the repository - for ( int i = 0; i < CHECKSUM_IDS.length; i++ ) - { - checksums.put( CHECKSUM_IDS[i], addChecksumObserver( wagon, CHECKSUM_ALGORITHMS[i] ) ); - } - - List<File> temporaryFiles = new ArrayList<File>(); - - try - { - try - { - connectWagon( wagon, repository ); - - wagon.put( source, remotePath ); - } - finally - { - if ( downloadMonitor != null ) - { - wagon.removeTransferListener( downloadMonitor ); - } - } - - // Pre-store the checksums as any future puts will overwrite them - for ( String extension : checksums.keySet() ) - { - ChecksumObserver observer = checksums.get( extension ); - sums.put( extension, observer.getActualChecksum() ); - } - - // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself - for ( String extension : checksums.keySet() ) - { - // TODO: shouldn't need a file intermediatary - improve wagon to take a stream - File temp = File.createTempFile( "maven-artifact", null ); - temp.deleteOnExit(); - FileUtils.fileWrite( temp.getAbsolutePath(), "UTF-8", sums.get( extension ) ); - - temporaryFiles.add( temp ); - wagon.put( temp, remotePath + "." + extension ); - } - } - catch ( ConnectionException e ) - { - throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); - } - catch ( AuthenticationException e ) - { - throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e ); - } - catch ( AuthorizationException e ) - { - throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e ); - } - catch ( ResourceDoesNotExistException e ) - { - throw new TransferFailedException( "Resource to deploy not found: " + e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new TransferFailedException( "Error creating temporary file for deployment: " + e.getMessage(), e ); - } - finally - { - // MNG-4543 - cleanupTemporaryFiles( temporaryFiles ); - - // Remove every checksum listener - for ( String aCHECKSUM_IDS : CHECKSUM_IDS ) - { - TransferListener checksumListener = checksums.get( aCHECKSUM_IDS ); - if ( checksumListener != null ) - { - wagon.removeTransferListener( checksumListener ); - } - } - - disconnectWagon( wagon ); - - releaseWagon( protocol, wagon ); - } - } - - private void cleanupTemporaryFiles( List<File> files ) - { - for ( File file : files ) - { - // really don't care if it failed here only log warning - if ( !file.delete() ) - { - logger.warn( "skip failed to delete temporary file : " + file.getAbsolutePath() ); - file.deleteOnExit(); - } - } - - } - - private ChecksumObserver addChecksumObserver( Wagon wagon, String algorithm ) - throws TransferFailedException - { - try - { - ChecksumObserver checksumObserver = new ChecksumObserver( algorithm ); - wagon.addTransferListener( checksumObserver ); - return checksumObserver; - } - catch ( NoSuchAlgorithmException e ) - { - throw new TransferFailedException( "Unable to add checksum for unsupported algorithm " + algorithm, e ); - } - } - - private void handleChecksumFailure( String checksumPolicy, String message, Throwable cause ) - throws ChecksumFailedException - { - if ( ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL.equals( checksumPolicy ) ) - { - throw new ChecksumFailedException( message, cause ); - } - else if ( !ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals( checksumPolicy ) ) - { - // warn if it is set to anything other than ignore - logger.warn( "*** CHECKSUM FAILED - " + message + " - IGNORING" ); - } - // otherwise it is ignore - } - - private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination, - String remotePath, String checksumFileExtension, Wagon wagon ) - throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException - { - try - { - // grab it first, because it's about to change... - String actualChecksum = checksumObserver.getActualChecksum(); - - File tempChecksumFile = new File( tempDestination + checksumFileExtension + ".tmp" ); - tempChecksumFile.deleteOnExit(); - wagon.get( remotePath + checksumFileExtension, tempChecksumFile ); - - String expectedChecksum = FileUtils.fileRead( tempChecksumFile, "UTF-8" ); - - // remove whitespaces at the end - expectedChecksum = expectedChecksum.trim(); - - // check for 'ALGO (name) = CHECKSUM' like used by openssl - if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 ) - || expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) ) - { - int lastSpacePos = expectedChecksum.lastIndexOf( ' ' ); - expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 ); - } - else - { - // remove everything after the first space (if available) - int spacePos = expectedChecksum.indexOf( ' ' ); - - if ( spacePos != -1 ) - { - expectedChecksum = expectedChecksum.substring( 0, spacePos ); - } - } - if ( expectedChecksum.equalsIgnoreCase( actualChecksum ) ) - { - File checksumFile = new File( destination + checksumFileExtension ); - if ( checksumFile.exists() ) - { - checksumFile.delete(); // ignore if failed as we will overwrite - } - FileUtils.copyFile( tempChecksumFile, checksumFile ); - if ( !tempChecksumFile.delete() ) - { - tempChecksumFile.deleteOnExit(); - } - } - else - { - throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum - + "'; remote = '" + expectedChecksum + "'" ); - } - } - catch ( IOException e ) - { - throw new ChecksumFailedException( "Invalid checksum file", e ); - } - } - - private void disconnectWagon( Wagon wagon ) - { - try - { - wagon.disconnect(); - } - catch ( ConnectionException e ) - { - logger.error( "Problem disconnecting from wagon - ignoring: " + e.getMessage() ); - } - } - - private void releaseWagon( String protocol, Wagon wagon ) - { - try - { - container.release( wagon ); - } - catch ( ComponentLifecycleException e ) - { - logger.error( "Problem releasing wagon - ignoring: " + e.getMessage() ); - logger.debug( "", e ); - } - } - - @Override - @Deprecated - public Wagon getWagon( Repository repository ) - throws UnsupportedProtocolException - { - return getWagon( repository.getProtocol() ); - } - - @Override - @Deprecated - public Wagon getWagon( String protocol ) - throws UnsupportedProtocolException - { - if ( protocol == null ) - { - throw new UnsupportedProtocolException( "Unspecified protocol" ); - } - - String hint = protocol.toLowerCase( java.util.Locale.ENGLISH ); - - Wagon wagon; - try - { - wagon = container.lookup( Wagon.class, hint ); - } - catch ( ComponentLookupException e ) - { - throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " - + protocol, e ); - } - - return wagon; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java deleted file mode 100644 index 6dd84dbc..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java +++ /dev/null @@ -1,906 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.Authentication; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; -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.Exclusion; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Repository; -import org.apache.maven.model.RepositoryPolicy; -import org.apache.maven.repository.DelegatingLocalArtifactRepository; -import org.apache.maven.repository.LocalArtifactRepository; -import org.apache.maven.repository.ArtifactTransferListener; -import org.apache.maven.repository.MirrorSelector; -import org.apache.maven.repository.Proxy; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.repository.ArtifactDoesNotExistException; -import org.apache.maven.repository.ArtifactTransferFailedException; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.building.SettingsProblem; -import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecrypter; -import org.apache.maven.settings.crypto.SettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecryptionResult; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.proxy.ProxyUtils; -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.codehaus.plexus.util.StringUtils; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.AuthenticationContext; -import org.eclipse.aether.repository.AuthenticationSelector; -import org.eclipse.aether.repository.ProxySelector; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * @author Jason van Zyl - */ -@Component( role = RepositorySystem.class, hint = "default" ) -public class LegacyRepositorySystem - implements RepositorySystem -{ - - @Requirement - private Logger logger; - - @Requirement - private ArtifactFactory artifactFactory; - - @Requirement - private ArtifactResolver artifactResolver; - - @Requirement - private ArtifactRepositoryFactory artifactRepositoryFactory; - - @Requirement( role = ArtifactRepositoryLayout.class ) - private Map<String, ArtifactRepositoryLayout> layouts; - - @Requirement - private WagonManager wagonManager; - - @Requirement - private PlexusContainer plexus; - - @Requirement - private MirrorSelector mirrorSelector; - - @Requirement - private SettingsDecrypter settingsDecrypter; - - public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type ) - { - return artifactFactory.createArtifact( groupId, artifactId, version, scope, type ); - } - - public Artifact createArtifact( String groupId, String artifactId, String version, String packaging ) - { - return artifactFactory.createBuildArtifact( groupId, artifactId, version, packaging ); - } - - public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, - String classifier ) - { - return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); - } - - public Artifact createProjectArtifact( String groupId, String artifactId, String metaVersionId ) - { - return artifactFactory.createProjectArtifact( groupId, artifactId, metaVersionId ); - } - - public Artifact createDependencyArtifact( Dependency d ) - { - VersionRange versionRange; - try - { - versionRange = VersionRange.createFromVersionSpec( d.getVersion() ); - } - catch ( InvalidVersionSpecificationException e ) - { - return null; - } - - Artifact artifact = - artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), - d.getClassifier(), d.getScope(), d.isOptional() ); - - if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null ) - { - artifact.setFile( new File( d.getSystemPath() ) ); - } - - if ( !d.getExclusions().isEmpty() ) - { - List<String> exclusions = new ArrayList<String>(); - - for ( Exclusion exclusion : d.getExclusions() ) - { - exclusions.add( exclusion.getGroupId() + ':' + exclusion.getArtifactId() ); - } - - artifact.setDependencyFilter( new ExcludesArtifactFilter( exclusions ) ); - } - - return artifact; - } - - public Artifact createExtensionArtifact( String groupId, String artifactId, String version ) - { - VersionRange versionRange; - try - { - versionRange = VersionRange.createFromVersionSpec( version ); - } - catch ( InvalidVersionSpecificationException e ) - { - return null; - } - - return artifactFactory.createExtensionArtifact( groupId, artifactId, versionRange ); - } - - public Artifact createParentArtifact( String groupId, String artifactId, String version ) - { - return artifactFactory.createParentArtifact( groupId, artifactId, version ); - } - - public Artifact createPluginArtifact( Plugin plugin ) - { - VersionRange versionRange; - try - { - String version = plugin.getVersion(); - if ( StringUtils.isEmpty( version ) ) - { - version = "RELEASE"; - } - versionRange = VersionRange.createFromVersionSpec( version ); - } - catch ( InvalidVersionSpecificationException e ) - { - return null; - } - - return artifactFactory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange ); - } - - public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( RepositoryPolicy policy ) - { - boolean enabled = true; - - String updatePolicy = null; - - String checksumPolicy = null; - - if ( policy != null ) - { - enabled = policy.isEnabled(); - - if ( policy.getUpdatePolicy() != null ) - { - updatePolicy = policy.getUpdatePolicy(); - } - if ( policy.getChecksumPolicy() != null ) - { - checksumPolicy = policy.getChecksumPolicy(); - } - } - - return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy ); - } - - public ArtifactRepository createDefaultLocalRepository() - throws InvalidRepositoryException - { - return createLocalRepository( RepositorySystem.defaultUserLocalRepository ); - } - - public ArtifactRepository createLocalRepository( File localRepository ) - throws InvalidRepositoryException - { - return createRepository( "file://" + localRepository.toURI().getRawPath(), - RepositorySystem.DEFAULT_LOCAL_REPO_ID, true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); - } - - public ArtifactRepository createDefaultRemoteRepository() - throws InvalidRepositoryException - { - return createRepository( RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID, - true, ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY, false, - ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN ); - } - - public ArtifactRepository createLocalRepository( String url, String repositoryId ) - throws IOException - { - return createRepository( canonicalFileUrl( url ), repositoryId, true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); - } - - private String canonicalFileUrl( String url ) - throws IOException - { - if ( !url.startsWith( "file:" ) ) - { - url = "file://" + url; - } - else if ( url.startsWith( "file:" ) && !url.startsWith( "file://" ) ) - { - url = "file://" + url.substring( "file:".length() ); - } - - // So now we have an url of the form file://<path> - - // We want to eliminate any relative path nonsense and lock down the path so we - // need to fully resolve it before any sub-modules use the path. This can happen - // when you are using a custom settings.xml that contains a relative path entry - // for the local repository setting. - - File localRepository = new File( url.substring( "file://".length() ) ); - - if ( !localRepository.isAbsolute() ) - { - url = "file://" + localRepository.getCanonicalPath(); - } - - return url; - } - - public ArtifactResolutionResult resolve( ArtifactResolutionRequest request ) - { - /* - * Probably is not worth it, but here I make sure I restore request - * to its original state. - */ - try - { - LocalArtifactRepository ideWorkspace = - plexus.lookup( LocalArtifactRepository.class, LocalArtifactRepository.IDE_WORKSPACE ); - - if ( request.getLocalRepository() instanceof DelegatingLocalArtifactRepository ) - { - DelegatingLocalArtifactRepository delegatingLocalRepository = - (DelegatingLocalArtifactRepository) request.getLocalRepository(); - - LocalArtifactRepository orig = delegatingLocalRepository.getIdeWorspace(); - - delegatingLocalRepository.setIdeWorkspace( ideWorkspace ); - - try - { - return artifactResolver.resolve( request ); - } - finally - { - delegatingLocalRepository.setIdeWorkspace( orig ); - } - } - else - { - ArtifactRepository localRepository = request.getLocalRepository(); - DelegatingLocalArtifactRepository delegatingLocalRepository = - new DelegatingLocalArtifactRepository( localRepository ); - delegatingLocalRepository.setIdeWorkspace( ideWorkspace ); - request.setLocalRepository( delegatingLocalRepository ); - try - { - return artifactResolver.resolve( request ); - } - finally - { - request.setLocalRepository( localRepository ); - } - } - } - catch ( ComponentLookupException e ) - { - // no ide workspace artifact resolution - } - - return artifactResolver.resolve( request ); - } - - /* - public void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts ) - { - ProxyInfo proxyInfo = new ProxyInfo(); - proxyInfo.setHost( host ); - proxyInfo.setType( protocol ); - proxyInfo.setPort( port ); - proxyInfo.setNonProxyHosts( nonProxyHosts ); - proxyInfo.setUserName( username ); - proxyInfo.setPassword( password ); - - proxies.put( protocol, proxyInfo ); - - wagonManager.addProxy( protocol, host, port, username, password, nonProxyHosts ); - } - */ - - public List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepository> repositories ) - { - if ( repositories == null ) - { - return null; - } - - Map<String, List<ArtifactRepository>> reposByKey = new LinkedHashMap<String, List<ArtifactRepository>>(); - - for ( ArtifactRepository repository : repositories ) - { - String key = repository.getId(); - - List<ArtifactRepository> aliasedRepos = reposByKey.get( key ); - - if ( aliasedRepos == null ) - { - aliasedRepos = new ArrayList<ArtifactRepository>(); - reposByKey.put( key, aliasedRepos ); - } - - aliasedRepos.add( repository ); - } - - List<ArtifactRepository> effectiveRepositories = new ArrayList<ArtifactRepository>(); - - for ( List<ArtifactRepository> aliasedRepos : reposByKey.values() ) - { - List<ArtifactRepository> mirroredRepos = new ArrayList<ArtifactRepository>(); - - List<ArtifactRepositoryPolicy> releasePolicies = - new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() ); - - for ( ArtifactRepository aliasedRepo : aliasedRepos ) - { - releasePolicies.add( aliasedRepo.getReleases() ); - mirroredRepos.addAll( aliasedRepo.getMirroredRepositories() ); - } - - ArtifactRepositoryPolicy releasePolicy = getEffectivePolicy( releasePolicies ); - - List<ArtifactRepositoryPolicy> snapshotPolicies = - new ArrayList<ArtifactRepositoryPolicy>( aliasedRepos.size() ); - - for ( ArtifactRepository aliasedRepo : aliasedRepos ) - { - snapshotPolicies.add( aliasedRepo.getSnapshots() ); - } - - ArtifactRepositoryPolicy snapshotPolicy = getEffectivePolicy( snapshotPolicies ); - - ArtifactRepository aliasedRepo = aliasedRepos.get( 0 ); - - ArtifactRepository effectiveRepository = - createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(), - snapshotPolicy, releasePolicy ); - - effectiveRepository.setAuthentication( aliasedRepo.getAuthentication() ); - - effectiveRepository.setProxy( aliasedRepo.getProxy() ); - - effectiveRepository.setMirroredRepositories( mirroredRepos ); - - effectiveRepositories.add( effectiveRepository ); - } - - return effectiveRepositories; - } - - private ArtifactRepositoryPolicy getEffectivePolicy( Collection<ArtifactRepositoryPolicy> policies ) - { - ArtifactRepositoryPolicy effectivePolicy = null; - - for ( ArtifactRepositoryPolicy policy : policies ) - { - if ( effectivePolicy == null ) - { - effectivePolicy = new ArtifactRepositoryPolicy( policy ); - } - else - { - effectivePolicy.merge( policy ); - } - } - - return effectivePolicy; - } - - public Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors ) - { - return mirrorSelector.getMirror( repository, mirrors ); - } - - public void injectMirror( List<ArtifactRepository> repositories, List<Mirror> mirrors ) - { - if ( repositories != null && mirrors != null ) - { - for ( ArtifactRepository repository : repositories ) - { - Mirror mirror = getMirror( repository, mirrors ); - injectMirror( repository, mirror ); - } - } - } - - private Mirror getMirror( RepositorySystemSession session, ArtifactRepository repository ) - { - if ( session != null ) - { - org.eclipse.aether.repository.MirrorSelector selector = session.getMirrorSelector(); - if ( selector != null ) - { - RemoteRepository repo = selector.getMirror( RepositoryUtils.toRepo( repository ) ); - if ( repo != null ) - { - Mirror mirror = new Mirror(); - mirror.setId( repo.getId() ); - mirror.setUrl( repo.getUrl() ); - mirror.setLayout( repo.getContentType() ); - return mirror; - } - } - } - return null; - } - - public void injectMirror( RepositorySystemSession session, List<ArtifactRepository> repositories ) - { - if ( repositories != null && session != null ) - { - for ( ArtifactRepository repository : repositories ) - { - Mirror mirror = getMirror( session, repository ); - injectMirror( repository, mirror ); - } - } - } - - private void injectMirror( ArtifactRepository repository, Mirror mirror ) - { - if ( mirror != null ) - { - ArtifactRepository original = - createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(), - repository.getSnapshots(), repository.getReleases() ); - - repository.setMirroredRepositories( Collections.singletonList( original ) ); - - repository.setId( mirror.getId() ); - repository.setUrl( mirror.getUrl() ); - - if ( StringUtils.isNotEmpty( mirror.getLayout() ) ) - { - repository.setLayout( getLayout( mirror.getLayout() ) ); - } - } - } - - public void injectAuthentication( List<ArtifactRepository> repositories, List<Server> servers ) - { - if ( repositories != null ) - { - Map<String, Server> serversById = new HashMap<String, Server>(); - - if ( servers != null ) - { - for ( Server server : servers ) - { - if ( !serversById.containsKey( server.getId() ) ) - { - serversById.put( server.getId(), server ); - } - } - } - - for ( ArtifactRepository repository : repositories ) - { - Server server = serversById.get( repository.getId() ); - - if ( server != null ) - { - SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( server ); - SettingsDecryptionResult result = settingsDecrypter.decrypt( request ); - server = result.getServer(); - - if ( logger.isDebugEnabled() ) - { - for ( SettingsProblem problem : result.getProblems() ) - { - logger.debug( problem.getMessage(), problem.getException() ); - } - } - - Authentication authentication = new Authentication( server.getUsername(), server.getPassword() ); - authentication.setPrivateKey( server.getPrivateKey() ); - authentication.setPassphrase( server.getPassphrase() ); - - repository.setAuthentication( authentication ); - } - else - { - repository.setAuthentication( null ); - } - } - } - } - - private Authentication getAuthentication( RepositorySystemSession session, ArtifactRepository repository ) - { - if ( session != null ) - { - AuthenticationSelector selector = session.getAuthenticationSelector(); - if ( selector != null ) - { - RemoteRepository repo = RepositoryUtils.toRepo( repository ); - org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo ); - if ( auth != null ) - { - repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build(); - AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo ); - Authentication result = - new Authentication( authCtx.get( AuthenticationContext.USERNAME ), - authCtx.get( AuthenticationContext.PASSWORD ) ); - result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) ); - result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) ); - authCtx.close(); - return result; - } - } - } - return null; - } - - public void injectAuthentication( RepositorySystemSession session, List<ArtifactRepository> repositories ) - { - if ( repositories != null && session != null ) - { - for ( ArtifactRepository repository : repositories ) - { - repository.setAuthentication( getAuthentication( session, repository ) ); - } - } - } - - private org.apache.maven.settings.Proxy getProxy( ArtifactRepository repository, - List<org.apache.maven.settings.Proxy> proxies ) - { - if ( proxies != null && repository.getProtocol() != null ) - { - for ( org.apache.maven.settings.Proxy proxy : proxies ) - { - if ( proxy.isActive() && repository.getProtocol().equalsIgnoreCase( proxy.getProtocol() ) ) - { - if ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) ) - { - ProxyInfo pi = new ProxyInfo(); - pi.setNonProxyHosts( proxy.getNonProxyHosts() ); - - org.apache.maven.wagon.repository.Repository repo = - new org.apache.maven.wagon.repository.Repository( repository.getId(), repository.getUrl() ); - - if ( !ProxyUtils.validateNonProxyHosts( pi, repo.getHost() ) ) - { - return proxy; - } - } - else - { - return proxy; - } - } - } - } - - return null; - } - - public void injectProxy( List<ArtifactRepository> repositories, List<org.apache.maven.settings.Proxy> proxies ) - { - if ( repositories != null ) - { - for ( ArtifactRepository repository : repositories ) - { - org.apache.maven.settings.Proxy proxy = getProxy( repository, proxies ); - - if ( proxy != null ) - { - SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( proxy ); - SettingsDecryptionResult result = settingsDecrypter.decrypt( request ); - proxy = result.getProxy(); - - if ( logger.isDebugEnabled() ) - { - for ( SettingsProblem problem : result.getProblems() ) - { - logger.debug( problem.getMessage(), problem.getException() ); - } - } - - Proxy p = new Proxy(); - p.setHost( proxy.getHost() ); - p.setProtocol( proxy.getProtocol() ); - p.setPort( proxy.getPort() ); - p.setNonProxyHosts( proxy.getNonProxyHosts() ); - p.setUserName( proxy.getUsername() ); - p.setPassword( proxy.getPassword() ); - - repository.setProxy( p ); - } - else - { - repository.setProxy( null ); - } - } - } - } - - private Proxy getProxy( RepositorySystemSession session, ArtifactRepository repository ) - { - if ( session != null ) - { - ProxySelector selector = session.getProxySelector(); - if ( selector != null ) - { - RemoteRepository repo = RepositoryUtils.toRepo( repository ); - org.eclipse.aether.repository.Proxy proxy = selector.getProxy( repo ); - if ( proxy != null ) - { - Proxy p = new Proxy(); - p.setHost( proxy.getHost() ); - p.setProtocol( proxy.getType() ); - p.setPort( proxy.getPort() ); - if ( proxy.getAuthentication() != null ) - { - repo = new RemoteRepository.Builder( repo ).setProxy( proxy ).build(); - AuthenticationContext authCtx = AuthenticationContext.forProxy( session, repo ); - p.setUserName( authCtx.get( AuthenticationContext.USERNAME ) ); - p.setPassword( authCtx.get( AuthenticationContext.PASSWORD ) ); - p.setNtlmDomain( authCtx.get( AuthenticationContext.NTLM_DOMAIN ) ); - p.setNtlmHost( authCtx.get( AuthenticationContext.NTLM_WORKSTATION ) ); - authCtx.close(); - } - return p; - } - } - } - return null; - } - - public void injectProxy( RepositorySystemSession session, List<ArtifactRepository> repositories ) - { - if ( repositories != null && session != null ) - { - for ( ArtifactRepository repository : repositories ) - { - repository.setProxy( getProxy( session, repository ) ); - } - } - } - - public void retrieve( ArtifactRepository repository, File destination, String remotePath, - ArtifactTransferListener transferListener ) - throws ArtifactTransferFailedException, ArtifactDoesNotExistException - { - try - { - wagonManager.getRemoteFile( repository, destination, remotePath, - TransferListenerAdapter.newAdapter( transferListener ), - ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN, true ); - } - catch ( org.apache.maven.wagon.TransferFailedException e ) - { - throw new ArtifactTransferFailedException( getMessage( e, "Error transferring artifact." ), e ); - } - catch ( org.apache.maven.wagon.ResourceDoesNotExistException e ) - { - throw new ArtifactDoesNotExistException( getMessage( e, "Requested artifact does not exist." ), e ); - } - } - - public void publish( ArtifactRepository repository, File source, String remotePath, - ArtifactTransferListener transferListener ) - throws ArtifactTransferFailedException - { - try - { - wagonManager.putRemoteFile( repository, source, remotePath, - TransferListenerAdapter.newAdapter( transferListener ) ); - } - catch ( org.apache.maven.wagon.TransferFailedException e ) - { - throw new ArtifactTransferFailedException( getMessage( e, "Error transferring artifact." ), e ); - } - } - - // - // Artifact Repository Creation - // - public ArtifactRepository buildArtifactRepository( Repository repo ) - throws InvalidRepositoryException - { - if ( repo != null ) - { - String id = repo.getId(); - - if ( StringUtils.isEmpty( id ) ) - { - throw new InvalidRepositoryException( "Repository identifier missing", "" ); - } - - String url = repo.getUrl(); - - if ( StringUtils.isEmpty( url ) ) - { - throw new InvalidRepositoryException( "URL missing for repository " + id, id ); - } - - ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() ); - - ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() ); - - return createArtifactRepository( id, url, getLayout( repo.getLayout() ), snapshots, releases ); - } - else - { - return null; - } - } - - private ArtifactRepository createRepository( String url, String repositoryId, boolean releases, - String releaseUpdates, boolean snapshots, String snapshotUpdates, - String checksumPolicy ) - { - ArtifactRepositoryPolicy snapshotsPolicy = - new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy ); - - ArtifactRepositoryPolicy releasesPolicy = - new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy ); - - return createArtifactRepository( repositoryId, url, null, snapshotsPolicy, releasesPolicy ); - } - - public ArtifactRepository createArtifactRepository( String repositoryId, String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases ) - { - if ( repositoryLayout == null ) - { - repositoryLayout = layouts.get( "default" ); - } - - ArtifactRepository artifactRepository = - artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots, - releases ); - - return artifactRepository; - } - - private static String getMessage( Throwable error, String def ) - { - if ( error == null ) - { - return def; - } - String msg = error.getMessage(); - if ( StringUtils.isNotEmpty( msg ) ) - { - return msg; - } - return getMessage( error.getCause(), def ); - } - - private ArtifactRepositoryLayout getLayout( String id ) - { - ArtifactRepositoryLayout layout = layouts.get( id ); - - if ( layout == null ) - { - layout = new UnknownRepositoryLayout( id, layouts.get( "default" ) ); - } - - return layout; - } - - /** - * In the future, the legacy system might encounter repository types for which no layout components exists because - * the actual communication with the repository happens via a repository connector. As a minimum, the legacy system - * needs to retain the id of this layout so that the content type of the remote repository can still be accurately - * described. - */ - static class UnknownRepositoryLayout - implements ArtifactRepositoryLayout - { - - private final String id; - - private final ArtifactRepositoryLayout fallback; - - public UnknownRepositoryLayout( String id, ArtifactRepositoryLayout fallback ) - { - this.id = id; - this.fallback = fallback; - } - - public String getId() - { - return id; - } - - public String pathOf( Artifact artifact ) - { - return fallback.pathOf( artifact ); - } - - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) - { - return fallback.pathOfLocalRepositoryMetadata( metadata, repository ); - } - - public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) - { - return fallback.pathOfRemoteRepositoryMetadata( metadata ); - } - - @Override - public String toString() - { - return getId(); - } - - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java deleted file mode 100644 index 29b9b82d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.repository.ArtifactTransferResource; -import org.apache.maven.wagon.resource.Resource; - -class MavenArtifact - implements ArtifactTransferResource -{ - - private String repositoryUrl; - - private Resource resource; - - private long transferStartTime; - - public MavenArtifact( String repositoryUrl, Resource resource ) - { - if ( repositoryUrl == null ) - { - this.repositoryUrl = ""; - } - else if ( !repositoryUrl.endsWith( "/" ) && repositoryUrl.length() > 0 ) - { - this.repositoryUrl = repositoryUrl + '/'; - } - else - { - this.repositoryUrl = repositoryUrl; - } - this.resource = resource; - - this.transferStartTime = System.currentTimeMillis(); - } - - public String getRepositoryUrl() - { - return repositoryUrl; - } - - public String getName() - { - String name = resource.getName(); - - if ( name == null ) - { - name = ""; - } - else if ( name.startsWith( "/" ) ) - { - name = name.substring( 1 ); - } - - return name; - } - - public String getUrl() - { - return getRepositoryUrl() + getName(); - } - - public long getContentLength() - { - return resource.getContentLength(); - } - - public long getTransferStartTime() - { - return transferStartTime; - } - - @Override - public String toString() - { - return getUrl(); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java deleted file mode 100644 index b20bd72b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.IdentityHashMap; -import java.util.Map; - -import org.apache.maven.repository.ArtifactTransferEvent; -import org.apache.maven.repository.ArtifactTransferListener; -import org.apache.maven.repository.ArtifactTransferResource; -import org.apache.maven.wagon.events.TransferEvent; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.repository.Repository; -import org.apache.maven.wagon.resource.Resource; - -public class TransferListenerAdapter - implements TransferListener -{ - - private final ArtifactTransferListener listener; - - private final Map<Resource, ArtifactTransferResource> artifacts; - - private final Map<Resource, Long> transfers; - - public static TransferListener newAdapter( ArtifactTransferListener listener ) - { - if ( listener == null ) - { - return null; - } - else - { - return new TransferListenerAdapter( listener ); - } - } - - private TransferListenerAdapter( ArtifactTransferListener listener ) - { - this.listener = listener; - this.artifacts = new IdentityHashMap<Resource, ArtifactTransferResource>(); - this.transfers = new IdentityHashMap<Resource, Long>(); - } - - public void debug( String message ) - { - } - - public void transferCompleted( TransferEvent transferEvent ) - { - ArtifactTransferEvent event = wrap( transferEvent ); - - Long transferred; - synchronized ( transfers ) - { - transferred = transfers.remove( transferEvent.getResource() ); - } - if ( transferred != null ) - { - event.setTransferredBytes( transferred ); - } - - synchronized ( artifacts ) - { - artifacts.remove( transferEvent.getResource() ); - } - - listener.transferCompleted( event ); - } - - public void transferError( TransferEvent transferEvent ) - { - synchronized ( transfers ) - { - transfers.remove( transferEvent.getResource() ); - } - synchronized ( artifacts ) - { - artifacts.remove( transferEvent.getResource() ); - } - } - - public void transferInitiated( TransferEvent transferEvent ) - { - listener.transferInitiated( wrap( transferEvent ) ); - } - - public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length ) - { - Long transferred; - synchronized ( transfers ) - { - transferred = transfers.get( transferEvent.getResource() ); - if ( transferred == null ) - { - transferred = (long) length; - } - else - { - transferred = transferred + length; - } - transfers.put( transferEvent.getResource(), transferred ); - } - - ArtifactTransferEvent event = wrap( transferEvent ); - event.setDataBuffer( buffer ); - event.setDataOffset( 0 ); - event.setDataLength( length ); - event.setTransferredBytes( transferred ); - - listener.transferProgress( event ); - } - - public void transferStarted( TransferEvent transferEvent ) - { - listener.transferStarted( wrap( transferEvent ) ); - } - - private ArtifactTransferEvent wrap( TransferEvent event ) - { - if ( event == null ) - { - return null; - } - else - { - String wagon = event.getWagon().getClass().getName(); - - ArtifactTransferResource artifact = wrap( event.getWagon().getRepository(), event.getResource() ); - - ArtifactTransferEvent evt; - if ( event.getException() != null ) - { - evt = new ArtifactTransferEvent( wagon, event.getException(), event.getRequestType(), artifact ); - } - else - { - evt = new ArtifactTransferEvent( wagon, event.getEventType(), event.getRequestType(), artifact ); - } - - evt.setLocalFile( event.getLocalFile() ); - - return evt; - } - } - - private ArtifactTransferResource wrap( Repository repository, Resource resource ) - { - if ( resource == null ) - { - return null; - } - else - { - synchronized ( artifacts ) - { - ArtifactTransferResource artifact = artifacts.get( resource ); - - if ( artifact == null ) - { - artifact = new MavenArtifact( repository.getUrl(), resource ); - artifacts.put( resource, artifact ); - } - - return artifact; - } - } - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java deleted file mode 100644 index f4e969b6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; - -public interface UpdateCheckManager -{ - - boolean isUpdateRequired( Artifact artifact, ArtifactRepository repository ); - - void touch( Artifact artifact, ArtifactRepository repository, String error ); - - String getError( Artifact artifact, ArtifactRepository repository ); - - boolean isUpdateRequired( RepositoryMetadata metadata, ArtifactRepository repository, File file ); - - void touch( RepositoryMetadata metadata, ArtifactRepository repository, File file ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java deleted file mode 100644 index 078de00c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.wagon.TransferFailedException; - - -public class WagonConfigurationException - extends TransferFailedException -{ - - static final long serialVersionUID = 1; - - private final String originalMessage; - private final String repositoryId; - - public WagonConfigurationException( String repositoryId, - String message, - Throwable cause ) - { - super( "While configuring wagon for \'" + repositoryId + "\': " + message, cause ); - - this.repositoryId = repositoryId; - this.originalMessage = message; - } - - public WagonConfigurationException( String repositoryId, - String message ) - { - super( "While configuring wagon for \'" + repositoryId + "\': " + message ); - - this.repositoryId = repositoryId; - this.originalMessage = message; - } - - public final String getRepositoryId() - { - return repositoryId; - } - - public final String getOriginalMessage() - { - return originalMessage; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java deleted file mode 100644 index 73ead269..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.apache.maven.repository.legacy; - -/* - * 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.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.repository.Repository; - -public interface WagonManager -{ - @Deprecated - Wagon getWagon( String protocol ) - throws UnsupportedProtocolException; - - @Deprecated - Wagon getWagon( Repository repository ) - throws UnsupportedProtocolException, WagonConfigurationException; - - // - // Retriever - // - void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, - TransferListener transferListener, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, - TransferListener downloadMonitor, String checksumPolicy, boolean force ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination, - String checksumPolicy ) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, - File file, String checksumPolicyWarn ) - throws TransferFailedException, ResourceDoesNotExistException; - - // - // Deployer - // - void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, - TransferListener downloadMonitor ) - throws TransferFailedException; - - void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) - throws TransferFailedException; - - void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository ) - throws TransferFailedException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java deleted file mode 100644 index b982f917..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.maven.repository.legacy.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; - -/** @author jdcasey */ -public interface ArtifactRepositoryFactory -{ - - String DEFAULT_LAYOUT_ID = "default"; - - String LOCAL_REPOSITORY_ID = "local"; - - @Deprecated - ArtifactRepositoryLayout getLayout( String layoutId ) - throws UnknownRepositoryLayoutException; - - @Deprecated - ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, - boolean uniqueVersion ); - - ArtifactRepository createArtifactRepository( String id, String url, String layoutId, - ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); - - void setGlobalUpdatePolicy( String snapshotPolicy ); - - void setGlobalChecksumPolicy( String checksumPolicy ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java deleted file mode 100644 index 4bc91167..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java +++ /dev/null @@ -1,144 +0,0 @@ -package org.apache.maven.repository.legacy.repository; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.Map; - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.MavenArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - * @author jdcasey - */ -@Component( role = ArtifactRepositoryFactory.class ) -public class DefaultArtifactRepositoryFactory - implements ArtifactRepositoryFactory -{ - // TODO: use settings? - private String globalUpdatePolicy; - - private String globalChecksumPolicy; - - @Requirement( role = ArtifactRepositoryLayout.class ) - private Map<String, ArtifactRepositoryLayout> repositoryLayouts; - - public ArtifactRepositoryLayout getLayout( String layoutId ) - throws UnknownRepositoryLayoutException - { - return repositoryLayouts.get( layoutId ); - } - - public ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, - boolean uniqueVersion ) - throws UnknownRepositoryLayoutException - { - ArtifactRepositoryLayout layout = repositoryLayouts.get( layoutId ); - - checkLayout( id, layoutId, layout ); - - return createDeploymentArtifactRepository( id, url, layout, uniqueVersion ); - } - - private void checkLayout( String repositoryId, String layoutId, ArtifactRepositoryLayout layout ) - throws UnknownRepositoryLayoutException - { - if ( layout == null ) - { - throw new UnknownRepositoryLayoutException( repositoryId, layoutId ); - } - } - - public ArtifactRepository createDeploymentArtifactRepository( String id, String url, - ArtifactRepositoryLayout repositoryLayout, - boolean uniqueVersion ) - { - return createArtifactRepository( id, url, repositoryLayout, null, null ); - } - - public ArtifactRepository createArtifactRepository( String id, String url, String layoutId, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases ) - throws UnknownRepositoryLayoutException - { - ArtifactRepositoryLayout layout = repositoryLayouts.get( layoutId ); - - checkLayout( id, layoutId, layout ); - - return createArtifactRepository( id, url, layout, snapshots, releases ); - } - - public ArtifactRepository createArtifactRepository( String id, String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases ) - { - if ( snapshots == null ) - { - snapshots = new ArtifactRepositoryPolicy(); - } - - if ( releases == null ) - { - releases = new ArtifactRepositoryPolicy(); - } - - if ( globalUpdatePolicy != null ) - { - snapshots.setUpdatePolicy( globalUpdatePolicy ); - releases.setUpdatePolicy( globalUpdatePolicy ); - } - - if ( globalChecksumPolicy != null ) - { - snapshots.setChecksumPolicy( globalChecksumPolicy ); - releases.setChecksumPolicy( globalChecksumPolicy ); - } - - ArtifactRepository repository; - if ( repositoryLayout instanceof ArtifactRepositoryLayout2 ) - { - repository = - ( (ArtifactRepositoryLayout2) repositoryLayout ).newMavenArtifactRepository( id, url, snapshots, - releases ); - } - else - { - repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases ); - } - - return repository; - } - - public void setGlobalUpdatePolicy( String updatePolicy ) - { - globalUpdatePolicy = updatePolicy; - } - - public void setGlobalChecksumPolicy( String checksumPolicy ) - { - globalChecksumPolicy = checksumPolicy; - } - } diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java deleted file mode 100644 index f734416b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ /dev/null @@ -1,796 +0,0 @@ -package org.apache.maven.repository.legacy.resolver; - -/* - * 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.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -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.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.CyclicDependencyException; -import org.apache.maven.artifact.resolver.ResolutionListener; -import org.apache.maven.artifact.resolver.ResolutionListenerForDepMgmt; -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.ManagedVersionMap; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; - -/** - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @author Jason van Zyl - */ -@Component( role = LegacyArtifactCollector.class ) -public class DefaultLegacyArtifactCollector - implements LegacyArtifactCollector -{ - @Requirement( hint = "nearest" ) - private ConflictResolver defaultConflictResolver; - - @Requirement - private Logger logger; - - @Requirement - private LegacySupport legacySupport; - - private void injectSession( ArtifactResolutionRequest request ) - { - MavenSession session = legacySupport.getSession(); - - if ( session != null ) - { - request.setOffline( session.isOffline() ); - request.setForceUpdate( session.getRequest().isUpdateSnapshots() ); - request.setServers( session.getRequest().getServers() ); - request.setMirrors( session.getRequest().getMirrors() ); - request.setProxies( session.getRequest().getProxies() ); - } - } - - public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners, - List<ConflictResolver> conflictResolvers ) - { - ArtifactResolutionRequest request = new ArtifactResolutionRequest(); - request.setLocalRepository( localRepository ); - request.setRemoteRepositories( remoteRepositories ); - injectSession( request ); - return collect( artifacts, originatingArtifact, managedVersions, request, source, filter, listeners, - conflictResolvers ); - } - - public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactResolutionRequest repositoryRequest, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners, - List<ConflictResolver> conflictResolvers ) - { - ArtifactResolutionResult result = new ArtifactResolutionResult(); - - result.setOriginatingArtifact( originatingArtifact ); - - if ( conflictResolvers == null ) - { - conflictResolvers = Collections.singletonList( defaultConflictResolver ); - } - - Map<Object, List<ResolutionNode>> resolvedArtifacts = new LinkedHashMap<Object, List<ResolutionNode>>(); - - ResolutionNode root = new ResolutionNode( originatingArtifact, repositoryRequest.getRemoteRepositories() ); - - try - { - root.addDependencies( artifacts, repositoryRequest.getRemoteRepositories(), filter ); - } - catch ( CyclicDependencyException e ) - { - result.addCircularDependencyException( e ); - - return result; - } - catch ( OverConstrainedVersionException e ) - { - result.addVersionRangeViolation( e ); - - return result; - } - - ManagedVersionMap versionMap = getManagedVersionsMap( originatingArtifact, managedVersions ); - - try - { - recurse( result, root, resolvedArtifacts, versionMap, repositoryRequest, source, filter, listeners, - conflictResolvers ); - } - catch ( CyclicDependencyException e ) - { - logger.debug( "While recursing: " + e.getMessage(), e ); - result.addCircularDependencyException( e ); - } - catch ( OverConstrainedVersionException e ) - { - logger.debug( "While recursing: " + e.getMessage(), e ); - result.addVersionRangeViolation( e ); - } - catch ( ArtifactResolutionException e ) - { - logger.debug( "While recursing: " + e.getMessage(), e ); - result.addErrorArtifactException( e ); - } - - Set<ResolutionNode> set = new LinkedHashSet<ResolutionNode>(); - - for ( List<ResolutionNode> nodes : resolvedArtifacts.values() ) - { - for ( ResolutionNode node : nodes ) - { - if ( !node.equals( root ) && node.isActive() ) - { - Artifact artifact = node.getArtifact(); - - try - { - if ( node.filterTrail( filter ) ) - { - // If it was optional and not a direct dependency, - // we don't add it or its children, just allow the update of the version and artifactScope - if ( node.isChildOfRootNode() || !artifact.isOptional() ) - { - artifact.setDependencyTrail( node.getDependencyTrail() ); - - set.add( node ); - - // This is required right now. - result.addArtifact( artifact ); - } - } - } - catch ( OverConstrainedVersionException e ) - { - result.addVersionRangeViolation( e ); - } - } - } - } - - result.setArtifactResolutionNodes( set ); - - return result; - } - - /** - * Get the map of managed versions, removing the originating artifact if it is also in managed versions - * - * @param originatingArtifact artifact we are processing - * @param managedVersions original managed versions - */ - private ManagedVersionMap getManagedVersionsMap( Artifact originatingArtifact, Map managedVersions ) - { - ManagedVersionMap versionMap; - if ( ( managedVersions != null ) && ( managedVersions instanceof ManagedVersionMap ) ) - { - versionMap = (ManagedVersionMap) managedVersions; - } - else - { - versionMap = new ManagedVersionMap( managedVersions ); - } - - /* remove the originating artifact if it is also in managed versions to avoid being modified during resolution */ - Artifact managedOriginatingArtifact = versionMap.get( originatingArtifact.getDependencyConflictId() ); - - if ( managedOriginatingArtifact != null ) - { - // TODO we probably want to warn the user that he is building an artifact with - // different values than in dependencyManagement - if ( managedVersions instanceof ManagedVersionMap ) - { - /* avoid modifying the managedVersions parameter creating a new map */ - versionMap = new ManagedVersionMap( managedVersions ); - } - versionMap.remove( originatingArtifact.getDependencyConflictId() ); - } - - return versionMap; - } - - private void recurse( ArtifactResolutionResult result, ResolutionNode node, - Map<Object, List<ResolutionNode>> resolvedArtifacts, ManagedVersionMap managedVersions, - ArtifactResolutionRequest request, ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners, List<ConflictResolver> conflictResolvers ) - throws ArtifactResolutionException - { - fireEvent( ResolutionListener.TEST_ARTIFACT, listeners, node ); - - Object key = node.getKey(); - - // TODO: Does this check need to happen here? Had to add the same call - // below when we iterate on child nodes -- will that suffice? - if ( managedVersions.containsKey( key ) ) - { - manageArtifact( node, managedVersions, listeners ); - } - - List<ResolutionNode> previousNodes = resolvedArtifacts.get( key ); - - if ( previousNodes != null ) - { - for ( ResolutionNode previous : previousNodes ) - { - try - { - if ( previous.isActive() ) - { - // Version mediation - VersionRange previousRange = previous.getArtifact().getVersionRange(); - VersionRange currentRange = node.getArtifact().getVersionRange(); - - if ( ( previousRange != null ) && ( currentRange != null ) ) - { - // TODO: shouldn't need to double up on this work, only done for simplicity of handling - // recommended - // version but the restriction is identical - VersionRange newRange = previousRange.restrict( currentRange ); - // TODO: ick. this forces the OCE that should have come from the previous call. It is still - // correct - if ( newRange.isSelectedVersionKnown( previous.getArtifact() ) ) - { - fireEvent( ResolutionListener.RESTRICT_RANGE, listeners, node, previous.getArtifact(), - newRange ); - } - previous.getArtifact().setVersionRange( newRange ); - node.getArtifact().setVersionRange( currentRange.restrict( previousRange ) ); - - // Select an appropriate available version from the (now restricted) range - // Note this version was selected before to get the appropriate POM - // But it was reset by the call to setVersionRange on restricting the version - ResolutionNode[] resetNodes = { previous, node }; - for ( int j = 0; j < 2; j++ ) - { - Artifact resetArtifact = resetNodes[j].getArtifact(); - - // MNG-2123: if the previous node was not a range, then it wouldn't have any available - // versions. We just clobbered the selected version above. (why? i have no idea.) - // So since we are here and this is ranges we must go figure out the version (for a - // third time...) - if ( resetArtifact.getVersion() == null && resetArtifact.getVersionRange() != null ) - { - - // go find the version. This is a total hack. See previous comment. - List<ArtifactVersion> versions = resetArtifact.getAvailableVersions(); - if ( versions == null ) - { - try - { - MetadataResolutionRequest metadataRequest = - new DefaultMetadataResolutionRequest( request ); - metadataRequest.setArtifact( resetArtifact ); - versions = source.retrieveAvailableVersions( metadataRequest ); - resetArtifact.setAvailableVersions( versions ); - } - catch ( ArtifactMetadataRetrievalException e ) - { - resetArtifact.setDependencyTrail( node.getDependencyTrail() ); - throw new ArtifactResolutionException( - "Unable to get dependency information: " - + e.getMessage(), resetArtifact, - request.getRemoteRepositories(), e ); - } - } - // end hack - - // MNG-2861: match version can return null - ArtifactVersion selectedVersion = - resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() ); - if ( selectedVersion != null ) - { - resetArtifact.selectVersion( selectedVersion.toString() ); - } - else - { - throw new OverConstrainedVersionException( " Unable to find a version in " - + resetArtifact.getAvailableVersions() + " to match the range " - + resetArtifact.getVersionRange(), resetArtifact ); - } - - fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, resetNodes[j] ); - } - } - } - - // Conflict Resolution - ResolutionNode resolved = null; - for ( Iterator j = conflictResolvers.iterator(); ( resolved == null ) && j.hasNext(); ) - { - ConflictResolver conflictResolver = (ConflictResolver) j.next(); - - resolved = conflictResolver.resolveConflict( previous, node ); - } - - if ( resolved == null ) - { - // TODO: add better exception that can detail the two conflicting artifacts - ArtifactResolutionException are = - new ArtifactResolutionException( "Cannot resolve artifact version conflict between " - + previous.getArtifact().getVersion() + " and " + node.getArtifact().getVersion(), - previous.getArtifact() ); - result.addVersionRangeViolation( are ); - } - - if ( ( resolved != previous ) && ( resolved != node ) ) - { - // TODO: add better exception - result.addVersionRangeViolation( new ArtifactResolutionException( - "Conflict resolver returned unknown resolution node: ", - resolved.getArtifact() ) ); - } - - // TODO: should this be part of mediation? - // previous one is more dominant - ResolutionNode nearest; - ResolutionNode farthest; - - if ( resolved == previous ) - { - nearest = previous; - farthest = node; - } - else - { - nearest = node; - farthest = previous; - } - - if ( checkScopeUpdate( farthest, nearest, listeners ) ) - { - // if we need to update artifactScope of nearest to use farthest artifactScope, use the - // nearest version, but farthest artifactScope - nearest.disable(); - farthest.getArtifact().setVersion( nearest.getArtifact().getVersion() ); - fireEvent( ResolutionListener.OMIT_FOR_NEARER, listeners, nearest, farthest.getArtifact() ); - } - else - { - farthest.disable(); - fireEvent( ResolutionListener.OMIT_FOR_NEARER, listeners, farthest, nearest.getArtifact() ); - } - } - } - catch ( OverConstrainedVersionException e ) - { - result.addVersionRangeViolation( e ); - } - } - } - else - { - previousNodes = new ArrayList<ResolutionNode>(); - - resolvedArtifacts.put( key, previousNodes ); - } - previousNodes.add( node ); - - if ( node.isActive() ) - { - fireEvent( ResolutionListener.INCLUDE_ARTIFACT, listeners, node ); - } - - // don't pull in the transitive deps of a system-scoped dependency. - if ( node.isActive() && !Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) ) - { - fireEvent( ResolutionListener.PROCESS_CHILDREN, listeners, node ); - - Artifact parentArtifact = node.getArtifact(); - - for ( Iterator i = node.getChildrenIterator(); i.hasNext(); ) - { - ResolutionNode child = (ResolutionNode) i.next(); - - try - { - - // We leave in optional ones, but don't pick up its dependencies - if ( !child.isResolved() && ( !child.getArtifact().isOptional() || child.isChildOfRootNode() ) ) - { - Artifact artifact = child.getArtifact(); - artifact.setDependencyTrail( node.getDependencyTrail() ); - List<ArtifactRepository> childRemoteRepositories = child.getRemoteRepositories(); - - MetadataResolutionRequest metadataRequest = - new DefaultMetadataResolutionRequest( request ); - metadataRequest.setArtifact( artifact ); - metadataRequest.setRemoteRepositories( childRemoteRepositories ); - - try - { - ResolutionGroup rGroup; - - Object childKey; - do - { - childKey = child.getKey(); - - if ( managedVersions.containsKey( childKey ) ) - { - // If this child node is a managed dependency, ensure - // we are using the dependency management version - // of this child if applicable b/c we want to use the - // managed version's POM, *not* any other version's POM. - // We retrieve the POM below in the retrieval step. - manageArtifact( child, managedVersions, listeners ); - - // Also, we need to ensure that any exclusions it presents are - // added to the artifact before we retrive the metadata - // for the artifact; otherwise we may end up with unwanted - // dependencies. - Artifact ma = managedVersions.get( childKey ); - ArtifactFilter managedExclusionFilter = ma.getDependencyFilter(); - if ( null != managedExclusionFilter ) - { - if ( null != artifact.getDependencyFilter() ) - { - AndArtifactFilter aaf = new AndArtifactFilter(); - aaf.add( artifact.getDependencyFilter() ); - aaf.add( managedExclusionFilter ); - artifact.setDependencyFilter( aaf ); - } - else - { - artifact.setDependencyFilter( managedExclusionFilter ); - } - } - } - - if ( artifact.getVersion() == null ) - { - // set the recommended version - // TODO: maybe its better to just pass the range through to retrieval and use a - // transformation? - ArtifactVersion version; - if ( !artifact.isSelectedVersionKnown() ) - { - List<ArtifactVersion> versions = artifact.getAvailableVersions(); - if ( versions == null ) - { - versions = source.retrieveAvailableVersions( metadataRequest ); - artifact.setAvailableVersions( versions ); - } - - Collections.sort( versions ); - - VersionRange versionRange = artifact.getVersionRange(); - - version = versionRange.matchVersion( versions ); - - if ( version == null ) - { - if ( versions.isEmpty() ) - { - throw new OverConstrainedVersionException( - "No versions are present in the repository for the artifact with a range " - + versionRange, - artifact, - childRemoteRepositories ); - } - - throw new OverConstrainedVersionException( "Couldn't find a version in " - + versions + " to match range " + versionRange, artifact, - childRemoteRepositories ); - } - } - else - { - version = artifact.getSelectedVersion(); - } - - artifact.selectVersion( version.toString() ); - fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, child ); - } - - rGroup = source.retrieve( metadataRequest ); - - if ( rGroup == null ) - { - break; - } - } - while( !childKey.equals( child.getKey() ) ); - - if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null - && !parentArtifact.getDependencyFilter().include( artifact ) ) - { - // MNG-3769: the [probably relocated] artifact is excluded. - // We could process exclusions on relocated artifact details in the - // MavenMetadataSource.createArtifacts(..) step, BUT that would - // require resolving the POM from the repository very early on in - // the build. - continue; - } - - // TODO might be better to have source.retrieve() throw a specific exception for this - // situation - // and catch here rather than have it return null - if ( rGroup == null ) - { - // relocated dependency artifact is declared excluded, no need to add and recurse - // further - continue; - } - - child.addDependencies( rGroup.getArtifacts(), rGroup.getResolutionRepositories(), filter ); - - } - catch ( CyclicDependencyException e ) - { - // would like to throw this, but we have crappy stuff in the repo - - fireEvent( ResolutionListener.OMIT_FOR_CYCLE, listeners, - new ResolutionNode( e.getArtifact(), childRemoteRepositories, child ) ); - } - catch ( ArtifactMetadataRetrievalException e ) - { - artifact.setDependencyTrail( node.getDependencyTrail() ); - - throw new ArtifactResolutionException( "Unable to get dependency information for " - + artifact.getId() + ": " + e.getMessage(), artifact, childRemoteRepositories, e ); - } - - ArtifactResolutionRequest subRequest = new ArtifactResolutionRequest( metadataRequest ); - subRequest.setServers( request.getServers() ); - subRequest.setMirrors( request.getMirrors() ); - subRequest.setProxies( request.getProxies() ); - recurse( result, child, resolvedArtifacts, managedVersions, subRequest, source, filter, - listeners, conflictResolvers ); - } - } - catch ( OverConstrainedVersionException e ) - { - result.addVersionRangeViolation( e ); - } - catch ( ArtifactResolutionException e ) - { - result.addMetadataResolutionException( e ); - } - } - - fireEvent( ResolutionListener.FINISH_PROCESSING_CHILDREN, listeners, node ); - } - } - - private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions, - List<ResolutionListener> listeners ) - { - Artifact artifact = managedVersions.get( node.getKey() ); - - // Before we update the version of the artifact, we need to know - // whether we are working on a transitive dependency or not. This - // allows depMgmt to always override transitive dependencies, while - // explicit child override depMgmt (viz. depMgmt should only - // provide defaults to children, but should override transitives). - // We can do this by calling isChildOfRootNode on the current node. - - if ( ( artifact.getVersion() != null ) - && ( !node.isChildOfRootNode() || node.getArtifact().getVersion() == null ) ) - { - fireEvent( ResolutionListener.MANAGE_ARTIFACT_VERSION, listeners, node, artifact ); - node.getArtifact().setVersion( artifact.getVersion() ); - } - - if ( ( artifact.getScope() != null ) && ( !node.isChildOfRootNode() || node.getArtifact().getScope() == null ) ) - { - fireEvent( ResolutionListener.MANAGE_ARTIFACT_SCOPE, listeners, node, artifact ); - node.getArtifact().setScope( artifact.getScope() ); - } - - if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) && ( node.getArtifact().getFile() == null ) - && ( artifact.getFile() != null ) ) - { - fireEvent( ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH, listeners, node, artifact ); - node.getArtifact().setFile( artifact.getFile() ); - } - } - - /** - * Check if the artifactScope needs to be updated. <a - * href="http://docs.codehaus.org/x/IGU#DependencyMediationandConflictResolution-Scoperesolution">More info</a>. - * - * @param farthest farthest resolution node - * @param nearest nearest resolution node - * @param listeners - */ - boolean checkScopeUpdate( ResolutionNode farthest, ResolutionNode nearest, List<ResolutionListener> listeners ) - { - boolean updateScope = false; - Artifact farthestArtifact = farthest.getArtifact(); - Artifact nearestArtifact = nearest.getArtifact(); - - /* farthest is runtime and nearest has lower priority, change to runtime */ - if ( Artifact.SCOPE_RUNTIME.equals( farthestArtifact.getScope() ) - && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) - || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) ) - { - updateScope = true; - } - - /* farthest is compile and nearest is not (has lower priority), change to compile */ - if ( Artifact.SCOPE_COMPILE.equals( farthestArtifact.getScope() ) - && !Artifact.SCOPE_COMPILE.equals( nearestArtifact.getScope() ) ) - { - updateScope = true; - } - - /* current POM rules all, if nearest is in current pom, do not update its artifactScope */ - if ( ( nearest.getDepth() < 2 ) && updateScope ) - { - updateScope = false; - - fireEvent( ResolutionListener.UPDATE_SCOPE_CURRENT_POM, listeners, nearest, farthestArtifact ); - } - - if ( updateScope ) - { - fireEvent( ResolutionListener.UPDATE_SCOPE, listeners, nearest, farthestArtifact ); - - // previously we cloned the artifact, but it is more effecient to just update the artifactScope - // if problems are later discovered that the original object needs its original artifactScope value, cloning - // may - // again be appropriate - nearestArtifact.setScope( farthestArtifact.getScope() ); - } - - return updateScope; - } - - private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode node ) - { - fireEvent( event, listeners, node, null ); - } - - private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode node, Artifact replacement ) - { - fireEvent( event, listeners, node, replacement, null ); - } - - private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode node, Artifact replacement, - VersionRange newRange ) - { - for ( ResolutionListener listener : listeners ) - { - switch ( event ) - { - case ResolutionListener.TEST_ARTIFACT: - listener.testArtifact( node.getArtifact() ); - break; - case ResolutionListener.PROCESS_CHILDREN: - listener.startProcessChildren( node.getArtifact() ); - break; - case ResolutionListener.FINISH_PROCESSING_CHILDREN: - listener.endProcessChildren( node.getArtifact() ); - break; - case ResolutionListener.INCLUDE_ARTIFACT: - listener.includeArtifact( node.getArtifact() ); - break; - case ResolutionListener.OMIT_FOR_NEARER: - listener.omitForNearer( node.getArtifact(), replacement ); - break; - case ResolutionListener.OMIT_FOR_CYCLE: - listener.omitForCycle( node.getArtifact() ); - break; - case ResolutionListener.UPDATE_SCOPE: - listener.updateScope( node.getArtifact(), replacement.getScope() ); - break; - case ResolutionListener.UPDATE_SCOPE_CURRENT_POM: - listener.updateScopeCurrentPom( node.getArtifact(), replacement.getScope() ); - break; - case ResolutionListener.MANAGE_ARTIFACT_VERSION: - if ( listener instanceof ResolutionListenerForDepMgmt ) - { - ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener; - asImpl.manageArtifactVersion( node.getArtifact(), replacement ); - } - else - { - listener.manageArtifact( node.getArtifact(), replacement ); - } - break; - case ResolutionListener.MANAGE_ARTIFACT_SCOPE: - if ( listener instanceof ResolutionListenerForDepMgmt ) - { - ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener; - asImpl.manageArtifactScope( node.getArtifact(), replacement ); - } - else - { - listener.manageArtifact( node.getArtifact(), replacement ); - } - break; - case ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH: - if ( listener instanceof ResolutionListenerForDepMgmt ) - { - ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener; - asImpl.manageArtifactSystemPath( node.getArtifact(), replacement ); - } - else - { - listener.manageArtifact( node.getArtifact(), replacement ); - } - break; - case ResolutionListener.SELECT_VERSION_FROM_RANGE: - listener.selectVersionFromRange( node.getArtifact() ); - break; - case ResolutionListener.RESTRICT_RANGE: - if ( node.getArtifact().getVersionRange().hasRestrictions() - || replacement.getVersionRange().hasRestrictions() ) - { - listener.restrictRange( node.getArtifact(), replacement, newRange ); - } - break; - default: - throw new IllegalStateException( "Unknown event: " + event ); - } - } - } - - public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ) - { - return collect( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, - filter, listeners, null ); - } - - public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ) - { - return collect( artifacts, originatingArtifact, null, localRepository, remoteRepositories, source, filter, - listeners ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java deleted file mode 100644 index fa7fb7a4..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.maven.repository.legacy.resolver; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ResolutionListener; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; - -/** - * Artifact collector - takes a set of original artifacts and resolves all of the best versions to use - * along with their metadata. No artifacts are downloaded. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -@Deprecated -public interface LegacyArtifactCollector -{ - - ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, - ArtifactResolutionRequest repositoryRequest, ArtifactMetadataSource source, - ArtifactFilter filter, List<ResolutionListener> listeners, - List<ConflictResolver> conflictResolvers ); - - ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, - ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners, List<ConflictResolver> conflictResolvers ); - - // used by maven-dependency-tree and maven-dependency-plugin - @Deprecated - ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, - ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List<ResolutionListener> listeners ); - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java deleted file mode 100644 index 4d129b7e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.resolver.ResolutionNode; - -/** - * Determines which version of an artifact to use when there are conflicting declarations. - * - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a> - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - */ -public interface ConflictResolver -{ - String ROLE = ConflictResolver.class.getName(); - - /** - * Determines which of the specified versions of an artifact to use when there are conflicting declarations. - * - * @param node1 the first artifact declaration - * @param node2 the second artifact declaration - * @return the artifact declaration to use: <code>node1</code>; <code>node2</code>; or <code>null</code>if - * this conflict cannot be resolved - * @since 3.0 - */ - ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java deleted file mode 100644 index 8f3f9f43..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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. - */ - -/** - * A factory that produces conflict resolvers of various types. - * - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @see ConflictResolver - * @since 3.0 - */ -public interface ConflictResolverFactory -{ - // constants -------------------------------------------------------------- - - /** The plexus role for this component. */ - String ROLE = ConflictResolverFactory.class.getName(); - - // methods ---------------------------------------------------------------- - - /** - * Gets a conflict resolver of the specified type. - * - * @param type the type of conflict resolver to obtain - * @return the conflict resolver - * @throws ConflictResolverNotFoundException - * if the specified type was not found - */ - ConflictResolver getConflictResolver( String type ) - throws ConflictResolverNotFoundException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java deleted file mode 100644 index b5f61ed1..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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. - */ - -/** - * Indicates that a specified conflict resolver implementation could not be found. - * - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @since 3.0 - */ -public class ConflictResolverNotFoundException - extends Exception -{ - // constants -------------------------------------------------------------- - - /** The serial version ID. */ - private static final long serialVersionUID = 3372412184339653914L; - - // constructors ----------------------------------------------------------- - - /** - * Creates a new <code>ConflictResolverNotFoundException</code> with the specified message. - * - * @param message the message - */ - public ConflictResolverNotFoundException( String message ) - { - super( message ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java deleted file mode 100644 index 76f1929d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.codehaus.plexus.component.annotations.Component; - -/** - * The default conflict resolver that delegates to the nearest strategy. - * - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a> - * @see NearestConflictResolver - * @deprecated As of 3.0, use a specific implementation instead, e.g. {@link NearestConflictResolver} - */ -@Deprecated -@Component( role = ConflictResolver.class ) -public class DefaultConflictResolver - extends NearestConflictResolver -{ -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java deleted file mode 100644 index 66716d1e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.codehaus.plexus.PlexusConstants; -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.context.Context; -import org.codehaus.plexus.context.ContextException; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; - -/** - * A conflict resolver factory that obtains instances from a plexus container. - * - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @todo you don't need the container in here with the active maps (jvz). - * @since 3.0 - */ -@Component( role = ConflictResolverFactory.class ) -public class DefaultConflictResolverFactory - implements ConflictResolverFactory, Contextualizable -{ - // fields ----------------------------------------------------------------- - - /** - * The plexus container used to obtain instances from. - */ - @Requirement - private PlexusContainer container; - - // ConflictResolverFactory methods ---------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolverFactory#getConflictResolver(java.lang.String) - */ - - public ConflictResolver getConflictResolver( String type ) - throws ConflictResolverNotFoundException - { - try - { - return (ConflictResolver) container.lookup( ConflictResolver.ROLE, type ); - } - catch ( ComponentLookupException exception ) - { - throw new ConflictResolverNotFoundException( "Cannot find conflict resolver of type: " + type ); - } - } - - // Contextualizable methods ----------------------------------------------- - - /* - * @see org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable#contextualize(org.codehaus.plexus.context.Context) - */ - - public void contextualize( Context context ) - throws ContextException - { - container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java deleted file mode 100644 index 726e9a6d..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.resolver.ResolutionNode; -import org.codehaus.plexus.component.annotations.Component; - -/** - * Resolves conflicting artifacts by always selecting the <em>farthest</em> declaration. Farthest is defined as the - * declaration that has the most transitive steps away from the project being built. - * - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @since 3.0 - */ -@Component( role = ConflictResolver.class, hint = "farthest" ) -public class FarthestConflictResolver - implements ConflictResolver -{ - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) - { - return node1.getDepth() >= node2.getDepth() ? node1 : node2; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java deleted file mode 100644 index 338baed6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.resolver.ResolutionNode; -import org.codehaus.plexus.component.annotations.Component; - -/** - * Resolves conflicting artifacts by always selecting the <em>nearest</em> declaration. Nearest is defined as the - * declaration that has the least transitive steps away from the project being built. - * - * @author <a href="mailto:jason@maven.org">Jason van Zyl</a> - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @since 3.0 - */ -@Component( role = ConflictResolver.class, hint = "nearest" ) -public class NearestConflictResolver - implements ConflictResolver -{ - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) - { - return node1.getDepth() <= node2.getDepth() ? node1 : node2; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java deleted file mode 100644 index 1879a813..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.resolver.ResolutionNode; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.codehaus.plexus.component.annotations.Component; - -/** - * Resolves conflicting artifacts by always selecting the <em>newest</em> declaration. Newest is defined as the - * declaration whose version is greater according to <code>ArtifactVersion.compareTo</code>. - * - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @see ArtifactVersion#compareTo - * @since 3.0 - */ -@Component( role = ConflictResolver.class, hint = "newest" ) -public class NewestConflictResolver - implements ConflictResolver -{ - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) - { - try - { - ArtifactVersion version1 = node1.getArtifact().getSelectedVersion(); - ArtifactVersion version2 = node2.getArtifact().getSelectedVersion(); - - return version1.compareTo( version2 ) > 0 ? node1 : node2; - } - catch ( OverConstrainedVersionException exception ) - { - // TODO: log message or throw exception? - - return null; - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java deleted file mode 100644 index 5c5c12d6..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.conflict; - -/* - * 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.resolver.ResolutionNode; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.codehaus.plexus.component.annotations.Component; - -/** - * Resolves conflicting artifacts by always selecting the <em>oldest</em> declaration. Oldest is defined as the - * declaration whose version is less according to <code>ArtifactVersion.compareTo</code>. - * - * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> - * @see ArtifactVersion#compareTo - * @since 3.0 - */ -@Component( role = ConflictResolver.class, hint = "oldest" ) -public class OldestConflictResolver - implements ConflictResolver -{ - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) - { - try - { - ArtifactVersion version1 = node1.getArtifact().getSelectedVersion(); - ArtifactVersion version2 = node2.getArtifact().getSelectedVersion(); - - return version1.compareTo( version2 ) <= 0 ? node1 : node2; - } - catch ( OverConstrainedVersionException exception ) - { - // TODO: log message or throw exception? - - return null; - } - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java deleted file mode 100644 index 3a5c7c6a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.repository.DefaultRepositoryRequest; -import org.apache.maven.artifact.repository.RepositoryRequest; -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.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.repository.legacy.WagonManager; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.AbstractLogEnabled; - -/** - * Describes a version transformation during artifact resolution. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @todo try and refactor to remove abstract methods - not particular happy about current design - */ -public abstract class AbstractVersionTransformation - extends AbstractLogEnabled - implements ArtifactTransformation -{ - @Requirement - protected RepositoryMetadataManager repositoryMetadataManager; - - @Requirement - protected WagonManager wagonManager; - - public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - RepositoryRequest request = new DefaultRepositoryRequest(); - request.setLocalRepository( localRepository ); - request.setRemoteRepositories( remoteRepositories ); - transformForResolve( artifact, request ); - } - - protected String resolveVersion( Artifact artifact, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - throws RepositoryMetadataResolutionException - { - RepositoryRequest request = new DefaultRepositoryRequest(); - request.setLocalRepository( localRepository ); - request.setRemoteRepositories( remoteRepositories ); - return resolveVersion( artifact, request ); - } - - protected String resolveVersion( Artifact artifact, RepositoryRequest request ) - throws RepositoryMetadataResolutionException - { - RepositoryMetadata metadata; - // Don't use snapshot metadata for LATEST (which isSnapshot returns true for) - if ( !artifact.isSnapshot() || Artifact.LATEST_VERSION.equals( artifact.getBaseVersion() ) ) - { - metadata = new ArtifactRepositoryMetadata( artifact ); - } - else - { - metadata = new SnapshotArtifactRepositoryMetadata( artifact ); - } - - repositoryMetadataManager.resolve( metadata, request ); - - artifact.addMetadata( metadata ); - - Metadata repoMetadata = metadata.getMetadata(); - String version = null; - if ( repoMetadata != null && repoMetadata.getVersioning() != null ) - { - version = constructVersion( repoMetadata.getVersioning(), artifact.getBaseVersion() ); - } - - if ( version == null ) - { - // use the local copy, or if it doesn't exist - go to the remote repo for it - version = artifact.getBaseVersion(); - } - - // TODO: also do this logging for other metadata? - // TODO: figure out way to avoid duplicated message - if ( getLogger().isDebugEnabled() ) - { - if ( !version.equals( artifact.getBaseVersion() ) ) - { - String message = artifact.getArtifactId() + ": resolved to version " + version; - if ( artifact.getRepository() != null ) - { - message += " from repository " + artifact.getRepository().getId(); - } - else - { - message += " from local repository"; - } - getLogger().debug( message ); - } - else - { - // Locally installed file is newer, don't use the resolved version - getLogger().debug( artifact.getArtifactId() + ": using locally installed snapshot" ); - } - } - return version; - } - - protected abstract String constructVersion( Versioning versioning, String baseVersion ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java deleted file mode 100644 index 42604d75..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.installer.ArtifactInstallationException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - * @author <a href="mailto:jason@maven.org">Jason van Zyl </a> - */ -public interface ArtifactTransformation -{ - String ROLE = ArtifactTransformation.class.getName(); - - /** - * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param request the repositories to check - */ - void transformForResolve( Artifact artifact, RepositoryRequest request ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepositories the repositories to check - * @param localRepository the local repository - */ - void transformForResolve( Artifact artifact, - List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in a artifact and return the transformed artifact for locating in the local repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param localRepository the local repository it will be stored in - */ - void transformForInstall( Artifact artifact, - ArtifactRepository localRepository ) - throws ArtifactInstallationException; - - /** - * Take in a artifact and return the transformed artifact for distributing to remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepository the repository to deploy to - * @param localRepository the local repository - */ - void transformForDeployment( Artifact artifact, - ArtifactRepository remoteRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException; - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java deleted file mode 100644 index f0ac9c89..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.installer.ArtifactInstallationException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** Manages multiple ArtifactTransformation instances and applies them in succession. */ -public interface ArtifactTransformationManager -{ - String ROLE = ArtifactTransformationManager.class.getName(); - - /** - * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param request the repositories to check - */ - void transformForResolve( Artifact artifact, RepositoryRequest request ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepositories the repositories to check - * @param localRepository the local repository - */ - void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in a artifact and return the transformed artifact for locating in the local repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param localRepository the local repository it will be stored in - */ - void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) - throws ArtifactInstallationException; - - /** - * Take in a artifact and return the transformed artifact for distributing to a remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepository the repository to deploy to - * @param localRepository the local repository the metadata is stored in - */ - void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException; - - List getArtifactTransformations(); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java deleted file mode 100644 index e9b1afbc..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.installer.ArtifactInstallationException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - * @author Jason van Zyl - */ -@Component( role = ArtifactTransformationManager.class ) -public class DefaultArtifactTransformationManager - implements ArtifactTransformationManager -{ - @Requirement( role = ArtifactTransformation.class, hints = { "release", "latest", "snapshot" } ) - private List<ArtifactTransformation> artifactTransformations; - - public void transformForResolve( Artifact artifact, RepositoryRequest request ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - for ( ArtifactTransformation transform : artifactTransformations ) - { - transform.transformForResolve( artifact, request ); - } - } - - public void transformForResolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, - ArtifactRepository localRepository ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - for ( ArtifactTransformation transform : artifactTransformations ) - { - transform.transformForResolve( artifact, remoteRepositories, localRepository ); - } - } - - public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) - throws ArtifactInstallationException - { - for ( ArtifactTransformation transform : artifactTransformations ) - { - transform.transformForInstall( artifact, localRepository ); - } - } - - public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException - { - for ( ArtifactTransformation transform : artifactTransformations ) - { - transform.transformForDeployment( artifact, remoteRepository, localRepository ); - } - } - - public List getArtifactTransformations() - { - return artifactTransformations; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java deleted file mode 100644 index 7b0e8513..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.codehaus.plexus.component.annotations.Component; - -@Component( role = ArtifactTransformation.class, hint = "latest" ) -public class LatestArtifactTransformation - extends AbstractVersionTransformation -{ - - public void transformForResolve( Artifact artifact, RepositoryRequest request ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) ) - { - try - { - String version = resolveVersion( artifact, request ); - if ( Artifact.LATEST_VERSION.equals( version ) ) - { - throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact ); - } - - artifact.setBaseVersion( version ); - artifact.updateVersion( version, request.getLocalRepository() ); - } - catch ( RepositoryMetadataResolutionException e ) - { - throw new ArtifactResolutionException( e.getMessage(), artifact, e ); - } - } - } - - public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) - { - // metadata is added via addPluginArtifactMetadata - } - - public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, - ArtifactRepository localRepository ) - { - // metadata is added via addPluginArtifactMetadata - } - - protected String constructVersion( Versioning versioning, String baseVersion ) - { - return versioning.getLatest(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java deleted file mode 100644 index 3714924c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.codehaus.plexus.component.annotations.Component; - -/** - * Change the version <code>RELEASE</code> to the appropriate release version from the remote repository. - * - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - */ -@Component( role = ArtifactTransformation.class, hint = "release" ) -public class ReleaseArtifactTransformation - extends AbstractVersionTransformation -{ - - public void transformForResolve( Artifact artifact, RepositoryRequest request ) - throws ArtifactResolutionException, ArtifactNotFoundException - { - if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) ) - { - try - { - String version = resolveVersion( artifact, request ); - - if ( Artifact.RELEASE_VERSION.equals( version ) ) - { - throw new ArtifactNotFoundException( "Unable to determine the release version", artifact ); - } - - artifact.setBaseVersion( version ); - artifact.updateVersion( version, request.getLocalRepository() ); - } - catch ( RepositoryMetadataResolutionException e ) - { - throw new ArtifactResolutionException( e.getMessage(), artifact, e ); - } - } - } - - public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) - { - ArtifactMetadata metadata = createMetadata( artifact ); - - artifact.addMetadata( metadata ); - } - - public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, - ArtifactRepository localRepository ) - { - ArtifactMetadata metadata = createMetadata( artifact ); - - artifact.addMetadata( metadata ); - } - - private ArtifactMetadata createMetadata( Artifact artifact ) - { - Versioning versioning = new Versioning(); - versioning.updateTimestamp(); - versioning.addVersion( artifact.getVersion() ); - - if ( artifact.isRelease() ) - { - versioning.setRelease( artifact.getVersion() ); - } - - return new ArtifactRepositoryMetadata( artifact, versioning ); - } - - protected String constructVersion( Versioning versioning, String baseVersion ) - { - return versioning.getRelease(); - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java deleted file mode 100644 index 94f0ec0b..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java +++ /dev/null @@ -1,171 +0,0 @@ -package org.apache.maven.repository.legacy.resolver.transform; - -/* - * 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.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.Metadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.util.StringUtils; - -/** - * @author <a href="mailto:brett@apache.org">Brett Porter</a> - * @author <a href="mailto:mmaczka@interia.pl">Michal Maczka</a> - */ -@Component( role = ArtifactTransformation.class, hint = "snapshot" ) -public class SnapshotTransformation - extends AbstractVersionTransformation -{ - private String deploymentTimestamp; - - private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" ); - - private static final String UTC_TIMESTAMP_PATTERN = "yyyyMMdd.HHmmss"; - - public void transformForResolve( Artifact artifact, RepositoryRequest request ) - throws ArtifactResolutionException - { - // Only select snapshots that are unresolved (eg 1.0-SNAPSHOT, not 1.0-20050607.123456) - if ( artifact.isSnapshot() && artifact.getBaseVersion().equals( artifact.getVersion() ) ) - { - try - { - String version = resolveVersion( artifact, request ); - artifact.updateVersion( version, request.getLocalRepository() ); - } - catch ( RepositoryMetadataResolutionException e ) - { - throw new ArtifactResolutionException( e.getMessage(), artifact, e ); - } - } - } - - public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) - { - if ( artifact.isSnapshot() ) - { - Snapshot snapshot = new Snapshot(); - snapshot.setLocalCopy( true ); - RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot ); - - artifact.addMetadata( metadata ); - } - } - - public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, - ArtifactRepository localRepository ) - throws ArtifactDeploymentException - { - if ( artifact.isSnapshot() ) - { - Snapshot snapshot = new Snapshot(); - - snapshot.setTimestamp( getDeploymentTimestamp() ); - - // we update the build number anyway so that it doesn't get lost. It requires the timestamp to take effect - try - { - int buildNumber = resolveLatestSnapshotBuildNumber( artifact, localRepository, remoteRepository ); - - snapshot.setBuildNumber( buildNumber + 1 ); - } - catch ( RepositoryMetadataResolutionException e ) - { - throw new ArtifactDeploymentException( "Error retrieving previous build number for artifact '" - + artifact.getDependencyConflictId() + "': " + e.getMessage(), e ); - } - - RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact, snapshot ); - - artifact.setResolvedVersion( - constructVersion( metadata.getMetadata().getVersioning(), artifact.getBaseVersion() ) ); - - artifact.addMetadata( metadata ); - } - } - - public String getDeploymentTimestamp() - { - if ( deploymentTimestamp == null ) - { - deploymentTimestamp = getUtcDateFormatter().format( new Date() ); - } - return deploymentTimestamp; - } - - protected String constructVersion( Versioning versioning, String baseVersion ) - { - String version = null; - Snapshot snapshot = versioning.getSnapshot(); - if ( snapshot != null ) - { - if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 ) - { - String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber(); - version = StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion ); - } - else - { - version = baseVersion; - } - } - return version; - } - - private int resolveLatestSnapshotBuildNumber( Artifact artifact, ArtifactRepository localRepository, - ArtifactRepository remoteRepository ) - throws RepositoryMetadataResolutionException - { - RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact ); - - getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() ); - repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository ); - - int buildNumber = 0; - Metadata repoMetadata = metadata.getMetadata(); - if ( ( repoMetadata != null ) - && ( repoMetadata.getVersioning() != null && repoMetadata.getVersioning().getSnapshot() != null ) ) - { - buildNumber = repoMetadata.getVersioning().getSnapshot().getBuildNumber(); - } - return buildNumber; - } - - public static DateFormat getUtcDateFormatter() - { - DateFormat utcDateFormatter = new SimpleDateFormat( UTC_TIMESTAMP_PATTERN ); - utcDateFormatter.setTimeZone( UTC_TIME_ZONE ); - return utcDateFormatter; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java deleted file mode 100644 index 2666eafb..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java +++ /dev/null @@ -1,353 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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 org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * Artifact Metadata that is resolved independent of Artifact itself. - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - */ -public class ArtifactMetadata -{ - /** - * standard glorified artifact coordinates - */ - protected String groupId; - protected String artifactId; - protected String version; - protected String type; - protected ArtifactScopeEnum artifactScope; - protected String classifier; - - /** - * explanation: why this MD was chosen over it's siblings - * in the resulting structure (classpath for now) - */ - protected String why; - - /** dependencies of the artifact behind this metadata */ - protected Collection<ArtifactMetadata> dependencies; - - /** metadata URI */ - protected String uri; - - /** is metadata found anywhere */ - protected boolean resolved = false; - - /** does the actual artifact for this metadata exists */ - protected boolean artifactExists = false; - /** artifact URI */ - protected String artifactUri; - - /** error message */ - private String error; - - //------------------------------------------------------------------ - /** - * - */ - public ArtifactMetadata( String name ) - { - if ( name == null ) - { - return; - } - int ind1 = name.indexOf( ':' ); - int ind2 = name.lastIndexOf( ':' ); - - if ( ind1 == -1 || ind2 == -1 ) - { - return; - } - - this.groupId = name.substring( 0, ind1 ); - if ( ind1 == ind2 ) - { - this.artifactId = name.substring( ind1 + 1 ); - } - else - { - this.artifactId = name.substring( ind1 + 1, ind2 ); - this.version = name.substring( ind2 + 1 ); - } - } - - // ------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version ) - { - this( groupId, name, version, null ); - } - //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version, String type ) - { - this( groupId, name, version, type, null ); - } - - //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope ) - { - this( groupId, name, version, type, artifactScope, null ); - } - - //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope, - String classifier ) - { - this( groupId, name, version, type, artifactScope, classifier, null ); - } - //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope, - String classifier, String artifactUri ) - { - this( groupId, name, version, type, artifactScope, classifier, artifactUri, null, true, null ); - } - //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope, - String classifier, String artifactUri, String why, boolean resolved, String error ) - { - this.groupId = groupId; - this.artifactId = name; - this.version = version; - this.type = type; - this.artifactScope = artifactScope; - this.classifier = classifier; - this.artifactUri = artifactUri; - this.why = why; - this.resolved = resolved; - this.error = error; - } - //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, String name, String version, String type, String scopeString, - String classifier, String artifactUri, String why, boolean resolved, String error ) - { - this( groupId, name, version, type, - scopeString == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scopeString ), - classifier, artifactUri, why, resolved, error ); - } - - //------------------------------------------------------------------ - public ArtifactMetadata( Artifact af ) - { - /* - if ( af != null ) - { - init( af ); - } - */ - } - //------------------------------------------------------------------ -// public void init( ArtifactMetadata af ) -// { -// setGroupId( af.getGroupId() ); -// setArtifactId( af.getArtifactId() ); -// setVersion( af.getVersion() ); -// setType( af.getType() ); -// setScope( af.getScope() ); -// setClassifier( af.getClassifier() ); -// //setUri( af.getDownloadUrl() ); -// -// this.resolved = af.isResolved(); -// } - - //------------------------------------------------------------------ - @Override - public String toString() - { - return groupId + ":" + artifactId + ":" + version; - } - - //------------------------------------------------------------------ - public String toDomainString() - { - return groupId + ":" + artifactId; - } - - //------------------------------------------------------------------ - public String getGroupId() - { - return groupId; - } - - public void setGroupId( String groupId ) - { - this.groupId = groupId; - } - - public String getArtifactId() - { - return artifactId; - } - - public void setArtifactId( String name ) - { - this.artifactId = name; - } - - public String getVersion() - { - return version; - } - - public void setVersion( String version ) - { - this.version = version; - } - - public String getType() - { - return type; - } - - public String getCheckedType() - { - return type == null ? "jar" : type; - } - - public void setType( String type ) - { - this.type = type; - } - - public ArtifactScopeEnum getArtifactScope() - { - return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope; - } - - public void setArtifactScope( ArtifactScopeEnum artifactScope ) - { - this.artifactScope = artifactScope; - } - - public void setScope( String scope ) - { - this.artifactScope = scope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scope ); - } - - public String getClassifier() - { - return classifier; - } - - public void setClassifier( String classifier ) - { - this.classifier = classifier; - } - - public boolean isResolved() - { - return resolved; - } - - public void setResolved( boolean resolved ) - { - this.resolved = resolved; - } - - public String getUri() - { - return uri; - } - - public void setUri( String uri ) - { - this.uri = uri; - } - - public String getScope() - { - return getArtifactScope().getScope(); - } - - public ArtifactScopeEnum getScopeAsEnum() - { - return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope; - } - - public boolean isArtifactExists() - { - return artifactExists; - } - - public void setArtifactExists( boolean artifactExists ) - { - this.artifactExists = artifactExists; - } - - - public Collection<ArtifactMetadata> getDependencies() - { - return dependencies; - } - - public void setDependencies( Collection<ArtifactMetadata> dependencies ) - { - this.dependencies = dependencies; - } - - public String getArtifactUri() - { - return artifactUri; - } - - public void setArtifactUri( String artifactUri ) - { - this.artifactUri = artifactUri; - } - - - public String getWhy() - { - return why; - } - - public void setWhy( String why ) - { - this.why = why; - } - - //------------------------------------------------------------------- - public String getError() - { - return error; - } - - public void setError( String error ) - { - this.error = error; - } - - public boolean isError() - { - return error == null; - } - - //------------------------------------------------------------------ - public String getDependencyConflictId() - { - return groupId + ":" + artifactId; - } - //------------------------------------------------------------------ - //------------------------------------------------------------------ -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java deleted file mode 100644 index b0cb5b2f..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java +++ /dev/null @@ -1,144 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.Iterator; -import java.util.List; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * classpath container that is aware of the classpath scope - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ -public class ClasspathContainer -implements Iterable<ArtifactMetadata> -{ - private List<ArtifactMetadata> classpath; - - private ArtifactScopeEnum scope; - - // ------------------------------------------------------------------------------------------- - public ClasspathContainer( ArtifactScopeEnum scope ) - { - this.scope = ArtifactScopeEnum.checkScope( scope ); - } - - // ------------------------------------------------------------------------------------------- - public ClasspathContainer( List<ArtifactMetadata> classpath, ArtifactScopeEnum scope ) - { - this( scope ); - this.classpath = classpath; - } - - // ------------------------------------------------------------------------------------------- - public Iterator<ArtifactMetadata> iterator() - { - return classpath == null ? null : classpath.iterator(); - } - - // ------------------------------------------------------------------------------------------- - public ClasspathContainer add( ArtifactMetadata md ) - { - if ( classpath == null ) - { - classpath = new ArrayList<ArtifactMetadata>( 16 ); - } - - classpath.add( md ); - - return this; - } - - // ------------------------------------------------------------------------------------------- - public List<ArtifactMetadata> getClasspath() - { - return classpath; - } - - // ------------------------------------------------------------------------------------------- - public MetadataTreeNode getClasspathAsTree() - throws MetadataResolutionException - { - if ( classpath == null || classpath.size() < 1 ) - { - return null; - } - - MetadataTreeNode tree = null; - MetadataTreeNode parent = null; - - for ( ArtifactMetadata md : classpath ) - { - MetadataTreeNode node = new MetadataTreeNode( md, parent, md.isResolved(), md.getArtifactScope() ); - if ( tree == null ) - { - tree = node; - } - - if ( parent != null ) - { - parent.setNChildren( 1 ); - parent.addChild( 0, node ); - } - - parent = node; - - } - return tree; - } - - public void setClasspath( List<ArtifactMetadata> classpath ) - { - this.classpath = classpath; - } - - public ArtifactScopeEnum getScope() - { - return scope; - } - - public void setScope( ArtifactScopeEnum scope ) - { - this.scope = scope; - } - - // ------------------------------------------------------------------------------------------- - @Override - public String toString() - { - StringBuilder sb = new StringBuilder( 256 ); - sb.append( "[scope=" ).append( scope.getScope() ); - if ( classpath != null ) - { - for ( ArtifactMetadata md : classpath ) - { - sb.append( ": " ).append( md.toString() ).append( '{' ).append( md.getArtifactUri() ).append( '}' ); - } - } - sb.append( ']' ); - return sb.toString(); - } - // ------------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java deleted file mode 100644 index eece4133..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.ArtifactScopeEnum; - -/** - * Helper class to conver an Md Graph into some form of a classpath - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ -public interface ClasspathTransformation -{ - String ROLE = ClasspathTransformation.class.getName(); - - /** - * Transform Graph into a Collection of metadata objects that - * could serve as a classpath for a particular scope - * - * @param dirtyGraph - dependency graph - * @param scope - which classpath to extract - * @param resolve - whether to resolve artifacts. - * @return Collection of metadata objects in the linked subgraph of the graph which - * contains the graph.getEntry() vertice - */ - ClasspathContainer transform( MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve ) - throws MetadataGraphTransformationException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java deleted file mode 100644 index 03984fbd..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java +++ /dev/null @@ -1,183 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.Comparator; -import java.util.List; - -import org.apache.maven.artifact.ArtifactScopeEnum; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - * default implementation of the metadata classpath transformer - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ -@Component( role = ClasspathTransformation.class ) -public class DefaultClasspathTransformation - implements ClasspathTransformation -{ - @Requirement - GraphConflictResolver conflictResolver; - - //---------------------------------------------------------------------------------------------------- - public ClasspathContainer transform( MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve ) - throws MetadataGraphTransformationException - { - try - { - if ( dirtyGraph == null || dirtyGraph.isEmpty() ) - { - return null; - } - - MetadataGraph cleanGraph = conflictResolver.resolveConflicts( dirtyGraph, scope ); - - if ( cleanGraph == null || cleanGraph.isEmpty() ) - { - return null; - } - - ClasspathContainer cpc = new ClasspathContainer( scope ); - if ( cleanGraph.isEmptyEdges() ) - { - // single entry in the classpath, populated from itself - ArtifactMetadata amd = cleanGraph.getEntry().getMd(); - cpc.add( amd ); - } - else - { - ClasspathGraphVisitor v = new ClasspathGraphVisitor( cleanGraph, cpc ); - MetadataGraphVertex entry = cleanGraph.getEntry(); - // entry point - v.visit( entry ); - } - - return cpc; - } - catch ( GraphConflictResolutionException e ) - { - throw new MetadataGraphTransformationException( e ); - } - } - - //=================================================================================================== - /** - * Helper class to traverse graph. Required to make the containing method thread-safe - * and yet use class level data to lessen stack usage in recursion - */ - private class ClasspathGraphVisitor - { - MetadataGraph graph; - - ClasspathContainer cpc; - - List<MetadataGraphVertex> visited; - - // ----------------------------------------------------------------------- - protected ClasspathGraphVisitor( MetadataGraph cleanGraph, ClasspathContainer cpc ) - { - this.cpc = cpc; - this.graph = cleanGraph; - - visited = new ArrayList<MetadataGraphVertex>( cleanGraph.getVertices().size() ); - } - - // ----------------------------------------------------------------------- - protected void visit( MetadataGraphVertex node ) // , String version, String artifactUri ) - { - ArtifactMetadata md = node.getMd(); - if ( visited.contains( node ) ) - { - return; - } - - cpc.add( md ); -// -// TreeSet<MetadataGraphEdge> deps = new TreeSet<MetadataGraphEdge>( -// new Comparator<MetadataGraphEdge>() -// { -// public int compare( MetadataGraphEdge e1 -// , MetadataGraphEdge e2 -// ) -// { -// if( e1.getDepth() == e2.getDepth() ) -// { -// if( e2.getPomOrder() == e1.getPomOrder() ) -// return e1.getTarget().toString().compareTo(e2.getTarget().toString() ); -// -// return e2.getPomOrder() - e1.getPomOrder(); -// } -// -// return e2.getDepth() - e1.getDepth(); -// } -// } -// ); - - List<MetadataGraphEdge> exits = graph.getExcidentEdges( node ); - - if ( exits != null && exits.size() > 0 ) - { - MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[exits.size()] ); - Arrays.sort( sortedExits - , - new Comparator<MetadataGraphEdge>() - { - public int compare( MetadataGraphEdge e1 - , MetadataGraphEdge e2 - ) - { - if ( e1.getDepth() == e2.getDepth() ) - { - if ( e2.getPomOrder() == e1.getPomOrder() ) - { - return e1.getTarget().toString().compareTo( e2.getTarget().toString() ); - } - return e2.getPomOrder() - e1.getPomOrder(); - } - - return e2.getDepth() - e1.getDepth(); - } - } - ); - - for ( MetadataGraphEdge e : sortedExits ) - { - MetadataGraphVertex targetNode = e.getTarget(); - targetNode.getMd().setArtifactScope( e.getScope() ); - targetNode.getMd().setWhy( e.getSource().getMd().toString() ); - visit( targetNode ); - } - } - - } - //----------------------------------------------------------------------- - //----------------------------------------------------------------------- - } - //---------------------------------------------------------------------------------------------------- - //---------------------------------------------------------------------------------------------------- -} - - - diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java deleted file mode 100644 index bb764227..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Configuration; - -/** - * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a> - * - */ -@Component( role = GraphConflictResolutionPolicy.class ) -public class DefaultGraphConflictResolutionPolicy - implements GraphConflictResolutionPolicy -{ - /** - * artifact, closer to the entry point, is selected - */ - @Configuration( name = "closer-first", value = "true" ) - private boolean closerFirst = true; - - /** - * newer artifact is selected - */ - @Configuration( name = "newer-first", value = "true" ) - private boolean newerFirst = true; - - public MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 ) - { - int depth1 = e1.getDepth(); - int depth2 = e2.getDepth(); - - if ( depth1 == depth2 ) - { - ArtifactVersion v1 = new DefaultArtifactVersion( e1.getVersion() ); - ArtifactVersion v2 = new DefaultArtifactVersion( e2.getVersion() ); - - if ( newerFirst ) - { - return v1.compareTo( v2 ) > 0 ? e1 : e2; - } - - return v1.compareTo( v2 ) > 0 ? e2 : e1; - } - - if ( closerFirst ) - { - return depth1 < depth2 ? e1 : e2; - } - - return depth1 < depth2 ? e2 : e1; - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java deleted file mode 100644 index 77060299..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java +++ /dev/null @@ -1,249 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeSet; - -import org.apache.maven.artifact.ArtifactScopeEnum; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -/** - * Default conflict resolver.Implements closer newer first policy by default, but could be configured via plexus - * - * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a> - */ -@Component( role = GraphConflictResolver.class ) -public class DefaultGraphConflictResolver - implements GraphConflictResolver -{ - /** - * artifact, closer to the entry point, is selected - */ - @Requirement( role = GraphConflictResolutionPolicy.class ) - protected GraphConflictResolutionPolicy policy; - - // ------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------- - public MetadataGraph resolveConflicts( MetadataGraph graph, ArtifactScopeEnum scope ) - throws GraphConflictResolutionException - { - if ( policy == null ) - { - throw new GraphConflictResolutionException( "no GraphConflictResolutionPolicy injected" ); - } - - if ( graph == null ) - { - return null; - } - - final MetadataGraphVertex entry = graph.getEntry(); - if ( entry == null ) - { - return null; - } - - if ( graph.isEmpty() ) - { - throw new GraphConflictResolutionException( "graph with an entry, but not vertices do not exist" ); - } - - if ( graph.isEmptyEdges() ) - { - return null; // no edges - nothing to worry about - } - - final TreeSet<MetadataGraphVertex> vertices = graph.getVertices(); - - try - { - // edge case - single vertex graph - if ( vertices.size() == 1 ) - { - return new MetadataGraph( entry ); - } - - final ArtifactScopeEnum requestedScope = ArtifactScopeEnum.checkScope( scope ); - - MetadataGraph res = new MetadataGraph( vertices.size() ); - res.setVersionedVertices( false ); - res.setScopedVertices( false ); - - MetadataGraphVertex resEntry = res.addVertex( entry.getMd() ); - res.setEntry( resEntry ); - - res.setScope( requestedScope ); - - for ( MetadataGraphVertex v : vertices ) - { - final List<MetadataGraphEdge> ins = graph.getIncidentEdges( v ); - final MetadataGraphEdge edge = cleanEdges( v, ins, requestedScope ); - - if ( edge == null ) - { // no edges - don't need this vertex any more - if ( entry.equals( v ) ) - { // unless it's an entry point. - // currently processing the entry point - it should not have any entry incident edges - res.getEntry().getMd().setWhy( "This is a graph entry point. No links." ); - } - else - { - // System.out.println("--->"+v.getMd().toDomainString() - // +" has been terminated on this entry set\n-------------------\n" - // +ins - // +"\n-------------------\n" - // ); - } - } - else - { - // System.out.println("+++>"+v.getMd().toDomainString()+" still has "+edge.toString() ); - // fill in domain md with actual version data - ArtifactMetadata md = v.getMd(); - ArtifactMetadata newMd = - new ArtifactMetadata( md.getGroupId(), md.getArtifactId(), edge.getVersion(), md.getType(), - md.getScopeAsEnum(), md.getClassifier(), edge.getArtifactUri(), - edge.getSource() == null ? "" : edge.getSource().getMd().toString(), - edge.isResolved(), edge.getTarget() == null ? null - : edge.getTarget().getMd().getError() ); - MetadataGraphVertex newV = res.addVertex( newMd ); - MetadataGraphVertex sourceV = res.addVertex( edge.getSource().getMd() ); - - res.addEdge( sourceV, newV, edge ); - } - } - MetadataGraph linkedRes = findLinkedSubgraph( res ); - // System.err.println("Original graph("+graph.getVertices().size()+"):\n"+graph.toString()); - // System.err.println("Cleaned("+requestedScope+") graph("+res.getVertices().size()+"):\n"+res.toString()); - // System.err.println("Linked("+requestedScope+") - // subgraph("+linkedRes.getVertices().size()+"):\n"+linkedRes.toString()); - return linkedRes; - } - catch ( MetadataResolutionException e ) - { - throw new GraphConflictResolutionException( e ); - } - } - - // ------------------------------------------------------------------------------------- - private MetadataGraph findLinkedSubgraph( MetadataGraph g ) - { - if ( g.getVertices().size() == 1 ) - { - return g; - } - - List<MetadataGraphVertex> visited = new ArrayList<MetadataGraphVertex>( g.getVertices().size() ); - visit( g.getEntry(), visited, g ); - - List<MetadataGraphVertex> dropList = new ArrayList<MetadataGraphVertex>( g.getVertices().size() ); - - // collect drop list - for ( MetadataGraphVertex v : g.getVertices() ) - { - if ( !visited.contains( v ) ) - { - dropList.add( v ); - } - } - - if ( dropList.size() < 1 ) - { - return g; - } - - // now - drop vertices - TreeSet<MetadataGraphVertex> vertices = g.getVertices(); - for ( MetadataGraphVertex v : dropList ) - { - vertices.remove( v ); - } - - return g; - } - - // ------------------------------------------------------------------------------------- - private void visit( MetadataGraphVertex from, List<MetadataGraphVertex> visited, MetadataGraph graph ) - { - if ( visited.contains( from ) ) - { - return; - } - - visited.add( from ); - - List<MetadataGraphEdge> exitList = graph.getExcidentEdges( from ); - // String s = "|---> "+from.getMd().toString()+" - "+(exitList == null ? -1 : exitList.size()) + " exit links"; - if ( exitList != null && exitList.size() > 0 ) - { - for ( MetadataGraphEdge e : graph.getExcidentEdges( from ) ) - { - visit( e.getTarget(), visited, graph ); - } - } - } - - // ------------------------------------------------------------------------------------- - private MetadataGraphEdge cleanEdges( MetadataGraphVertex v, List<MetadataGraphEdge> edges, - ArtifactScopeEnum scope ) - { - if ( edges == null || edges.isEmpty() ) - { - return null; - } - - if ( edges.size() == 1 ) - { - MetadataGraphEdge e = edges.get( 0 ); - if ( scope.encloses( e.getScope() ) ) - { - return e; - } - - return null; - } - - MetadataGraphEdge res = null; - - for ( MetadataGraphEdge e : edges ) - { - if ( !scope.encloses( e.getScope() ) ) - { - continue; - } - - if ( res == null ) - { - res = e; - } - else - { - res = policy.apply( e, res ); - } - } - - return res; - } - // ------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java deleted file mode 100644 index 035904aa..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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 <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a> - * - */ -public class GraphConflictResolutionException - extends Exception -{ - private static final long serialVersionUID = 2677613140287940255L; - - public GraphConflictResolutionException() - { - } - - public GraphConflictResolutionException( String message ) - { - super( message ); - } - - public GraphConflictResolutionException( Throwable cause ) - { - super( cause ); - } - - public GraphConflictResolutionException( String message, Throwable cause ) - { - super( message, cause ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java deleted file mode 100644 index 979d3831..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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. - */ - -/** - * MetadataGraph edge selection policy. Complements - * GraphConflictResolver by being injected into it - * - * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a> - * - */ - -public interface GraphConflictResolutionPolicy -{ - String ROLE = GraphConflictResolutionPolicy.class.getName(); - - MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 ); -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java deleted file mode 100644 index ef70baa2..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.ArtifactScopeEnum; - -/** - * Resolves conflicts in the supplied dependency graph. - * Different implementations will implement different conflict resolution policies. - * - * @author <a href="mailto:oleg@codehaus.org">Oleg Gusakov</a> - */ -public interface GraphConflictResolver -{ - String ROLE = GraphConflictResolver.class.getName(); - - /** - * Cleanses the supplied graph by leaving only one directed versioned edge\ - * between any two nodes, if multiple exists. Uses scope relationships, defined - * in <code>ArtifactScopeEnum</code> - * - * @param graph the "dirty" graph to be simplified via conflict resolution - * @param scope scope for which the graph should be resolved - * - * @return resulting "clean" graph for the specified scope - * - * @since 3.0 - */ - MetadataGraph resolveConflicts( MetadataGraph graph, ArtifactScopeEnum scope ) - throws GraphConflictResolutionException; -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java deleted file mode 100644 index 55b02504..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java +++ /dev/null @@ -1,523 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * maven dependency metadata graph - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ -public class MetadataGraph -{ - public static final int DEFAULT_VERTICES = 32; - public static final int DEFAULT_EDGES = 64; - - // flags to indicate the granularity of vertices - private boolean versionedVertices = false; - private boolean scopedVertices = false; - /** - * the entry point we started building the graph from - */ - MetadataGraphVertex entry; - - // graph vertices - TreeSet<MetadataGraphVertex> vertices; - - /** - * incident and excident edges per node - */ - Map<MetadataGraphVertex, List<MetadataGraphEdge>> incidentEdges; - Map<MetadataGraphVertex, List<MetadataGraphEdge>> excidentEdges; - - /** - * null in dirty graph, actual - * scope for conflict-resolved graph - */ - ArtifactScopeEnum scope; - - //------------------------------------------------------------------------ - /** - * init graph - */ - public MetadataGraph( int nVertices ) - { - init( nVertices, 2 * nVertices ); - } - public MetadataGraph( int nVertices, int nEdges ) - { - init( nVertices, nEdges ); - } - //------------------------------------------------------------------------ - /** - * construct a single vertex - */ - public MetadataGraph( MetadataGraphVertex entry ) - throws MetadataResolutionException - { - checkVertex( entry ); - checkVertices( 1 ); - - entry.setCompareVersion( versionedVertices ); - entry.setCompareScope( scopedVertices ); - - vertices.add( entry ); - this.entry = entry; - } - //------------------------------------------------------------------------ - /** - * construct graph from a "dirty" tree - */ - public MetadataGraph( MetadataTreeNode tree ) - throws MetadataResolutionException - { - this( tree, false, false ); - } - //------------------------------------------------------------------------ - /** - * construct graph from a "dirty" tree - * - * @param tree "dirty" tree root - * @param versionedVertices true if graph nodes should be versioned (different versions -> different nodes) - * @param scopedVertices true if graph nodes should be versioned and scoped (different versions and/or scopes -> different nodes) - * - */ - public MetadataGraph( MetadataTreeNode tree, boolean versionedVertices, boolean scopedVertices ) - throws MetadataResolutionException - { - if ( tree == null ) - { - throw new MetadataResolutionException( "tree is null" ); - } - - setVersionedVertices( versionedVertices ); - setScopedVertices( scopedVertices ); - - this.versionedVertices = scopedVertices || versionedVertices; - this.scopedVertices = scopedVertices; - - int count = countNodes( tree ); - - init( count, count + ( count / 2 ) ); - - processTreeNodes( null, tree, 0, 0 ); - } - //------------------------------------------------------------------------ - private void processTreeNodes( MetadataGraphVertex parentVertex, MetadataTreeNode node, int depth, int pomOrder ) - throws MetadataResolutionException - { - if ( node == null ) - { - return; - } - - MetadataGraphVertex vertex = new MetadataGraphVertex( node.md, versionedVertices, scopedVertices ); - if ( !vertices.contains( vertex ) ) - { - vertices.add( vertex ); - } - - if ( parentVertex != null ) // then create the edge - { - ArtifactMetadata md = node.getMd(); - MetadataGraphEdge e = - new MetadataGraphEdge( md.version, md.resolved, md.artifactScope, md.artifactUri, depth, pomOrder ); - addEdge( parentVertex, vertex, e ); - } - else - { - entry = vertex; - } - - MetadataTreeNode[] kids = node.getChildren(); - if ( kids == null || kids.length < 1 ) - { - return; - } - - for ( int i = 0; i < kids.length; i++ ) - { - MetadataTreeNode n = kids[i]; - processTreeNodes( vertex, n, depth + 1, i ); - } - } - //------------------------------------------------------------------------ - public MetadataGraphVertex findVertex( ArtifactMetadata md ) - { - if ( md == null || vertices == null || vertices.size() < 1 ) - { - return null; - } - - MetadataGraphVertex v = new MetadataGraphVertex( md ); - v.setCompareVersion( versionedVertices ); - v.setCompareScope( scopedVertices ); - - for ( MetadataGraphVertex gv : vertices ) - { - if ( gv.equals( v ) ) - { - return gv; - } - } - - return null; - } - //------------------------------------------------------------------------ - public MetadataGraphVertex addVertex( ArtifactMetadata md ) - { - if ( md == null ) - { - return null; - } - - checkVertices(); - - MetadataGraphVertex v = findVertex( md ); - if ( v != null ) - { - return v; - } - - v = new MetadataGraphVertex( md ); - - v.setCompareVersion( versionedVertices ); - v.setCompareScope( scopedVertices ); - - vertices.add( v ); - return v; - } - //------------------------------------------------------------------------ - /** - * init graph - */ - private void init( int nVertices, int nEdges ) - { - int nV = nVertices; - if ( nVertices < 1 ) - { - nV = 1; - } - - checkVertices( nV ); - - int nE = nVertices; - if ( nEdges <= nV ) - { - nE = 2 * nE; - } - - checkEdges( nE ); - } - - private void checkVertices() - { - checkVertices( DEFAULT_VERTICES ); - } - - private void checkVertices( int nVertices ) - { - if ( vertices == null ) - { - vertices = new TreeSet<MetadataGraphVertex>(); - } - } - private void checkEdges() - { - int count = DEFAULT_EDGES; - - if ( vertices != null ) - { - count = vertices.size() + vertices.size() / 2; - } - - checkEdges( count ); - } - private void checkEdges( int nEdges ) - { - if ( incidentEdges == null ) - { - incidentEdges = new HashMap<MetadataGraphVertex, List<MetadataGraphEdge>>( nEdges ); - } - if ( excidentEdges == null ) - { - excidentEdges = new HashMap<MetadataGraphVertex, List<MetadataGraphEdge>>( nEdges ); - } - } - //------------------------------------------------------------------------ - private static void checkVertex( MetadataGraphVertex v ) - throws MetadataResolutionException - { - if ( v == null ) - { - throw new MetadataResolutionException( "null vertex" ); - } - if ( v.getMd() == null ) - { - throw new MetadataResolutionException( "vertex without metadata" ); - } - } - //------------------------------------------------------------------------ - private static void checkEdge( MetadataGraphEdge e ) - throws MetadataResolutionException - { - if ( e == null ) - { - throw new MetadataResolutionException( "badly formed edge" ); - } - } - //------------------------------------------------------------------------ - public List<MetadataGraphEdge> getEdgesBetween( MetadataGraphVertex vFrom, MetadataGraphVertex vTo ) - { - List<MetadataGraphEdge> edges = getIncidentEdges( vTo ); - if ( edges == null || edges.isEmpty() ) - { - return null; - } - - List<MetadataGraphEdge> res = new ArrayList<MetadataGraphEdge>( edges.size() ); - - for ( MetadataGraphEdge e : edges ) - { - if ( e.getSource().equals( vFrom ) ) - { - res.add( e ); - } - } - - return res; - } - //------------------------------------------------------------------------ - public MetadataGraph addEdge( MetadataGraphVertex vFrom, MetadataGraphVertex vTo, MetadataGraphEdge e ) - throws MetadataResolutionException - { - checkVertex( vFrom ); - checkVertex( vTo ); - - checkVertices(); - - checkEdge( e ); - checkEdges(); - - e.setSource( vFrom ); - e.setTarget( vTo ); - - vFrom.setCompareVersion( versionedVertices ); - vFrom.setCompareScope( scopedVertices ); - - List<MetadataGraphEdge> exList = excidentEdges.get( vFrom ); - if ( exList == null ) - { - exList = new ArrayList<MetadataGraphEdge>(); - excidentEdges.put( vFrom, exList ); - } - - if ( !exList.contains( e ) ) - { - exList.add( e ); - } - - List<MetadataGraphEdge> inList = incidentEdges.get( vTo ); - if ( inList == null ) - { - inList = new ArrayList<MetadataGraphEdge>(); - incidentEdges.put( vTo, inList ); - } - - if ( !inList.contains( e ) ) - { - inList.add( e ); - } - - return this; - } - //------------------------------------------------------------------------ - public MetadataGraph removeVertex( MetadataGraphVertex v ) - { - if ( vertices != null && v != null ) - { - vertices.remove( v ); - } - - if ( incidentEdges != null ) - { - incidentEdges.remove( v ); - } - - if ( excidentEdges != null ) - { - excidentEdges.remove( v ); - } - - return this; - - } - //------------------------------------------------------------------------ - private static int countNodes( MetadataTreeNode tree ) - { - if ( tree == null ) - { - return 0; - } - - int count = 1; - MetadataTreeNode[] kids = tree.getChildren(); - if ( kids == null || kids.length < 1 ) - { - return count; - } - for ( MetadataTreeNode n : kids ) - { - count += countNodes( n ); - } - - return count; - } - - //------------------------------------------------------------------------ - public MetadataGraphVertex getEntry() - { - return entry; - } - - public void setEntry( MetadataGraphVertex entry ) - { - this.entry = entry; - } - - public TreeSet<MetadataGraphVertex> getVertices() - { - return vertices; - } - - public List<MetadataGraphEdge> getIncidentEdges( MetadataGraphVertex vertex ) - { - checkEdges(); - return incidentEdges.get( vertex ); - } - - public List<MetadataGraphEdge> getExcidentEdges( MetadataGraphVertex vertex ) - { - checkEdges(); - return excidentEdges.get( vertex ); - } - - public boolean isVersionedVertices() - { - return versionedVertices; - } - - public void setVersionedVertices( boolean versionedVertices ) - { - this.versionedVertices = versionedVertices; - } - - public boolean isScopedVertices() - { - return scopedVertices; - } - - public void setScopedVertices( boolean scopedVertices ) - { - this.scopedVertices = scopedVertices; - - // scoped graph is versioned by definition - if ( scopedVertices ) - { - versionedVertices = true; - } - } - - public ArtifactScopeEnum getScope() - { - return scope; - } - - public void setScope( ArtifactScopeEnum scope ) - { - this.scope = scope; - } - - // ------------------------------------------------------------------------ - public boolean isEmpty() - { - return entry == null || vertices == null || vertices.isEmpty(); - } - - //------------------------------------------------------------------------ - public boolean isEmptyEdges() - { - return isEmpty() || incidentEdges == null || incidentEdges.isEmpty(); - } - //------------------------------------------------------------------------ - @Override - public String toString() - { - StringBuilder sb = new StringBuilder( 512 ); - if ( isEmpty() ) - { - return "empty"; - } - for ( MetadataGraphVertex v : vertices ) - { - sb.append( "Vertex: " ).append( v.getMd().toString() ).append( "\n" ); - List<MetadataGraphEdge> ins = getIncidentEdges( v ); - if ( ins != null ) - { - for ( MetadataGraphEdge e : ins ) - { - sb.append( " from : " ).append( e.toString() ).append( "\n" ); - } - } - else - { - sb.append( " no entries\n" ); - } - - List<MetadataGraphEdge> outs = getExcidentEdges( v ); - if ( outs != null ) - { - for ( MetadataGraphEdge e : outs ) - { - sb.append( " to : " ).append( e.toString() ).append( "\n" ); - } - } - else - { - sb.append( " no exit\n" ); - } - - sb.append( "-------------------------------------------------\n" ); - } - sb.append( "=============================================================\n" ); - return sb.toString(); - } - - //------------------------------------------------------------------------ - //------------------------------------------------------------------------ -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java deleted file mode 100644 index 5f16df06..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.ArtifactScopeEnum; - -/** - * metadata graph edge - combination of version, scope and depth define - * an edge in the graph - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ - -public class MetadataGraphEdge -{ - String version; - ArtifactScopeEnum scope; - int depth = -1; - int pomOrder = -1; - boolean resolved = true; - String artifactUri; - - /** - * capturing where this link came from - * and where it is linked to. - * - * In the first implementation only source used for explanatory function - */ - MetadataGraphVertex source; - MetadataGraphVertex target; - - //---------------------------------------------------------------------------- - public MetadataGraphEdge( String version, boolean resolved, ArtifactScopeEnum scope, String artifactUri, int depth, - int pomOrder ) - { - super(); - this.version = version; - this.scope = scope; - this.artifactUri = artifactUri; - this.depth = depth; - this.resolved = resolved; - this.pomOrder = pomOrder; - } - //---------------------------------------------------------------------------- - /** - * helper for equals - */ - private static boolean objectsEqual( Object o1, Object o2 ) - { - if ( o1 == null && o2 == null ) - { - return true; - } - if ( o1 == null || o2 == null ) - { - return false; // as they are not both null - } - return o1.equals( o2 ); - } - - //---------------------------------------------------------------------------- - /** - * used to eliminate exact duplicates in the edge list - */ - @Override - public boolean equals( Object o ) - { - if ( o instanceof MetadataGraphEdge ) - { - MetadataGraphEdge e = (MetadataGraphEdge) o; - - return objectsEqual( version, e.version ) - && ArtifactScopeEnum.checkScope( scope ).getScope().equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() ) - && depth == e.depth; - } - return false; - } - - //---------------------------------------------------------------------------- - public String getVersion() - { - return version; - } - - public void setVersion( String version ) - { - this.version = version; - } - - public ArtifactScopeEnum getScope() - { - return scope; - } - - public void setScope( ArtifactScopeEnum scope ) - { - this.scope = scope; - } - - public int getDepth() - { - return depth; - } - - public void setDepth( int depth ) - { - this.depth = depth; - } - - public boolean isResolved() - { - return resolved; - } - - public void setResolved( boolean resolved ) - { - this.resolved = resolved; - } - - public int getPomOrder() - { - return pomOrder; - } - - public void setPomOrder( int pomOrder ) - { - this.pomOrder = pomOrder; - } - - public String getArtifactUri() - { - return artifactUri; - } - - public void setArtifactUri( String artifactUri ) - { - this.artifactUri = artifactUri; - } - - public MetadataGraphVertex getSource() - { - return source; - } - - public void setSource( MetadataGraphVertex source ) - { - this.source = source; - } - - public MetadataGraphVertex getTarget() - { - return target; - } - - public void setTarget( MetadataGraphVertex target ) - { - this.target = target; - } - - @Override - public String toString() - { - return "[ " + "FROM:(" - + ( source == null ? "no source" : ( source.md == null ? "no source MD" : source.md.toString() ) ) + ") " - + "TO:(" + ( target == null ? "no target" : ( target.md == null ? "no target MD" : target.md.toString() ) ) - + ") " + "version=" + version + ", scope=" + ( scope == null ? "null" : scope.getScope() ) + ", depth=" - + depth + "]"; - } - //---------------------------------------------------------------------------- - //---------------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java deleted file mode 100644 index 16a34a8c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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 <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ -public class MetadataGraphTransformationException - extends Exception -{ - private static final long serialVersionUID = -4029897098314019152L; - - public MetadataGraphTransformationException() - { - } - - public MetadataGraphTransformationException( String message ) - { - super( message ); - } - - public MetadataGraphTransformationException( Throwable cause ) - { - super( cause ); - } - - public MetadataGraphTransformationException( String message, Throwable cause ) - { - super( message, cause ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java deleted file mode 100644 index bdccf6a5..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.ArtifactScopeEnum; - -/** - * metadata graph vertice - just a wrapper around artifact's metadata - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - */ -public class MetadataGraphVertex - implements Comparable<MetadataGraphVertex> -{ - ArtifactMetadata md; - - // indications to use these in comparrison - private boolean compareVersion = false; - private boolean compareScope = false; - - public MetadataGraphVertex( ArtifactMetadata md ) - { - super(); - this.md = md; - } - - public MetadataGraphVertex( ArtifactMetadata md, boolean compareVersion, boolean compareScope ) - { - this( md ); - this.compareVersion = compareVersion; - this.compareScope = compareScope; - } - - public ArtifactMetadata getMd() - { - return md; - } - - public void setMd( ArtifactMetadata md ) - { - this.md = md; - } - - // --------------------------------------------------------------------- - public boolean isCompareVersion() - { - return compareVersion; - } - - public void setCompareVersion( boolean compareVersion ) - { - this.compareVersion = compareVersion; - } - - public boolean isCompareScope() - { - return compareScope; - } - - public void setCompareScope( boolean compareScope ) - { - this.compareScope = compareScope; - } - - // --------------------------------------------------------------------- - @Override - public String toString() - { - return "[" + ( md == null ? "no metadata" : md.toString() ) + "]"; - } - - // --------------------------------------------------------------------- - private static int compareStrings( String s1, String s2 ) - { - if ( s1 == null && s2 == null ) - { - return 0; - } - - if ( s1 == null /* && s2 != null */ ) - { - return -1; - } - - if ( /* s1 != null && */ s2 == null ) - { - return 1; - } - - return s1.compareTo( s2 ); - } - - // --------------------------------------------------------------------- - public int compareTo( MetadataGraphVertex vertex ) - { - if ( vertex == null || vertex.getMd() == null ) - { - return 1; - } - - ArtifactMetadata vmd = vertex.getMd(); - - if ( vmd == null ) - { - if ( md == null ) - { - return 0; - } - else - { - return 1; - } - } - - int g = compareStrings( md.groupId, vmd.groupId ); - - if ( g == 0 ) - { - int a = compareStrings( md.artifactId, vmd.artifactId ); - if ( a == 0 ) - { - if ( compareVersion ) - { - int v = compareStrings( md.version, vmd.version ); - if ( v == 0 ) - { - if ( compareScope ) - { - String s1 = ArtifactScopeEnum.checkScope( md.artifactScope ).getScope(); - String s2 = ArtifactScopeEnum.checkScope( vmd.artifactScope ).getScope(); - return s1.compareTo( s2 ); - } - else - { - return 0; - } - } - else - { - return v; - } - } - else - { - return 0; - } - } - else - { - return a; - } - } - - return g; - } - - // --------------------------------------------------------------------- - @Override - public boolean equals( Object vo ) - { - if ( vo == null || !( vo instanceof MetadataGraphVertex ) ) - { - return false; - } - return compareTo( (MetadataGraphVertex) vo ) == 0; - } - - // --------------------------------------------------------------------- - - @Override - public int hashCode() - { - if ( md == null ) - { - return super.hashCode(); - } - StringBuilder hashString = new StringBuilder( 128 ); - hashString.append( md.groupId ).append( "|" ); - hashString.append( md.artifactId ).append( "|" ); - - if ( compareVersion ) - { - hashString.append( md.version ).append( "|" ); - } - - if ( compareScope ) - { - hashString.append( md.getArtifactScope() ).append( "|" ); - } - - return hashString.toString().hashCode(); - - // BASE64Encoder b64 = new BASE64Encoder(); - // return b64.encode( hashString.toString().getBytes() ).hashCode(); - } - - // --------------------------------------------------------------------- - // --------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java deleted file mode 100644 index 9a9130b2..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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 org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * - * @author Jason van Zyl - * - */ -public class MetadataResolution -{ - /** resolved MD */ - private ArtifactMetadata artifactMetadata; - - /** repositories, added by this POM */ - private Collection<ArtifactRepository> metadataRepositories; - //------------------------------------------------------------------- - public MetadataResolution( ArtifactMetadata artifactMetadata ) - { - this.artifactMetadata = artifactMetadata; - } - //------------------------------------------------------------------- - public MetadataResolution( ArtifactMetadata artifactMetadata, Collection<ArtifactRepository> metadataRepositories ) - { - this( artifactMetadata ); - this.metadataRepositories = metadataRepositories; - } - //------------------------------------------------------------------- - public Collection<ArtifactRepository> getMetadataRepositories() - { - return metadataRepositories; - } - - public void setMetadataRepositories( Collection<ArtifactRepository> metadataRepositories ) - { - this.metadataRepositories = metadataRepositories; - } - //------------------------------------------------------------------- - public ArtifactMetadata getArtifactMetadata() - { - return artifactMetadata; - } - - public void setArtifactMetadata( ArtifactMetadata artifactMetadata ) - { - this.artifactMetadata = artifactMetadata; - } - //------------------------------------------------------------------- - //------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java deleted file mode 100644 index 24f832ef..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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. - */ - -public class MetadataResolutionException - extends Exception -{ - - public MetadataResolutionException() - { - // TODO Auto-generated constructor stub - } - - public MetadataResolutionException( String message ) - { - super( message ); - // TODO Auto-generated constructor stub - } - - public MetadataResolutionException( Throwable cause ) - { - super( cause ); - // TODO Auto-generated constructor stub - } - - public MetadataResolutionException( String message, Throwable cause ) - { - super( message, cause ); - // TODO Auto-generated constructor stub - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java deleted file mode 100644 index e1f6fe1e..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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; - -/** @author Oleg Gusakov */ -public class MetadataResolutionRequest -{ - protected ArtifactMetadata query; - protected ArtifactRepository localRepository; - protected List<ArtifactRepository> remoteRepositories; - - //-------------------------------------------------------------------- - public MetadataResolutionRequest() - { - } - - //-------------------------------------------------------------------- - public MetadataResolutionRequest( ArtifactMetadata query, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - { - this.query = query; - this.localRepository = localRepository; - this.remoteRepositories = remoteRepositories; - } - - //-------------------------------------------------------------------- - public ArtifactMetadata getQuery() - { - return query; - } - - public void setQuery( ArtifactMetadata query ) - { - this.query = query; - } - - public ArtifactRepository getLocalRepository() - { - return localRepository; - } - - public void setLocalRepository( ArtifactRepository localRepository ) - { - this.localRepository = localRepository; - } - - public List<ArtifactRepository> getRemoteRepositories() - { - return remoteRepositories; - } - - public void setRemoteRepositories( List<ArtifactRepository> remoteRepositories ) - { - this.remoteRepositories = remoteRepositories; - } - //-------------------------------------------------------------------- - //-------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java deleted file mode 100644 index f305497a..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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. - */ - -public enum MetadataResolutionRequestTypeEnum -{ - tree( 1 ) - , graph( 2 ) - , classpathCompile( 3 ) - , classpathTest( 4 ) - , classpathRuntime( 5 ) - , versionedGraph( 6 ) - , scopedGraph( 7 ) - ; - - private int id; - - // Constructor - MetadataResolutionRequestTypeEnum( int id ) - { - this.id = id; - } - - int getId() - { - return id; - } -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java deleted file mode 100644 index 1d9e9c46..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.ArtifactScopeEnum; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - -/** - * This object is tinted with ClasspathTransformation and GraphConflictResolver. - * Get rid of them after debugging - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - */ -public class MetadataResolutionResult -{ - MetadataTreeNode treeRoot; - - /** - * these components are are initialized on demand by - * explicit call of the initTreeProcessing() - */ - ClasspathTransformation classpathTransformation; - GraphConflictResolver conflictResolver; - - //---------------------------------------------------------------------------- - public MetadataResolutionResult( ) - { - } - //---------------------------------------------------------------------------- - public MetadataResolutionResult( MetadataTreeNode root ) - { - this.treeRoot = root; - } - //---------------------------------------------------------------------------- - public MetadataTreeNode getTree() - { - return treeRoot; - } - //---------------------------------------------------------------------------- - public void setTree( MetadataTreeNode root ) - { - this.treeRoot = root; - } - - public void initTreeProcessing( PlexusContainer plexus ) - throws ComponentLookupException - { - classpathTransformation = plexus.lookup( ClasspathTransformation.class ); - conflictResolver = plexus.lookup( GraphConflictResolver.class ); - } - //---------------------------------------------------------------------------- - public MetadataGraph getGraph() - throws MetadataResolutionException - { - return treeRoot == null ? null : new MetadataGraph( treeRoot ); - } - //---------------------------------------------------------------------------- - public MetadataGraph getGraph( ArtifactScopeEnum scope ) - throws MetadataResolutionException, GraphConflictResolutionException - { - if ( treeRoot == null ) - { - return null; - } - - if ( conflictResolver == null ) - { - return null; - } - - return conflictResolver.resolveConflicts( getGraph(), scope ); - } - //---------------------------------------------------------------------------- - public MetadataGraph getGraph( MetadataResolutionRequestTypeEnum requestType ) - throws MetadataResolutionException, GraphConflictResolutionException - { - if ( requestType == null ) - { - return null; - } - - if ( treeRoot == null ) - { - return null; - } - - if ( conflictResolver == null ) - { - return null; - } - - if ( requestType.equals( MetadataResolutionRequestTypeEnum.classpathCompile ) ) - { - return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.compile ); - } - else if ( requestType.equals( MetadataResolutionRequestTypeEnum.classpathRuntime ) ) - { - return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.runtime ); - } - else if ( requestType.equals( MetadataResolutionRequestTypeEnum.classpathRuntime ) ) - { - return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.test ); - } - else if ( requestType.equals( MetadataResolutionRequestTypeEnum.classpathRuntime ) ) - { - return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.test ); - } - else if ( requestType.equals( MetadataResolutionRequestTypeEnum.graph ) ) - { - return getGraph(); - } - else if ( requestType.equals( MetadataResolutionRequestTypeEnum.versionedGraph ) ) - { - return new MetadataGraph( getTree(), true, false ); - } - else if ( requestType.equals( MetadataResolutionRequestTypeEnum.scopedGraph ) ) - { - return new MetadataGraph( getTree(), true, true ); - } - return null; - } - //---------------------------------------------------------------------------- - public ClasspathContainer getClasspath( ArtifactScopeEnum scope ) - throws MetadataGraphTransformationException, MetadataResolutionException - { - if ( classpathTransformation == null ) - { - return null; - } - - MetadataGraph dirtyGraph = getGraph(); - if ( dirtyGraph == null ) - { - return null; - } - - return classpathTransformation.transform( dirtyGraph, scope, false ); - } - - //---------------------------------------------------------------------------- - public MetadataTreeNode getClasspathTree( ArtifactScopeEnum scope ) - throws MetadataGraphTransformationException, MetadataResolutionException - { - ClasspathContainer cpc = getClasspath( scope ); - if ( cpc == null ) - { - return null; - } - - return cpc.getClasspathAsTree(); - } - //---------------------------------------------------------------------------- - //---------------------------------------------------------------------------- -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java deleted file mode 100644 index f5461d71..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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. - */ - -/** - * Error while retrieving repository metadata from the repository. - * - * @author Jason van Zyl - */ -public class MetadataRetrievalException - extends Exception -{ - - private ArtifactMetadata artifact; - - public MetadataRetrievalException( String message ) - { - this( message, null, null ); - } - - public MetadataRetrievalException( Throwable cause ) - { - this( null, cause, null ); - } - - public MetadataRetrievalException( String message, Throwable cause ) - { - this( message, cause, null ); - } - - public MetadataRetrievalException( String message, Throwable cause, ArtifactMetadata artifact ) - { - super( message, cause ); - - this.artifact = artifact; - } - - public ArtifactMetadata getArtifactMetadata() - { - return artifact; - } -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java deleted file mode 100644 index 3ca6ce84..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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; - -/** - * Provides some metadata operations, like querying the remote repository for a list of versions available for an - * artifact. - * - * @author Jason van Zyl - */ -public interface MetadataSource -{ - String ROLE = MetadataSource.class.getName(); - - MetadataResolution retrieve( ArtifactMetadata artifact, ArtifactRepository localRepository, - List<ArtifactRepository> remoteRepositories ) - throws MetadataRetrievalException; -}
\ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java deleted file mode 100644 index dd720d38..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.apache.maven.repository.metadata; - -/* - * 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.ArtifactScopeEnum; - -/** - * metadata [dirty] Tree - * - * @author <a href="oleg@codehaus.org">Oleg Gusakov</a> - * - */ -public class MetadataTreeNode -{ - ArtifactMetadata md; // this node - - MetadataTreeNode parent; // papa - - /** default # of children. Used for tree creation optimization only */ - int nChildren = 8; - - MetadataTreeNode[] children; // of cause - - public int getNChildren() - { - return nChildren; - } - - public void setNChildren( int children ) - { - nChildren = children; - } - - //------------------------------------------------------------------------ - public MetadataTreeNode() - { - } - //------------------------------------------------------------------------ - public MetadataTreeNode( ArtifactMetadata md, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope ) - { - if ( md != null ) - { - md.setArtifactScope( ArtifactScopeEnum.checkScope( scope ) ); - md.setResolved( resolved ); - } - - this.md = md; - this.parent = parent; - } - //------------------------------------------------------------------------ - public MetadataTreeNode( Artifact af, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope ) - { - this( new ArtifactMetadata( af ), parent, resolved, scope ); - } - - // ------------------------------------------------------------------------ - public void addChild( int index, MetadataTreeNode kid ) - { - if ( kid == null ) - { - return; - } - - if ( children == null ) - { - children = new MetadataTreeNode[nChildren]; - } - - children[index % nChildren] = kid; - } - - //------------------------------------------------------------------ - @Override - public String toString() - { - return md == null ? "no metadata" : md.toString(); - } - - //------------------------------------------------------------------ - public String graphHash() - throws MetadataResolutionException - { - if ( md == null ) - { - throw new MetadataResolutionException( "treenode without metadata, parent: " - + ( parent == null ? "null" : parent.toString() ) ); - } - - return md.groupId + ":" + md.artifactId; - } - - //------------------------------------------------------------------------ - public boolean hasChildren() - { - return children != null; - } - //------------------------------------------------------------------------ - public ArtifactMetadata getMd() - { - return md; - } - - public void setMd( ArtifactMetadata md ) - { - this.md = md; - } - - public MetadataTreeNode getParent() - { - return parent; - } - - public void setParent( MetadataTreeNode parent ) - { - this.parent = parent; - } - - public MetadataTreeNode[] getChildren() - { - return children; - } - - public void setChildren( MetadataTreeNode[] children ) - { - this.children = children; - } - //------------------------------------------------------------------------ - //------------------------------------------------------------------------ - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java deleted file mode 100644 index 050d135c..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.maven.usability.plugin; - -/* - * 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. - */ - -public class ExpressionDocumentationException - extends Exception -{ - static final long serialVersionUID = 1; - - public ExpressionDocumentationException( String message, Throwable cause ) - { - super( message, cause ); - } - - public ExpressionDocumentationException( String message ) - { - super( message ); - } - -} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java deleted file mode 100644 index 0e98b0cb..00000000 --- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.apache.maven.usability.plugin; - -/* - * 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.usability.plugin.io.xpp3.ParamdocXpp3Reader; -import org.codehaus.plexus.util.IOUtil; -import org.codehaus.plexus.util.ReaderFactory; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ExpressionDocumenter -{ - - private static final String[] EXPRESSION_ROOTS = { "project", "settings", "session", "plugin", "rootless" }; - - private static final String EXPRESSION_DOCO_ROOTPATH = "META-INF/maven/plugin-expressions/"; - - private static Map expressionDocumentation; - - public static Map load() - throws ExpressionDocumentationException - { - if ( expressionDocumentation == null ) - { - expressionDocumentation = new HashMap(); - - ClassLoader docLoader = initializeDocLoader(); - - for ( String EXPRESSION_ROOT : EXPRESSION_ROOTS ) - { - InputStream docStream = null; - try - { - docStream = - docLoader.getResourceAsStream( EXPRESSION_DOCO_ROOTPATH + EXPRESSION_ROOT + ".paramdoc.xml" ); - - if ( docStream != null ) - { - Map doco = parseExpressionDocumentation( docStream ); - - expressionDocumentation.putAll( doco ); - } - } - catch ( IOException e ) - { - throw new ExpressionDocumentationException( - "Failed to read documentation for expression root: " + EXPRESSION_ROOT, e ); - } - catch ( XmlPullParserException e ) - { - throw new ExpressionDocumentationException( - "Failed to parse documentation for expression root: " + EXPRESSION_ROOT, e ); - } - finally - { - IOUtil.close( docStream ); - } - } - } - - return expressionDocumentation; - } - - /** - * <expressions> - * <expression> - * <syntax>project.distributionManagementArtifactRepository</syntax> - * <origin><![CDATA[ - * <distributionManagement> - * <repository> - * <id>some-repo</id> - * <url>scp://host/path</url> - * </repository> - * <snapshotRepository> - * <id>some-snap-repo</id> - * <url>scp://host/snapshot-path</url> - * </snapshotRepository> - * </distributionManagement> - * ]]></origin> - * <usage><![CDATA[ - * The repositories onto which artifacts should be deployed. - * One is for releases, the other for snapshots. - * ]]></usage> - * </expression> - * <expressions> - * @throws IOException - * @throws XmlPullParserException - */ - private static Map parseExpressionDocumentation( InputStream docStream ) - throws IOException, XmlPullParserException - { - Reader reader = new BufferedReader( ReaderFactory.newXmlReader( docStream ) ); - - ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader(); - - ExpressionDocumentation documentation = paramdocReader.read( reader, true ); - - List expressions = documentation.getExpressions(); - - Map bySyntax = new HashMap(); - - if ( expressions != null && !expressions.isEmpty() ) - { - for ( Object expression : expressions ) - { - Expression expr = (Expression) expression; - - bySyntax.put( expr.getSyntax(), expr ); - } - } - - return bySyntax; - } - - private static ClassLoader initializeDocLoader() - throws ExpressionDocumentationException - { - String myResourcePath = ExpressionDocumenter.class.getName().replace( '.', '/' ) + ".class"; - - URL myResource = ExpressionDocumenter.class.getClassLoader().getResource( myResourcePath ); - - assert myResource != null : "The resource is this class itself loaded by its own classloader and must exist"; - - String myClasspathEntry = myResource.getPath(); - - myClasspathEntry = myClasspathEntry.substring( 0, myClasspathEntry.length() - ( myResourcePath.length() + 2 ) ); - - if ( myClasspathEntry.startsWith( "file:" ) ) - { - myClasspathEntry = myClasspathEntry.substring( "file:".length() ); - } - - URL docResource; - try - { - docResource = new File( myClasspathEntry ).toURL(); - } - catch ( MalformedURLException e ) - { - throw new ExpressionDocumentationException( "Cannot construct expression documentation classpath" - + " resource base.", e ); - } - - return new URLClassLoader( new URL[] { docResource } ); - } - -} |