From 23f20956520e583c36f4c9a0351c0021d86929cd Mon Sep 17 00:00:00 2001 From: Herve Boutemy Date: Sat, 26 Jun 2010 23:16:18 +0000 Subject: [PATCH] fixed errors reported by Checkstyle git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@958295 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/artifact/ArtifactUtils.java | 4 +- .../maven/artifact/DefaultArtifact.java | 16 +- .../repository/ArtifactRepository.java | 41 +-- .../repository/ArtifactRepositoryPolicy.java | 4 +- .../layout/ArtifactRepositoryLayout2.java | 6 +- .../resolver/ArtifactNotFoundException.java | 57 ++-- .../resolver/ArtifactResolutionException.java | 34 ++- .../versioning/ComparableVersion.java | 38 +-- .../artifact/versioning/Restriction.java | 6 +- .../org/apache/maven/repository/Proxy.java | 24 +- .../maven/artifact/ArtifactScopeEnum.java | 68 ++--- .../UnknownRepositoryLayoutException.java | 8 +- .../artifact/deployer/ArtifactDeployer.java | 42 +-- .../deployer/DefaultArtifactDeployer.java | 36 +-- .../artifact/installer/ArtifactInstaller.java | 32 ++- .../installer/DefaultArtifactInstaller.java | 2 +- .../artifact/manager/DefaultWagonManager.java | 24 +- .../maven/artifact/manager/WagonManager.java | 21 +- .../repository/ArtifactRepositoryFactory.java | 37 +-- .../repository/DefaultArtifactRepository.java | 30 +-- .../DefaultArtifactRepositoryFactory.java | 21 +- .../layout/FlatRepositoryLayout.java | 7 +- .../DefaultRepositoryMetadataManager.java | 69 +++-- .../artifact/resolver/ArtifactResolver.java | 52 ++-- .../resolver/DebugResolutionListener.java | 30 +-- .../resolver/DefaultArtifactCollector.java | 2 +- .../resolver/DefaultArtifactResolver.java | 159 ++++++----- .../execution/DefaultRuntimeInformation.java | 6 +- .../profiles/DefaultMavenProfilesBuilder.java | 3 +- .../maven/profiles/DefaultProfileManager.java | 4 +- .../activation/FileProfileActivator.java | 6 +- .../activation/JdkPrefixProfileActivator.java | 9 +- .../ProfileActivationException.java | 4 +- .../profiles/activation/ProfileActivator.java | 2 +- .../SystemPropertyProfileActivator.java | 21 +- .../project/DefaultMavenProjectBuilder.java | 32 ++- .../maven/project/MavenProjectBuilder.java | 34 ++- .../apache/maven/project/ProjectUtils.java | 16 +- .../DefaultModelInheritanceAssembler.java | 10 +- .../AbstractStringBasedModelInterpolator.java | 45 ++-- .../ModelInterpolationException.java | 2 +- .../PathTranslatingPostProcessor.java | 7 +- .../StringSearchModelInterpolator.java | 96 ++++--- .../project/path/DefaultPathTranslator.java | 31 +-- .../validation/DefaultModelValidator.java | 2 +- .../validation/ModelValidationResult.java | 2 +- .../repository/DefaultMirrorSelector.java | 11 +- .../repository/MavenArtifactMetadata.java | 14 +- .../maven/repository/MetadataGraph.java | 24 +- .../maven/repository/MetadataGraphNode.java | 38 +-- .../repository/MetadataResolutionRequest.java | 23 +- .../repository/MetadataResolutionResult.java | 14 +- .../repository/VersionNotFoundException.java | 26 +- .../legacy/DefaultUpdateCheckManager.java | 5 +- .../legacy/DefaultWagonManager.java | 81 +++--- .../legacy/LegacyRepositorySystem.java | 105 +++++--- .../maven/repository/legacy/WagonManager.java | 46 ++-- .../repository/ArtifactRepositoryFactory.java | 37 +-- .../DefaultArtifactRepositoryFactory.java | 22 +- .../DefaultLegacyArtifactCollector.java | 69 ++--- .../resolver/LegacyArtifactCollector.java | 24 +- .../resolver/conflict/ConflictResolver.java | 5 +- .../conflict/DefaultConflictResolver.java | 6 +- .../DefaultConflictResolverFactory.java | 7 +- .../conflict/FarthestConflictResolver.java | 5 +- .../conflict/NearestConflictResolver.java | 5 +- .../conflict/NewestConflictResolver.java | 5 +- .../conflict/OldestConflictResolver.java | 5 +- .../ArtifactTransformationManager.java | 16 +- .../DefaultArtifactTransformationManager.java | 13 +- .../LatestArtifactTransformation.java | 11 +- .../ReleaseArtifactTransformation.java | 11 +- .../transform/SnapshotTransformation.java | 14 +- .../repository/metadata/ArtifactMetadata.java | 255 ++++++++---------- .../metadata/ClasspathContainer.java | 2 +- .../metadata/ClasspathTransformation.java | 32 ++- .../DefaultClasspathTransformation.java | 6 +- .../DefaultGraphConflictResolutionPolicy.java | 8 +- .../DefaultGraphConflictResolver.java | 39 ++- .../GraphConflictResolutionException.java | 62 +++-- .../GraphConflictResolutionPolicy.java | 31 ++- .../metadata/GraphConflictResolver.java | 12 +- .../repository/metadata/MetadataGraph.java | 24 +- .../metadata/MetadataGraphEdge.java | 153 ++++++----- .../MetadataGraphTransformationException.java | 49 ++-- .../metadata/MetadataResolution.java | 61 +++-- .../metadata/MetadataResolutionException.java | 22 +- .../metadata/MetadataResolutionRequest.java | 23 +- .../MetadataResolutionRequestTypeEnum.java | 19 ++ .../metadata/MetadataResolutionResult.java | 12 +- .../metadata/MetadataRetrievalException.java | 7 +- .../repository/metadata/MetadataSource.java | 3 +- .../repository/metadata/MetadataTreeNode.java | 70 +++-- .../plugin/ExpressionDocumenter.java | 10 +- .../AbstractMavenLifecycleParticipant.java | 51 ++-- .../maven/ArtifactFilterManagerDelegate.java | 19 ++ .../apache/maven/BuildFailureException.java | 1 - .../java/org/apache/maven/DefaultMaven.java | 74 ++--- .../DefaultProjectDependenciesResolver.java | 19 +- .../apache/maven/MissingModuleException.java | 18 ++ .../apache/maven/ProjectCycleException.java | 19 ++ .../maven/ProjectDependenciesResolver.java | 14 +- .../maven/ReactorArtifactRepository.java | 17 +- .../artifact/InvalidRepositoryException.java | 19 +- .../artifact/factory/ArtifactFactory.java | 43 +-- .../factory/DefaultArtifactFactory.java | 32 ++- .../handler/DefaultArtifactHandler.java | 6 +- .../manager/ArtifactHandlerManager.java | 2 +- .../DefaultArtifactHandlerManager.java | 8 +- .../metadata/ArtifactMetadataSource.java | 10 +- .../artifact/metadata/ResolutionGroup.java | 28 +- .../repository/DefaultRepositoryRequest.java | 22 +- .../repository/MavenArtifactRepository.java | 43 +-- .../layout/DefaultRepositoryLayout.java | 4 +- .../metadata/RepositoryMetadataManager.java | 9 +- .../metadata/io/MetadataReader.java | 10 +- .../resolver/ArtifactResolutionResult.java | 30 ++- .../DefaultResolutionErrorHandler.java | 3 +- .../resolver/ResolutionErrorHandler.java | 2 +- .../artifact/resolver/ResolutionNode.java | 3 +- .../exception/DefaultExceptionHandler.java | 9 +- .../execution/AbstractExecutionListener.java | 3 +- .../DefaultMavenExecutionRequest.java | 3 +- ...DefaultMavenExecutionRequestPopulator.java | 2 +- .../execution/MavenExecutionRequest.java | 30 +-- .../lifecycle/DefaultLifecycleExecutor.java | 35 +-- .../maven/lifecycle/DefaultLifecycles.java | 38 +-- .../maven/lifecycle/DefaultSchedules.java | 25 +- .../lifecycle/LifeCyclePluginAnalyzer.java | 32 ++- .../org/apache/maven/lifecycle/Lifecycle.java | 12 +- .../maven/lifecycle/MavenExecutionPlan.java | 23 +- .../org/apache/maven/lifecycle/Schedule.java | 40 +-- .../apache/maven/lifecycle/Scheduling.java | 34 +-- .../internal/BuildListCalculator.java | 33 ++- .../lifecycle/internal/BuildLogItem.java | 33 ++- .../lifecycle/internal/BuilderCommon.java | 49 ++-- .../internal/ConcurrencyDependencyGraph.java | 33 ++- .../internal/ConcurrentBuildLogger.java | 33 ++- .../lifecycle/internal/DependencyContext.java | 39 +-- .../lifecycle/internal/ExecutionPlanItem.java | 33 ++- .../maven/lifecycle/internal/GoalTask.java | 33 ++- .../internal/LifecycleDebugLogger.java | 41 +-- .../internal/LifecycleDependencyResolver.java | 49 ++-- .../LifecycleExecutionPlanCalculator.java | 43 +-- .../LifecycleExecutionPlanCalculatorImpl.java | 56 ++-- .../internal/LifecycleModuleBuilder.java | 36 +-- .../internal/LifecyclePluginAnalyzerImpl.java | 35 +-- .../internal/LifecyclePluginResolver.java | 37 +-- .../lifecycle/internal/LifecycleStarter.java | 54 ++-- .../lifecycle/internal/LifecycleTask.java | 34 +-- .../LifecycleTaskSegmentCalculator.java | 43 +-- .../LifecycleTaskSegmentCalculatorImpl.java | 33 ++- .../internal/LifecycleThreadedBuilder.java | 44 +-- .../internal/LifecycleWeaveBuilder.java | 33 ++- .../internal/MojoDescriptorCreator.java | 60 +++-- .../lifecycle/internal/MojoExecutor.java | 59 ++-- .../lifecycle/internal/PhaseRecorder.java | 33 ++- .../lifecycle/internal/ProjectBuildList.java | 68 +++-- .../lifecycle/internal/ProjectIndex.java | 33 ++- .../lifecycle/internal/ProjectSegment.java | 33 ++- .../internal/ReactorBuildStatus.java | 33 ++- .../lifecycle/internal/ReactorContext.java | 34 +-- .../maven/lifecycle/internal/TaskSegment.java | 33 ++- .../internal/ThreadConfigurationService.java | 4 +- .../lifecycle/internal/ThreadOutputMuxer.java | 38 +-- .../mapping/DefaultLifecycleMapping.java | 28 +- .../maven/lifecycle/mapping/Lifecycle.java | 10 +- .../maven/plugin/BuildPluginManager.java | 34 ++- .../plugin/DefaultBuildPluginManager.java | 41 +-- .../maven/plugin/DefaultPluginRealmCache.java | 11 +- .../maven/plugin/InvalidPluginException.java | 6 +- .../maven/plugin/MavenPluginValidator.java | 28 +- .../plugin/PluginConfigurationException.java | 29 +- .../plugin/PluginContainerException.java | 9 +- .../plugin/PluginExecutionException.java | 3 +- .../maven/plugin/PluginManagerException.java | 29 +- .../PluginParameterExpressionEvaluator.java | 32 +-- .../apache/maven/plugin/PluginRealmCache.java | 9 +- .../plugin/internal/DefaultPluginManager.java | 6 +- .../internal/PluginDependenciesResolver.java | 8 +- .../internal/DefaultPluginPrefixResolver.java | 11 +- .../DefaultPluginVersionResolver.java | 4 +- .../project/DefaultMavenProjectHelper.java | 8 +- .../maven/project/DefaultProjectBuilder.java | 38 +-- .../project/DuplicateProjectException.java | 4 +- .../apache/maven/project/MavenProject.java | 102 +++---- .../apache/maven/project/ProjectBuilder.java | 38 +-- .../project/ProjectBuilderConfiguration.java | 22 +- .../maven/project/ProjectBuildingHelper.java | 11 +- .../maven/project/ProjectBuildingRequest.java | 35 ++- .../apache/maven/project/ProjectSorter.java | 11 +- .../artifact/DefaultMavenMetadataCache.java | 43 +-- .../InvalidDependencyVersionException.java | 14 +- .../project/artifact/MavenMetadataCache.java | 35 +-- .../project/artifact/MavenMetadataSource.java | 59 ++-- .../project/artifact/PluginArtifact.java | 3 +- .../project/artifact/ProjectArtifact.java | 5 +- .../artifact/ProjectArtifactMetadata.java | 6 +- .../maven/repository/RepositorySystem.java | 68 ++--- .../metadata/ArtifactMetadataSource.java | 10 +- .../settings/DefaultMavenSettingsBuilder.java | 11 +- .../building/DefaultSettingsBuilder.java | 5 +- .../validation/DefaultSettingsValidator.java | 8 +- .../maven/toolchain/DefaultToolchain.java | 15 +- .../MisconfiguredToolchainException.java | 7 +- .../maven/toolchain/RequirementMatcher.java | 4 +- .../toolchain/RequirementMatcherFactory.java | 4 +- .../org/apache/maven/toolchain/Toolchain.java | 5 +- .../maven/toolchain/ToolchainFactory.java | 4 +- .../maven/toolchain/ToolchainManager.java | 7 +- .../toolchain/ToolchainManagerPrivate.java | 5 +- .../maven/toolchain/ToolchainPrivate.java | 4 +- .../toolchain/java/DefaultJavaToolChain.java | 6 +- .../java/DefaultJavaToolchainFactory.java | 4 +- .../maven/toolchain/java/JavaToolChain.java | 5 +- .../java/org/apache/maven/cli/CLIManager.java | 32 ++- .../apache/maven/cli/CLIReportingUtils.java | 3 +- .../maven/cli/ExecutionEventLogger.java | 4 +- .../java/org/apache/maven/cli/MavenCli.java | 102 ++++--- .../model/building/DefaultModelBuilder.java | 18 +- .../building/ModelBuildingEventCatapult.java | 6 +- .../interpolation/ModelInterpolator.java | 7 +- .../PathTranslatingPostProcessor.java | 5 +- .../StringSearchModelInterpolator.java | 40 +-- .../maven/model/merge/MavenModelMerger.java | 21 +- .../maven/model/resolution/ModelResolver.java | 9 +- .../superpom/DefaultSuperPomProvider.java | 4 +- .../validation/DefaultModelValidator.java | 46 ++-- .../apache/maven/model/merge/ModelMerger.java | 27 +- .../org/apache/maven/plugin/AbstractMojo.java | 9 +- .../java/org/apache/maven/plugin/Mojo.java | 4 +- .../DuplicateMojoDescriptorException.java | 7 +- .../plugin/descriptor/MojoDescriptor.java | 15 +- .../apache/maven/settings/RuntimeInfo.java | 7 +- 234 files changed, 3413 insertions(+), 2645 deletions(-) diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java b/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java index 823e29ada3..8efc45cd21 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java @@ -107,9 +107,9 @@ public final class ArtifactUtils return groupId + ":" + artifactId + ":" + version; } - public static Map artifactMapByVersionlessId( Collection artifacts ) + public static Map artifactMapByVersionlessId( Collection artifacts ) { - Map artifactMap = new LinkedHashMap(); + Map artifactMap = new LinkedHashMap(); if ( artifacts != null ) { diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java index 87739d8386..8878b06e0e 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java @@ -77,21 +77,25 @@ public class DefaultArtifact private List availableVersions; - private Map metadataMap; + private Map metadataMap; private boolean optional; - public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, String classifier, ArtifactHandler artifactHandler ) + public DefaultArtifact( String groupId, String artifactId, String version, String scope, String type, + String classifier, ArtifactHandler artifactHandler ) { - this( groupId, artifactId, VersionRange.createFromVersion( version ), scope, type, classifier, artifactHandler, false ); + this( groupId, artifactId, VersionRange.createFromVersion( version ), scope, type, classifier, artifactHandler, + false ); } - public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, ArtifactHandler artifactHandler ) + public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, + String classifier, ArtifactHandler artifactHandler ) { this( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler, false ); } - public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, ArtifactHandler artifactHandler, boolean optional ) + public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, + String classifier, ArtifactHandler artifactHandler, boolean optional ) { this.groupId = groupId; @@ -247,7 +251,7 @@ public class DefaultArtifact { if ( metadataMap == null ) { - metadataMap = new HashMap(); + metadataMap = new HashMap(); } ArtifactMetadata m = metadataMap.get( metadata.getKey() ); diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java index f3528e28ed..23759ba371 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java @@ -1,20 +1,25 @@ 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. + * 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; @@ -61,18 +66,18 @@ public interface ArtifactRepository @Deprecated boolean isBlacklisted(); - + @Deprecated void setBlacklisted( boolean blackListed ); // - // New interface methods for the repository system. + // New interface methods for the repository system. // Artifact find( Artifact artifact ); /** * Finds the versions of the specified artifact that are available in this repository. - * + * * @param artifact The artifact whose available versions should be determined, must not be {@code null}. * @return The available versions of the artifact or an empty list if none, never {@code null}. */ @@ -81,14 +86,14 @@ public interface ArtifactRepository /** * Indicates whether this repository is backed by actual projects. For instance, the build reactor or IDE workspace * are examples of such repositories. - * + * * @return {@code true} if the repository is backed by actual projects, {@code false} otherwise. */ boolean isProjectAware(); - void setAuthentication( Authentication authentication ); + void setAuthentication( Authentication authentication ); Authentication getAuthentication(); - + void setProxy( Proxy proxy ); Proxy getProxy(); } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java index 1abd997bc7..9c105a68d1 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryPolicy.java @@ -61,9 +61,7 @@ public class ArtifactRepositoryPolicy this( policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy() ); } - public ArtifactRepositoryPolicy( boolean enabled, - String updatePolicy, - String checksumPolicy ) + public ArtifactRepositoryPolicy( boolean enabled, String updatePolicy, String checksumPolicy ) { this.enabled = enabled; diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java index 63bd607a4b..c0544e5cb1 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java @@ -1,8 +1,5 @@ package org.apache.maven.artifact.repository.layout; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,6 +19,9 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; * under the License. */ +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; + public interface ArtifactRepositoryLayout2 extends ArtifactRepositoryLayout { diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java index a5a151db61..6cc3a5402b 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactNotFoundException.java @@ -1,20 +1,25 @@ 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. + * 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; @@ -35,30 +40,36 @@ public class ArtifactNotFoundException public ArtifactNotFoundException( String message, Artifact artifact ) { - this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact - .getDependencyTrail() ); + this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), + artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() ); } - protected ArtifactNotFoundException( String message, Artifact artifact, List remoteRepositories, Throwable cause ) + protected ArtifactNotFoundException( String message, Artifact artifact, + List remoteRepositories, Throwable cause ) { - this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact - .getDependencyTrail(), cause ); + this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), + artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(), + cause ); } - public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, String classifier, List remoteRepositories, + public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, + String classifier, List remoteRepositories, String downloadUrl, List path, Throwable cause ) { - super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, downloadUrl, path ), groupId, artifactId, version, type, classifier, remoteRepositories, - null, cause ); + super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, + downloadUrl, path ), groupId, artifactId, version, type, classifier, + remoteRepositories, null, cause ); this.downloadUrl = downloadUrl; } - private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, String classifier, List remoteRepositories, + private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type, + String classifier, List remoteRepositories, String downloadUrl, List path ) { - super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, downloadUrl, path ), groupId, artifactId, version, type, classifier, remoteRepositories, - null ); + super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier, + downloadUrl, path ), groupId, artifactId, version, type, classifier, + remoteRepositories, null ); this.downloadUrl = downloadUrl; } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java index 8a8eab6f64..0f35b5ef8c 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionException.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -34,7 +38,8 @@ public class ArtifactResolutionException super( message, groupId, artifactId, version, type, classifier, remoteRepositories, path, t ); } - public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, String classifier, Throwable t ) + public ArtifactResolutionException( String message, String groupId, String artifactId, String version, String type, + String classifier, Throwable t ) { super( message, groupId, artifactId, version, type, classifier, null, null, t ); } @@ -54,7 +59,8 @@ public class ArtifactResolutionException super( message, artifact, null, cause ); } - public ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, Throwable cause ) + public ArtifactResolutionException( String message, Artifact artifact, List remoteRepositories, + Throwable cause ) { super( message, artifact, remoteRepositories, cause ); } diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java index cf617d662d..04301f86d7 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java @@ -67,15 +67,15 @@ public class ComparableVersion private interface Item { - public static final int INTEGER_ITEM = 0; - public static final int STRING_ITEM = 1; - public static final int LIST_ITEM = 2; + final int INTEGER_ITEM = 0; + final int STRING_ITEM = 1; + final int LIST_ITEM = 2; - public int compareTo( Item item ); + int compareTo( Item item ); - public int getType(); + int getType(); - public boolean isNull(); + boolean isNull(); } /** @@ -92,7 +92,7 @@ public class ComparableVersion private IntegerItem() { - this.value = BigInteger_ZERO; + this.value = BigInteger_ZERO; } public IntegerItem( String str ) @@ -145,21 +145,23 @@ public class ComparableVersion private static class StringItem implements Item { - private final static String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" }; + private static final String[] QUALIFIERS = { "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" }; - private final static List _QUALIFIERS = Arrays.asList( QUALIFIERS ); + private static final List _QUALIFIERS = Arrays.asList( QUALIFIERS ); - private final static Properties ALIASES = new Properties(); - static { + private static final Properties ALIASES = new Properties(); + static + { ALIASES.put( "ga", "" ); ALIASES.put( "final", "" ); ALIASES.put( "cr", "rc" ); } + /** - * A comparable value for the empty-string qualifier. This one is used to determine if a given qualifier makes the - * version older than one without a qualifier, or more recent. + * A comparable value for the empty-string qualifier. This one is used to determine if a given qualifier makes + * the version older than one without a qualifier, or more recent. */ - private static String RELEASE_VERSION_INDEX = String.valueOf( _QUALIFIERS.indexOf( "" ) ); + private static final String RELEASE_VERSION_INDEX = String.valueOf( _QUALIFIERS.indexOf( "" ) ); private String value; @@ -285,7 +287,7 @@ public class ComparableVersion { return 0; // 1-0 = 1- (normalize) = 1 } - Item first = (Item) get(0); + Item first = get( 0 ); return first.compareTo( null ); } switch ( item.getType() ) @@ -302,8 +304,8 @@ public class ComparableVersion while ( left.hasNext() || right.hasNext() ) { - Item l = left.hasNext() ? (Item) left.next() : null; - Item r = right.hasNext() ? (Item) right.next() : null; + Item l = left.hasNext() ? left.next() : null; + Item r = right.hasNext() ? right.next() : null; // if this is shorter, then invert the compare and mul with -1 int result = l == null ? -1 * r.compareTo( l ) : l.compareTo( r ); @@ -454,7 +456,7 @@ public class ComparableVersion public boolean equals( Object o ) { - return ( o instanceof ComparableVersion ) && canonical.equals( ( ( ComparableVersion )o ).canonical ); + return ( o instanceof ComparableVersion ) && canonical.equals( ( (ComparableVersion) o ).canonical ); } public int hashCode() diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java index f8de2c95e0..f90fcd73d7 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java @@ -39,9 +39,7 @@ public class Restriction public static final Restriction EVERYTHING = new Restriction( null, false, null, false ); - public Restriction( ArtifactVersion lowerBound, - boolean lowerBoundInclusive, - ArtifactVersion upperBound, + public Restriction( ArtifactVersion lowerBound, boolean lowerBoundInclusive, ArtifactVersion upperBound, boolean upperBoundInclusive ) { this.lowerBound = lowerBound; @@ -162,7 +160,7 @@ public class Restriction return true; } - if ( !(other instanceof Restriction ) ) + if ( !( other instanceof Restriction ) ) { return false; } diff --git a/maven-artifact/src/main/java/org/apache/maven/repository/Proxy.java b/maven-artifact/src/main/java/org/apache/maven/repository/Proxy.java index 83382396d1..ea2c0238e7 100644 --- a/maven-artifact/src/main/java/org/apache/maven/repository/Proxy.java +++ b/maven-artifact/src/main/java/org/apache/maven/repository/Proxy.java @@ -21,11 +21,11 @@ package org.apache.maven.repository; public class Proxy { - public final static String PROXY_SOCKS5 = "SOCKS_5"; + public static final String PROXY_SOCKS5 = "SOCKS_5"; - public final static String PROXY_SOCKS4 = "SOCKS4"; + public static final String PROXY_SOCKS4 = "SOCKS4"; - public final static String PROXY_HTTP = "HTTP"; + public static final String PROXY_HTTP = "HTTP"; /** * Proxy server host @@ -69,7 +69,7 @@ public class Proxy /** * Return proxy server host name. - * + * * @return proxy server host name */ public String getHost() @@ -79,7 +79,7 @@ public class Proxy /** * Set proxy host name. - * + * * @param host proxy server host name */ public void setHost( String host ) @@ -89,7 +89,7 @@ public class Proxy /** * Get user's password used to login to proxy server. - * + * * @return user's password at proxy host */ public String getPassword() @@ -99,7 +99,7 @@ public class Proxy /** * Set the user's password for the proxy server. - * + * * @param password password to use to login to a proxy server */ public void setPassword( String password ) @@ -109,7 +109,7 @@ public class Proxy /** * Get the proxy port. - * + * * @return proxy server port */ public int getPort() @@ -119,7 +119,7 @@ public class Proxy /** * Set the proxy port. - * + * * @param port proxy server port */ public void setPort( int port ) @@ -129,7 +129,7 @@ public class Proxy /** * Get the proxy username. - * + * * @return username for the proxy server */ public String getUserName() @@ -139,7 +139,7 @@ public class Proxy /** * Set the proxy username. - * + * * @param userName username for the proxy server */ public void setUserName( String userName ) @@ -149,7 +149,7 @@ public class Proxy /** * Get the type of the proxy server. - * + * * @return the type of the proxy server */ public String getProtocol() diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java index 783a381c99..574f7d6d55 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java @@ -22,7 +22,7 @@ package org.apache.maven.artifact; /** * Type safe reincarnation of Artifact scope. Also supplies the DEFAULT_SCOPE as well * as convenience method to deal with scope relationships. - * + * * @author Oleg Gusakov * */ @@ -40,7 +40,7 @@ public enum ArtifactScopeEnum { this.id = id; } - + int getId() { return id; @@ -49,16 +49,16 @@ public enum ArtifactScopeEnum /** * Helper method to simplify null processing - * - * @return + * + * @return */ public static final ArtifactScopeEnum checkScope( ArtifactScopeEnum scope ) { - return scope == null ? DEFAULT_SCOPE : scope; + return scope == null ? DEFAULT_SCOPE : scope; } - + /** - * + * * @return unsafe String representation of this scope. */ public String getScope() @@ -90,40 +90,44 @@ public enum ArtifactScopeEnum return Artifact.SCOPE_RUNTIME_PLUS_SYSTEM; } } - + private static final ArtifactScopeEnum [][][] _compliancySets = { - { { compile }, { compile, provided, system } } - , { { test }, { compile, test, provided, system } } - , { { runtime }, { compile, runtime, system } } - , { { provided }, { compile, test, provided } } + { { 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; + final ArtifactScopeEnum s = checkScope( scope ); - for( ArtifactScopeEnum[][] set : _compliancySets ) - { - if( id == set[0][0].id ) - { - for( ArtifactScopeEnum ase : set[1] ) - { - if( s.id == ase.id ) - return true; - } - break; - } - } - return false; + // system scope is historic only - and simple + if ( id == system.id ) + { + return scope.id == system.id; + } + + for ( ArtifactScopeEnum[][] set : _compliancySets ) + { + if ( id == set[0][0].id ) + { + for ( ArtifactScopeEnum ase : set[1] ) + { + if ( s.id == ase.id ) + { + return true; + } + } + break; + } + } + return false; } } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java b/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java index f6779c98fe..5abe1105a3 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java @@ -19,7 +19,6 @@ package org.apache.maven.artifact; * under the License. */ -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; /** @@ -35,16 +34,13 @@ public class UnknownRepositoryLayoutException private final String layoutId; - public UnknownRepositoryLayoutException( String repositoryId, - 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 ) + public UnknownRepositoryLayoutException( String repositoryId, String layoutId, ComponentLookupException e ) { super( "Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId, e ); this.layoutId = layoutId; diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java index 22f2d6c075..072552cc8f 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -27,29 +31,31 @@ public interface ArtifactDeployer /** * 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 sans extension + * @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 instlal/deploy plugins use the alternate + * @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 ) + 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 ) + void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, + ArtifactRepository localRepository ) throws ArtifactDeploymentException; } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java index 923f403967..34400afdda 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -40,7 +44,7 @@ import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.util.FileUtils; -@Component (role=ArtifactDeployer.class) +@Component( role = ArtifactDeployer.class ) public class DefaultArtifactDeployer extends AbstractLogEnabled implements ArtifactDeployer @@ -65,7 +69,8 @@ public class DefaultArtifactDeployer * correctly. */ @Deprecated - public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) + public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository, + ArtifactRepository localRepository ) throws ArtifactDeploymentException { String extension = artifact.getArtifactHandler().getExtension(); @@ -73,7 +78,8 @@ public class DefaultArtifactDeployer deploy( source, artifact, deploymentRepository, localRepository ); } - public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository ) + public void deploy( File source, Artifact artifact, ArtifactRepository deploymentRepository, + ArtifactRepository localRepository ) throws ArtifactDeploymentException { deploymentRepository = injectSession( deploymentRepository ); diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java b/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java index f29f66bfe6..bdbd564a60 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -31,7 +35,7 @@ public interface ArtifactInstaller /** * 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 @@ -46,7 +50,7 @@ public interface ArtifactInstaller /** * 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 diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java b/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java index cd67685e1e..049e63e091 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java @@ -39,7 +39,7 @@ import org.codehaus.plexus.util.FileUtils; /** * @author Jason van Zyl */ -@Component(role=ArtifactInstaller.class) +@Component( role = ArtifactInstaller.class ) public class DefaultArtifactInstaller extends AbstractLogEnabled implements ArtifactInstaller diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java index 5ba298253d..3df86ece50 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java @@ -42,27 +42,27 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; -@Component(role=WagonManager.class) +@Component( role = WagonManager.class ) public class DefaultWagonManager extends org.apache.maven.repository.legacy.DefaultWagonManager implements WagonManager { @Requirement - private Logger logger; - + private Logger logger; + @Requirement private LegacySupport legacySupport; @Requirement private SettingsDecrypter settingsDecrypter; - + @Requirement - private MirrorSelector mirrorSelector; - + private MirrorSelector mirrorSelector; + @Requirement private ArtifactRepositoryFactory artifactRepositoryFactory; - + public AuthenticationInfo getAuthenticationInfo( String id ) { MavenSession session = legacySupport.getSession(); @@ -153,13 +153,13 @@ public class DefaultWagonManager { 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(); @@ -170,12 +170,12 @@ public class DefaultWagonManager } logger.debug( "Using mirror: " + mirror.getUrl() + " (id: " + id + ")" ); - + repository = artifactRepositoryFactory.createArtifactRepository( id, mirror.getUrl(), repository.getLayout(), repository.getSnapshots(), repository.getReleases() ); } return repository; - } + } } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java index bb968a231d..3332fbf8d4 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java @@ -1,14 +1,5 @@ package org.apache.maven.artifact.manager; -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; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -28,6 +19,14 @@ import org.apache.maven.wagon.proxy.ProxyInfo; * 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 Wagon related operations in Maven. @@ -40,7 +39,7 @@ public interface WagonManager extends org.apache.maven.repository.legacy.WagonManager { /** - * this method is only here for backward compat (project-info-reports:dependencies) + * this method is only here for backward compat (project-info-reports:dependencies) * the default implementation will return an empty AuthenticationInfo */ AuthenticationInfo getAuthenticationInfo( String id ); @@ -52,7 +51,7 @@ public interface WagonManager void getArtifact( Artifact artifact, List remoteRepositories ) throws TransferFailedException, ResourceDoesNotExistException; - + ArtifactRepository getMirrorRepository( ArtifactRepository repository ); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java index 7cab89b7f4..ac18b3ad13 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -35,12 +39,15 @@ public interface ArtifactRepositoryFactory ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) throws UnknownRepositoryLayoutException; - ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion ); + ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, + boolean uniqueVersion ); - ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) + 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 ); + ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, + ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); void setGlobalUpdatePolicy( String snapshotPolicy ); diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java index fb97152ee2..4c98625ecd 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java @@ -52,7 +52,7 @@ public class DefaultArtifactRepository private Authentication authentication; private Proxy proxy; - + /** * Create a local repository or a test repository. * @@ -88,7 +88,8 @@ public class DefaultArtifactRepository * @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 ) + public DefaultArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, + ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) { super( id, url ); @@ -121,8 +122,7 @@ public class DefaultArtifactRepository return layout.pathOfRemoteRepositoryMetadata( artifactMetadata ); } - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, - ArtifactRepository repository ) + public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) { return layout.pathOfLocalRepositoryMetadata( metadata, repository ); } @@ -131,7 +131,7 @@ public class DefaultArtifactRepository { this.layout = layout; } - + public ArtifactRepositoryLayout getLayout() { return layout; @@ -141,7 +141,7 @@ public class DefaultArtifactRepository { this.snapshots = snapshots; } - + public ArtifactRepositoryPolicy getSnapshots() { return snapshots; @@ -171,7 +171,7 @@ public class DefaultArtifactRepository { this.blacklisted = blacklisted; } - + public String toString() { StringBuilder sb = new StringBuilder(); @@ -179,13 +179,13 @@ public class DefaultArtifactRepository sb.append( " id: " ).append( getId() ).append( "\n" ); sb.append( " url: " ).append( getUrl() ).append( "\n" ); sb.append( " layout: " ).append( layout != null ? layout.getId() : "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() ); @@ -198,16 +198,16 @@ public class DefaultArtifactRepository 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 ); + + if ( artifactFile.exists() ) + { + artifact.setResolved( true ); } - + return artifact; } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java index 8e1bf73f65..80316795b3 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java @@ -34,11 +34,11 @@ import org.codehaus.plexus.component.annotations.Requirement; /** * @author jdcasey */ -@Component(role=ArtifactRepositoryFactory.class) +@Component( role = ArtifactRepositoryFactory.class ) public class DefaultArtifactRepositoryFactory implements ArtifactRepositoryFactory { - + @Requirement private org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory factory; @@ -54,26 +54,22 @@ public class DefaultArtifactRepositoryFactory return factory.getLayout( layoutId ); } - public ArtifactRepository createDeploymentArtifactRepository( String id, - String url, - String 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, + public ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, boolean uniqueVersion ) { - return injectSession( factory.createDeploymentArtifactRepository( id, url, repositoryLayout, uniqueVersion ), false); + return injectSession( factory.createDeploymentArtifactRepository( id, url, repositoryLayout, uniqueVersion ), + false ); } - public ArtifactRepository createArtifactRepository( String id, - String url, - String layoutId, + public ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) throws UnknownRepositoryLayoutException @@ -81,8 +77,7 @@ public class DefaultArtifactRepositoryFactory return injectSession( factory.createArtifactRepository( layoutId, url, layoutId, snapshots, releases ), true ); } - public ArtifactRepository createArtifactRepository( String id, - String url, + public ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java index 7a93c43661..e8d0e63de0 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java @@ -31,7 +31,7 @@ import org.codehaus.plexus.component.annotations.Component; * * @version $Id$ */ -@Component(role=ArtifactRepositoryLayout.class, hint="flat") +@Component( role = ArtifactRepositoryLayout.class, hint = "flat" ) public class FlatRepositoryLayout implements ArtifactRepositoryLayout { @@ -43,7 +43,7 @@ public class FlatRepositoryLayout { return "flat"; } - + public String pathOf( Artifact artifact ) { ArtifactHandler artifactHandler = artifact.getArtifactHandler(); @@ -65,8 +65,7 @@ public class FlatRepositoryLayout return path.toString(); } - public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, - ArtifactRepository repository ) + public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository ) { return pathOfRepositoryMetadata( metadata.getLocalFilename( repository ) ); } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java index e5d48020f2..ca6fce074e 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -6,9 +6,9 @@ package org.apache.maven.artifact.repository.metadata; * 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 @@ -49,7 +49,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * @author Jason van Zyl */ -@Component(role=RepositoryMetadataManager.class) +@Component( role = RepositoryMetadataManager.class ) public class DefaultRepositoryMetadataManager extends AbstractLogEnabled implements RepositoryMetadataManager @@ -60,7 +60,8 @@ public class DefaultRepositoryMetadataManager @Requirement private UpdateCheckManager updateCheckManager; - public void resolve( RepositoryMetadata metadata, List remoteRepositories, ArtifactRepository localRepository ) + public void resolve( RepositoryMetadata metadata, List remoteRepositories, + ArtifactRepository localRepository ) throws RepositoryMetadataResolutionException { RepositoryRequest request = new DefaultRepositoryRequest(); @@ -204,7 +205,8 @@ public class DefaultRepositoryMetadataManager } catch ( RepositoryMetadataStoreException e ) { - throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: " + e.getMessage(), e ); + throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: " + + e.getMessage(), e ); } if ( cache != null ) @@ -342,7 +344,8 @@ public class DefaultRepositoryMetadataManager } - private void mergeMetadata( RepositoryMetadata metadata, List remoteRepositories, ArtifactRepository localRepository ) + private void mergeMetadata( RepositoryMetadata metadata, List remoteRepositories, + ArtifactRepository localRepository ) throws RepositoryMetadataStoreException { // TODO: currently this is first wins, but really we should take the latest by comparing either the @@ -371,7 +374,9 @@ public class DefaultRepositoryMetadataManager updateSnapshotMetadata( metadata, previousMetadata, selected, localRepository ); } - private void updateSnapshotMetadata( RepositoryMetadata metadata, Map previousMetadata, ArtifactRepository selected, ArtifactRepository localRepository ) + private void updateSnapshotMetadata( RepositoryMetadata metadata, + Map previousMetadata, + ArtifactRepository selected, ArtifactRepository localRepository ) throws RepositoryMetadataStoreException { // TODO: this could be a lot nicer... should really be in the snapshot transformation? @@ -396,7 +401,8 @@ public class DefaultRepositoryMetadataManager } else { - if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null ) && m.getVersioning().getSnapshot().isLocalCopy() ) + if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null ) + && m.getVersioning().getSnapshot().isLocalCopy() ) { m.getVersioning().getSnapshot().setLocalCopy( false ); metadata.setMetadata( m ); @@ -409,11 +415,14 @@ public class DefaultRepositoryMetadataManager } } - private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository, ArtifactRepository localRepository, Map previousMetadata ) + private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository, + ArtifactRepository localRepository, Map previousMetadata ) { boolean setRepository = false; - File metadataFile = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata, remoteRepository ) ); + File metadataFile = + new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata, + remoteRepository ) ); if ( metadataFile.exists() ) { @@ -475,11 +484,13 @@ public class DefaultRepositoryMetadataManager } catch ( IOException e ) { - throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), 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 ); + throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + + e.getMessage(), e ); } finally { @@ -490,8 +501,8 @@ public class DefaultRepositoryMetadataManager } /** - * 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. + * 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 ) { @@ -547,7 +558,8 @@ public class DefaultRepositoryMetadataManager } } - public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) throws RepositoryMetadataResolutionException { File file; @@ -557,7 +569,8 @@ public class DefaultRepositoryMetadataManager } catch ( TransferFailedException e ) { - throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: " + remoteRepository.getId() + " due to an error: " + e.getMessage(), e ); + throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: " + + remoteRepository.getId() + " due to an error: " + e.getMessage(), e ); } try @@ -574,18 +587,24 @@ public class DefaultRepositoryMetadataManager } } - private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, + ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) throws TransferFailedException { - File file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) ); + File file = + new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, + remoteRepository ) ); try { - wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN ); + 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" ); + 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() ) @@ -603,7 +622,8 @@ public class DefaultRepositoryMetadataManager return file; } - public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository ) + public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, + ArtifactRepository deploymentRepository ) throws RepositoryMetadataDeploymentException { File file; @@ -616,7 +636,8 @@ public class DefaultRepositoryMetadataManager } catch ( TransferFailedException e ) { - throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: " + deploymentRepository.getId() + " due to an error: " + e.getMessage(), e ); + throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: " + + deploymentRepository.getId() + " due to an error: " + e.getMessage(), e ); } if ( file.isFile() ) @@ -634,7 +655,9 @@ public class DefaultRepositoryMetadataManager else { // It's a POM - we don't need to retrieve it first - file = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) ); + file = + new File( localRepository.getBasedir(), + localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) ); } try diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java index 25af479521..a7a28c0488 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java @@ -40,51 +40,53 @@ public interface ArtifactResolver // The rest is deprecated - // USED BY MAVEN ASSEMBLY PLUGIN 2.2-beta-2 + // USED BY MAVEN ASSEMBLY PLUGIN 2.2-beta-2 @Deprecated String ROLE = ArtifactResolver.class.getName(); // USED BY SUREFIRE @Deprecated - ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List remoteRepositories, + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY MAVEN ASSEMBLY PLUGIN @Deprecated - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source ) + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY MAVEN ASSEMBLY PLUGIN @Deprecated - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException; @Deprecated - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - List remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source ) + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException; @Deprecated - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, ArtifactFilter filter, - List listeners ) + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException; @Deprecated - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - List remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source, - List listeners ) + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY REMOTE RESOURCES PLUGIN @@ -94,11 +96,13 @@ public interface ArtifactResolver // USED BY REMOTE RESOURCES PLUGIN @Deprecated - void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, TransferListener downloadMonitor ) + void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, + TransferListener downloadMonitor ) throws ArtifactResolutionException, ArtifactNotFoundException; // USED BY ARCHETYPE DOWNLOADER @Deprecated - void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + void resolveAlways( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException; } diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java index c2238efc21..396467d1ec 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java @@ -65,8 +65,7 @@ public class DebugResolutionListener logger.debug( indent + artifact + " (selected for " + artifact.getScope() + ")" ); } - public void omitForNearer( Artifact omitted, - Artifact kept ) + public void omitForNearer( Artifact omitted, Artifact kept ) { String omittedVersion = omitted.getVersion(); String keptVersion = kept.getVersion(); @@ -82,12 +81,10 @@ public class DebugResolutionListener logger.debug( indent + omitted + " (removed - causes a cycle in the graph)" ); } - public void updateScopeCurrentPom( Artifact artifact, - String ignoredScope ) + public void updateScopeCurrentPom( Artifact artifact, String ignoredScope ) { - logger.debug( - indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope " + artifact.getScope() - + " wins)" ); + 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 ) ) @@ -99,8 +96,7 @@ public class DebugResolutionListener } } - public void updateScope( Artifact artifact, - String scope ) + public void updateScope( Artifact artifact, String scope ) { logger.debug( indent + artifact + " (setting artifactScope to: " + scope + ")" ); } @@ -111,9 +107,7 @@ public class DebugResolutionListener + artifact.getVersionRange() + ")" ); } - public void restrictRange( Artifact artifact, - Artifact replacement, - VersionRange newRange ) + public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange ) { logger.debug( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: " + replacement.getVersionRange() + " to: " + newRange + " )" ); @@ -125,8 +119,7 @@ public class DebugResolutionListener * 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 ) + public void manageArtifact( Artifact artifact, Artifact replacement ) { String msg = indent + artifact; msg += " ("; @@ -142,8 +135,7 @@ public class DebugResolutionListener logger.debug( msg ); } - public void manageArtifactVersion( Artifact artifact, - Artifact replacement ) + public void manageArtifactVersion( Artifact artifact, Artifact replacement ) { // only show msg if a change is actually taking place if ( !replacement.getVersion().equals( artifact.getVersion() ) ) @@ -153,8 +145,7 @@ public class DebugResolutionListener } } - public void manageArtifactScope( Artifact artifact, - Artifact replacement ) + public void manageArtifactScope( Artifact artifact, Artifact replacement ) { // only show msg if a change is actually taking place if ( !replacement.getScope().equals( artifact.getScope() ) ) @@ -164,8 +155,7 @@ public class DebugResolutionListener } } - public void manageArtifactSystemPath( Artifact artifact, - Artifact replacement ) + public void manageArtifactSystemPath( Artifact artifact, Artifact replacement ) { // only show msg if a change is actually taking place if ( !replacement.getScope().equals( artifact.getScope() ) ) diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java index 0ffff12f38..cefb9e28b9 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java @@ -22,7 +22,7 @@ package org.apache.maven.artifact.resolver; import org.codehaus.plexus.component.annotations.Component; @Deprecated -@Component(role=ArtifactCollector.class) +@Component( role = ArtifactCollector.class ) public class DefaultArtifactCollector extends org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector implements ArtifactCollector diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java index 7dbc8dc846..739c2fcf4c 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -69,13 +73,13 @@ import org.codehaus.plexus.util.FileUtils; /** * @author Jason van Zyl */ -@Component(role = ArtifactResolver.class) +@Component( role = ArtifactResolver.class ) public class DefaultArtifactResolver implements ArtifactResolver { - @Requirement + @Requirement private Logger logger; - + @Requirement private WagonManager wagonManager; @@ -93,7 +97,7 @@ public class DefaultArtifactResolver @Requirement private ArtifactMetadataSource source; - + @Requirement private PlexusContainer container; @@ -157,7 +161,8 @@ public class DefaultArtifactResolver } } - public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, TransferListener resolutionListener ) + public void resolve( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository, TransferListener resolutionListener ) throws ArtifactResolutionException, ArtifactNotFoundException { RepositoryRequest request = new DefaultRepositoryRequest(); @@ -167,7 +172,8 @@ public class DefaultArtifactResolver resolve( artifact, request, resolutionListener, false ); } - public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + public void resolveAlways( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { RepositoryRequest request = new DefaultRepositoryRequest(); @@ -177,7 +183,8 @@ public class DefaultArtifactResolver resolve( artifact, request, null, true ); } - private void resolve( Artifact artifact, RepositoryRequest request, TransferListener downloadMonitor, boolean force ) + private void resolve( Artifact artifact, RepositoryRequest request, TransferListener downloadMonitor, + boolean force ) throws ArtifactResolutionException, ArtifactNotFoundException { if ( artifact == null ) @@ -186,28 +193,31 @@ public class DefaultArtifactResolver } File destination; - + 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 ); + 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 ); + 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 ); + throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile, + artifact ); } artifact.setResolved( true ); - + return; } @@ -224,7 +234,7 @@ public class DefaultArtifactResolver // ---------------------------------------------------------------------- artifact = localRepository.find( artifact ); - + if ( artifact.isResolved() ) { return; @@ -241,11 +251,13 @@ public class DefaultArtifactResolver if ( artifact.getRepository() != null ) { // the transformations discovered the artifact - so use it exclusively - wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor, request.isForceUpdate() ); + wagonManager.getArtifact( artifact, artifact.getRepository(), downloadMonitor, + request.isForceUpdate() ); } else { - wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, request.isForceUpdate() ); + wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, + request.isForceUpdate() ); } if ( localRepositoryMaintainer != null ) @@ -285,7 +297,7 @@ public class DefaultArtifactResolver remoteRepositories ); } } - + // 1.0-SNAPSHOT // // 1) pom = 1.0-SNAPSHOT @@ -300,7 +312,7 @@ public class DefaultArtifactResolver // Make a file with a 1.0-SNAPSHOT format File copy = new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) ); - + // if the timestamped version was resolved or the copy doesn't exist then copy a version // of the file like 1.0-SNAPSHOT. Even if there is a timestamped version the non-timestamped // version will be created. @@ -316,7 +328,8 @@ public class DefaultArtifactResolver } catch ( IOException e ) { - throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use: " + e.getMessage(), artifact, remoteRepositories, e ); + throw new ArtifactResolutionException( "Unable to copy resolved artifact for local use: " + + e.getMessage(), artifact, remoteRepositories, e ); } } @@ -372,52 +385,73 @@ public class DefaultArtifactResolver return localCopy; } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, ArtifactRepository localRepository, List remoteRepositories, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, filter ); + return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, + remoteRepositories, source, filter ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, filter, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, List remoteRepositories, ArtifactRepository localRepository, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { return resolveTransitively( artifacts, originatingArtifact, localRepository, remoteRepositories, source, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, List remoteRepositories, ArtifactRepository localRepository, - ArtifactMetadataSource source, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, + ArtifactMetadataSource source, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { return resolveTransitively( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository, remoteRepositories, source, null, listeners ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, filter, listeners, null ); + return resolveTransitively( artifacts, originatingArtifact, managedVersions, localRepository, + remoteRepositories, source, filter, listeners, null ); } - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List listeners, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, List conflictResolvers ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -425,7 +459,7 @@ public class DefaultArtifactResolver .setArtifact( originatingArtifact ) .setResolveRoot( false ) // This is required by the surefire plugin - .setArtifactDependencies( artifacts ) + .setArtifactDependencies( artifacts ) .setManagedVersionMap( managedVersions ) .setLocalRepository( localRepository ) .setRemoteRepositories( remoteRepositories ) @@ -461,10 +495,10 @@ public class DefaultArtifactResolver Set artifacts = request.getArtifactDependencies(); Map managedVersions = request.getManagedVersionMap(); List listeners = request.getListeners(); - ArtifactFilter collectionFilter = request.getCollectionFilter(); + ArtifactFilter collectionFilter = request.getCollectionFilter(); ArtifactFilter resolutionFilter = request.getResolutionFilter(); TransferListener transferListener = TransferListenerAdapter.newAdapter( request.getTransferListener() ); - + //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 ) { @@ -496,9 +530,9 @@ public class DefaultArtifactResolver // 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, transferListener, false ); @@ -573,7 +607,7 @@ public class DefaultArtifactResolver return result; } } - + if ( artifacts == null || artifacts.isEmpty() ) { if ( request.isResolveRoot() ) @@ -581,18 +615,19 @@ public class DefaultArtifactResolver 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() ) + if ( result.hasMetadataResolutionExceptions() || result.hasVersionRangeViolations() + || result.hasCircularDependencyExceptions() ) { return result; } @@ -634,18 +669,19 @@ public class DefaultArtifactResolver // 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 allArtifacts = new LinkedHashSet(); allArtifacts.add( rootArtifact ); allArtifacts.addAll( result.getArtifacts() ); result.setArtifacts( allArtifacts ); - } - + } + return result; } - public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + public void resolve( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { resolve( artifact, remoteRepositories, localRepository, null ); @@ -667,8 +703,9 @@ public class DefaultArtifactResolver private final ArtifactResolutionResult result; - public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact, TransferListener transferListener, - ArtifactResolutionRequest request, ArtifactResolutionResult result ) + public ResolveTask( ClassLoader classLoader, CountDownLatch latch, Artifact artifact, + TransferListener transferListener, ArtifactResolutionRequest request, + ArtifactResolutionResult result ) { this.classLoader = classLoader; this.latch = latch; diff --git a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java index 5f05388708..d262361242 100644 --- a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java +++ b/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java @@ -37,12 +37,12 @@ import java.util.Properties; * @version $Id$ */ @Deprecated -@Component(role=RuntimeInformation.class) +@Component( role = RuntimeInformation.class ) public class DefaultRuntimeInformation implements RuntimeInformation, Initializable { private static final String MAVEN_GROUPID = "org.apache.maven"; - + private static final String MAVEN_PROPERTIES = "META-INF/maven/" + MAVEN_GROUPID + "/maven-core/pom.properties"; private ArtifactVersion applicationVersion; @@ -60,7 +60,7 @@ public class DefaultRuntimeInformation { Properties properties = new Properties(); resourceAsStream = getClass().getClassLoader().getResourceAsStream( MAVEN_PROPERTIES ); - + if ( resourceAsStream == null ) { throw new IllegalStateException( "Unable to find Maven properties in classpath: " + MAVEN_PROPERTIES ); diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java index 0f846b3475..4745749b08 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java @@ -72,7 +72,8 @@ public class DefaultMavenProfilesBuilder } catch ( Exception e ) { - getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment substitution in " + PROFILES_XML_FILE + "." ); + 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 ); } diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java index e8b349ee8f..00fa1613ac 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java @@ -64,8 +64,8 @@ public class DefaultProfileManager private Properties requestProperties; /** - * @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work correctly - * in embedded envirnments. + * @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work + * correctly in embedded envirnments. */ public DefaultProfileManager( PlexusContainer container ) { diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java index e68a9bc1e4..de4ba2ed69 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java @@ -88,11 +88,13 @@ public class FileProfileActivator { if ( logger.isDebugEnabled() ) { - logger.debug( "Failed to interpolate missing file location for profile activator: " + fileString, e ); + 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." ); + logger.warn( "Failed to interpolate missing file location for profile activator: " + fileString + + ". Run in debug mode (-X) for more information." ); } } } diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java index 03a216ead7..dfae95f6f5 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java @@ -44,14 +44,7 @@ public class JdkPrefixProfileActivator { try { - if ( matchJdkVersionRange( jdk ) ) - { - return true; - } - else - { - return false; - } + return matchJdkVersionRange( jdk ); } catch ( InvalidVersionSpecificationException e ) { diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java index 6931d559e6..7fc372cb21 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java @@ -24,9 +24,9 @@ public class ProfileActivationException extends Exception { - private static final long serialVersionUID = -90820222109103638L; + private static final long serialVersionUID = -90820222109103638L; - public ProfileActivationException( String message, Throwable cause ) + public ProfileActivationException( String message, Throwable cause ) { super( message, cause ); } diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java index 2d5efa9a3c..d0a9ecb57b 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java @@ -24,7 +24,7 @@ import org.apache.maven.model.Profile; @Deprecated public interface ProfileActivator { - static final String ROLE = ProfileActivator.class.getName(); + final String ROLE = ProfileActivator.class.getName(); boolean canDetermineActivation( Profile profile ); diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java index c4fc525282..4186415418 100644 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java +++ b/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java @@ -33,12 +33,13 @@ public class SystemPropertyProfileActivator extends DetectedProfileActivator implements Contextualizable { private Properties properties; - - public void contextualize(Context context) throws ContextException + + public void contextualize( Context context ) + throws ContextException { - properties = (Properties)context.get("SystemProperties"); + properties = (Properties) context.get( "SystemProperties" ); } - + protected boolean canDetectActivation( Profile profile ) { return profile.getActivation() != null && profile.getActivation().getProperty() != null; @@ -55,19 +56,19 @@ public class SystemPropertyProfileActivator { 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(); @@ -79,10 +80,10 @@ public class SystemPropertyProfileActivator 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; @@ -95,7 +96,7 @@ public class SystemPropertyProfileActivator else { boolean result = StringUtils.isNotEmpty( sysValue ); - + if ( reverseName ) { return !result; diff --git a/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index 983aa6408d..eec203219f 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -41,7 +45,7 @@ import org.codehaus.plexus.component.annotations.Requirement; /** * @version $Id$ */ -@Component(role = MavenProjectBuilder.class) +@Component( role = MavenProjectBuilder.class ) @Deprecated public class DefaultMavenProjectBuilder implements MavenProjectBuilder @@ -176,7 +180,7 @@ public class DefaultMavenProjectBuilder /** * 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. */ diff --git a/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java b/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java index 44b8c99e87..ad00981acf 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java +++ b/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -37,11 +41,13 @@ public interface MavenProjectBuilder throws ProjectBuildingException; //TODO remote-resources-plugin - MavenProject buildFromRepository( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + MavenProject buildFromRepository( Artifact artifact, List remoteRepositories, + ArtifactRepository localRepository ) throws ProjectBuildingException; //TODO remote-resources-plugin - MavenProject buildFromRepository( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, boolean allowStubModel ) + MavenProject buildFromRepository( Artifact artifact, List 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 diff --git a/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java b/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java index cf9689af82..bd1867f0e1 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java +++ b/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java @@ -40,17 +40,19 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti @Deprecated public final class ProjectUtils { - + private ProjectUtils() { } - public static List buildArtifactRepositories( List repositories, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c ) + public static List buildArtifactRepositories( List repositories, + ArtifactRepositoryFactory artifactRepositoryFactory, + PlexusContainer c ) throws InvalidRepositoryException { List remoteRepositories = new ArrayList(); - + for ( Repository r : repositories ) { remoteRepositories.add( buildArtifactRepository( r, artifactRepositoryFactory, c ) ); @@ -59,13 +61,17 @@ public final class ProjectUtils return remoteRepositories; } - public static ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c ) + 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 ) + public static ArtifactRepository buildArtifactRepository( Repository repo, + ArtifactRepositoryFactory artifactRepositoryFactory, + PlexusContainer c ) throws InvalidRepositoryException { RepositorySystem repositorySystem = rs( c ); diff --git a/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java b/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java index a1ab80a57c..b16e389d62 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java +++ b/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java @@ -48,12 +48,12 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.Xpp3Dom; -@Component(role = ModelInheritanceAssembler.class) +@Component( role = ModelInheritanceAssembler.class ) public class DefaultModelInheritanceAssembler implements ModelInheritanceAssembler { // TODO: Remove this! - @SuppressWarnings("unchecked") + @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 @@ -84,7 +84,7 @@ public class DefaultModelInheritanceAssembler childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() ); } - // Extensions are accumlated + // Extensions are accumulated mergeExtensionLists( childBuild, parentBuild ); if ( childBuild.getDirectory() == null ) @@ -305,7 +305,7 @@ public class DefaultModelInheritanceAssembler } // TODO: Remove this! - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) private void assembleDependencyManagementInheritance( Model child, Model parent ) { DependencyManagement parentDepMgmt = parent.getDependencyManagement(); @@ -536,7 +536,7 @@ public class DefaultModelInheritanceAssembler } // TODO: Remove this! - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) private void assembleDependencyInheritance( Model child, Model parent ) { Map depsMap = new LinkedHashMap(); diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java index 6901bb4078..30b9d34faa 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java @@ -90,9 +90,9 @@ public abstract class AbstractStringBasedModelInterpolator } private PathTranslator pathTranslator; - + private Interpolator interpolator; - + private RecursionInterceptor recursionInterceptor; // for testing. @@ -206,7 +206,7 @@ public abstract class AbstractStringBasedModelInterpolator { List valueSources = createValueSources( model, projectDir, config ); List postProcessors = createPostProcessors( model, projectDir, config ); - + return interpolateInternal( src, valueSources, postProcessors, debug ); } finally @@ -214,8 +214,9 @@ public abstract class AbstractStringBasedModelInterpolator interpolator.clearAnswers(); } } - - protected List createValueSources( final Model model, final File projectDir, final ProjectBuilderConfiguration config ) + + protected List createValueSources( final Model model, final File projectDir, + final ProjectBuilderConfiguration config ) { String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT; @@ -228,7 +229,8 @@ public abstract class AbstractStringBasedModelInterpolator ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false ); ValueSource modelValueSource2 = new ObjectBasedValueSource( model ); - ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){ + ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ) + { public Object getValue( String expression ) { if ( projectDir != null && "basedir".equals( expression ) ) @@ -237,9 +239,9 @@ public abstract class AbstractStringBasedModelInterpolator } return null; } - }, - PROJECT_PREFIXES, true ); - ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ){ + }, PROJECT_PREFIXES, true ); + ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false ) + { public Object getValue( String expression ) { if ( projectDir != null && "baseUri".equals( expression ) ) @@ -248,11 +250,10 @@ public abstract class AbstractStringBasedModelInterpolator } return null; } - }, - PROJECT_PREFIXES, false ); - + }, PROJECT_PREFIXES, false ); + List valueSources = new ArrayList( 9 ); - + // NOTE: Order counts here! valueSources.add( basedirValueSource ); valueSources.add( baseUriValueSource ); @@ -269,10 +270,10 @@ public abstract class AbstractStringBasedModelInterpolator } } ); valueSources.add( modelValueSource2 ); - + return valueSources; } - + protected List createPostProcessors( final Model model, final File projectDir, final ProjectBuilderConfiguration config ) { @@ -282,7 +283,7 @@ public abstract class AbstractStringBasedModelInterpolator projectDir, pathTranslator ) ); } - + @SuppressWarnings("unchecked") protected String interpolateInternal( String src, List valueSources, List postProcessors, boolean debug ) @@ -292,18 +293,18 @@ public abstract class AbstractStringBasedModelInterpolator { return src; } - + Logger logger = getLogger(); String result = src; synchronized( this ) { - + for ( ValueSource vs : valueSources ) { interpolator.addValueSource( vs ); } - + for ( InterpolationPostProcessor postProcessor : postProcessors ) { interpolator.addPostProcessor( postProcessor ); @@ -367,7 +368,7 @@ public abstract class AbstractStringBasedModelInterpolator { interpolator.removeValuesSource( vs ); } - + for ( InterpolationPostProcessor postProcessor : postProcessors ) { interpolator.removePostProcessor( postProcessor ); @@ -377,7 +378,7 @@ public abstract class AbstractStringBasedModelInterpolator return result; } - + protected RecursionInterceptor getRecursionInterceptor() { return recursionInterceptor; @@ -396,7 +397,7 @@ public abstract class AbstractStringBasedModelInterpolator interpolator = createInterpolator(); recursionInterceptor = new PrefixAwareRecursionInterceptor( PROJECT_PREFIXES ); } - + protected final Interpolator getInterpolator() { return interpolator; diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java index 4f08e4842d..5b02880b38 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java @@ -24,7 +24,7 @@ package org.apache.maven.project.interpolation; *

* Created on Feb 2, 2005 */ -@SuppressWarnings("serial") +@SuppressWarnings( "serial" ) @Deprecated public class ModelInterpolationException extends Exception diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java index 25af7d083d..9f8e8ba49c 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java @@ -27,7 +27,7 @@ import java.io.File; import java.util.List; /** - * + * * @version $Id$ */ @Deprecated @@ -40,7 +40,8 @@ public class PathTranslatingPostProcessor private final PathTranslator pathTranslator; private final List expressionPrefixes; - public PathTranslatingPostProcessor( List expressionPrefixes, List unprefixedPathKeys, File projectDir, PathTranslator pathTranslator ) + public PathTranslatingPostProcessor( List expressionPrefixes, List unprefixedPathKeys, + File projectDir, PathTranslator pathTranslator ) { this.expressionPrefixes = expressionPrefixes; this.unprefixedPathKeys = unprefixedPathKeys; @@ -52,7 +53,7 @@ public class PathTranslatingPostProcessor Object value ) { expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true ); - + if ( projectDir != null && value != null && unprefixedPathKeys.contains( expression ) ) { return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir ); diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java index 595fb81f77..da1f84a3cf 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java @@ -63,10 +63,10 @@ public class StringSearchModelInterpolator 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 @@ -75,13 +75,13 @@ public class StringSearchModelInterpolator { List valueSources = createValueSources( model, projectDir, config ); List 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; @@ -97,10 +97,10 @@ public class StringSearchModelInterpolator { StringSearchInterpolator interpolator = new StringSearchInterpolator(); interpolator.setCacheAnswers( true ); - + return interpolator; } - + private static final class InterpolateObjectAction implements PrivilegedAction { @@ -110,7 +110,7 @@ public class StringSearchModelInterpolator private final Logger logger; private final List valueSources; private final List postProcessors; - + public InterpolateObjectAction( Object target, List valueSources, List postProcessors, boolean debugEnabled, StringSearchModelInterpolator modelInterpolator, Logger logger ) @@ -118,20 +118,20 @@ public class StringSearchModelInterpolator this.valueSources = valueSources; this.postProcessors = postProcessors; this.debugEnabled = debugEnabled; - + this.interpolationTargets = new LinkedList(); interpolationTargets.add( target ); - + this.modelInterpolator = modelInterpolator; this.logger = logger; } public ModelInterpolationException run() { - while( !interpolationTargets.isEmpty() ) + while ( !interpolationTargets.isEmpty() ) { Object obj = interpolationTargets.removeFirst(); - + try { traverseObjectWithParents( obj.getClass(), obj ); @@ -141,11 +141,11 @@ public class StringSearchModelInterpolator return e; } } - + return null; } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) private void traverseObjectWithParents( Class cls, Object target ) throws ModelInterpolationException { @@ -153,8 +153,8 @@ public class StringSearchModelInterpolator { return; } - - + + if ( cls.isArray() ) { evaluateArray( target ); @@ -167,7 +167,7 @@ public class StringSearchModelInterpolator fields = cls.getDeclaredFields(); fieldsByClass.put( cls, fields ); } - + for ( int i = 0; i < fields.length; i++ ) { Class type = fields[i].getType(); @@ -185,7 +185,7 @@ public class StringSearchModelInterpolator if ( value != null ) { String interpolated = modelInterpolator.interpolateInternal( value, valueSources, postProcessors, debugEnabled ); - + if ( !interpolated.equals( value ) ) { fields[i].set( target, interpolated ); @@ -202,23 +202,28 @@ public class StringSearchModelInterpolator { c.clear(); } - catch( UnsupportedOperationException e ) + catch ( UnsupportedOperationException e ) { if ( debugEnabled && logger != null ) { - logger.debug( "Skipping interpolation of field: " + fields[i] + " in: " + cls.getName() + "; it is an unmodifiable collection." ); + logger.debug( "Skipping interpolation of field: " + fields[i] + " in: " + + cls.getName() + "; it is an unmodifiable collection." ); } continue; } - + for ( Object value : originalValues ) { if ( value != null ) { - if( String.class == value.getClass() ) + if ( String.class == value.getClass() ) { - String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, debugEnabled ); - + String interpolated = + modelInterpolator.interpolateInternal( (String) value, + valueSources, + postProcessors, + debugEnabled ); + if ( !interpolated.equals( value ) ) { c.add( interpolated ); @@ -257,24 +262,31 @@ public class StringSearchModelInterpolator for ( Map.Entry entry : m.entrySet() ) { Object value = entry.getValue(); - + if ( value != null ) { - if( String.class == value.getClass() ) + if ( String.class == value.getClass() ) { - String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, debugEnabled ); - + String interpolated = + modelInterpolator.interpolateInternal( (String) value, + valueSources, + postProcessors, + debugEnabled ); + if ( !interpolated.equals( value ) ) { try { entry.setValue( interpolated ); } - catch( UnsupportedOperationException e ) + catch ( UnsupportedOperationException e ) { if ( debugEnabled && logger != null ) { - logger.debug( "Skipping interpolation of field: " + fields[i] + " (key: " + entry.getKey() + ") in: " + cls.getName() + "; it is an unmodifiable collection." ); + logger.debug( "Skipping interpolation of field: " + + fields[i] + " (key: " + entry.getKey() + ") in: " + + cls.getName() + + "; it is an unmodifiable collection." ); } continue; } @@ -313,11 +325,13 @@ public class StringSearchModelInterpolator } catch ( IllegalArgumentException e ) { - throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + " on class: " + cls.getName(), e ); + throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + + " on class: " + cls.getName(), e ); } catch ( IllegalAccessException e ) { - throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + " on class: " + cls.getName(), e ); + throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + + " on class: " + cls.getName(), e ); } } finally @@ -326,7 +340,7 @@ public class StringSearchModelInterpolator } } } - + traverseObjectWithParents( cls.getSuperclass(), target ); } } @@ -342,22 +356,22 @@ public class StringSearchModelInterpolator { fieldIsPrimitiveByClass.put( fieldType, Boolean.valueOf( fieldType.isPrimitive() ) ); } - + if ( fieldIsPrimitiveByClass.get( fieldType ).booleanValue() ) { return false; } - + // if ( fieldType.isPrimitive() ) // { // return false; // } - + if ( "parent".equals( field.getName() ) ) { return false; } - + return true; } @@ -365,15 +379,17 @@ public class StringSearchModelInterpolator throws ModelInterpolationException { int len = Array.getLength( target ); - for( int i = 0; i < len; i++ ) + 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 ); - + String interpolated = + modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, + debugEnabled ); + if ( !interpolated.equals( value ) ) { Array.set( target, i, interpolated ); diff --git a/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java b/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java index 48ea41f1aa..c9ec15de6d 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java @@ -21,7 +21,6 @@ package org.apache.maven.project.path; import java.io.File; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.apache.maven.model.Build; @@ -31,7 +30,7 @@ import org.apache.maven.model.Resource; import org.codehaus.plexus.component.annotations.Component; @Deprecated -@Component(role = PathTranslator.class) +@Component( role = PathTranslator.class ) public class DefaultPathTranslator implements PathTranslator { @@ -49,27 +48,21 @@ public class DefaultPathTranslator build.setTestSourceDirectory( alignToBaseDirectory( build.getTestSourceDirectory(), basedir ) ); - for ( Iterator i = build.getResources().iterator(); i.hasNext(); ) + for ( Resource resource : build.getResources() ) { - Resource resource = (Resource) i.next(); - resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); } - for ( Iterator i = build.getTestResources().iterator(); i.hasNext(); ) + for ( Resource resource : build.getTestResources() ) { - Resource resource = (Resource) i.next(); - resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) ); } if ( build.getFilters() != null ) { - List filters = new ArrayList(); - for ( Iterator i = build.getFilters().iterator(); i.hasNext(); ) + List filters = new ArrayList(); + for ( String filter : build.getFilters() ) { - String filter = (String) i.next(); - filters.add( alignToBaseDirectory( filter, basedir ) ); } build.setFilters( filters ); @@ -183,27 +176,21 @@ public class DefaultPathTranslator build.setTestSourceDirectory( unalignFromBaseDirectory( build.getTestSourceDirectory(), basedir ) ); - for ( Iterator i = build.getResources().iterator(); i.hasNext(); ) + for ( Resource resource : build.getResources() ) { - Resource resource = (Resource) i.next(); - resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) ); } - for ( Iterator i = build.getTestResources().iterator(); i.hasNext(); ) + for ( Resource resource : build.getTestResources() ) { - Resource resource = (Resource) i.next(); - resource.setDirectory( unalignFromBaseDirectory( resource.getDirectory(), basedir ) ); } if ( build.getFilters() != null ) { - List filters = new ArrayList(); - for ( Iterator i = build.getFilters().iterator(); i.hasNext(); ) + List filters = new ArrayList(); + for ( String filter : build.getFilters() ) { - String filter = (String) i.next(); - filters.add( unalignFromBaseDirectory( filter, basedir ) ); } build.setFilters( filters ); diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java index 7825808e0d..1feda9f60c 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java +++ b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java @@ -33,7 +33,7 @@ import org.codehaus.plexus.component.annotations.Requirement; * @author Trygve Laugstøl * @version $Id$ */ -@Component(role = ModelValidator.class ) +@Component( role = ModelValidator.class ) @Deprecated public class DefaultModelValidator implements ModelValidator diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java b/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java index 92dc4172d9..a003cb44b8 100644 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java +++ b/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java @@ -31,7 +31,7 @@ public class ModelValidationResult { /** */ - private final static String NEWLINE = System.getProperty( "line.separator" ); + private static final String NEWLINE = System.getProperty( "line.separator" ); /** */ private List messages; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java b/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java index 9529f9f214..67cae5fd65 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java @@ -31,7 +31,7 @@ import org.codehaus.plexus.util.StringUtils; @Component( role = MirrorSelector.class ) public class DefaultMirrorSelector implements MirrorSelector -{ +{ private static final String WILDCARD = "*"; @@ -67,7 +67,7 @@ public class DefaultMirrorSelector * 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. @@ -122,7 +122,7 @@ public class DefaultMirrorSelector /** * Checks the URL to see if this repository refers to an external repository - * + * * @param originalRepository * @return true if external. */ @@ -131,7 +131,8 @@ public class DefaultMirrorSelector try { URL url = new URL( originalRepository.getUrl() ); - return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) || url.getProtocol().equals( "file" ) ); + return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) + || url.getProtocol().equals( "file" ) ); } catch ( MalformedURLException e ) { @@ -147,7 +148,7 @@ public class DefaultMirrorSelector /** * 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, diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java index 4737d7f365..d93a7fc63d 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java @@ -19,7 +19,6 @@ package org.apache.maven.repository; * under the License. */ - /** * * @@ -37,7 +36,7 @@ public class MavenArtifactMetadata String classifier; String type; String scope; - + transient Object datum; public String getGroupId() @@ -109,14 +108,13 @@ public class MavenArtifactMetadata { this.scope = scope; } - + @Override public String toString() { - return getGroupId()+":"+getArtifactId()+":"+getVersion() - +":" + (getClassifier() == null ? "" : getClassifier() ) - +":" + (getType() == null ? DEFAULT_TYPE : getType() ) - ; + return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":" + + ( getClassifier() == null ? "" : getClassifier() ) + ":" + + ( getType() == null ? DEFAULT_TYPE : getType() ); } - + } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java index 2c68de8f68..8948480986 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java @@ -23,7 +23,7 @@ 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. + * This is the main graph data structure used by the RepositorySystem to present tree and graph objects. * * @author Oleg Gusakov * @version $Id$ @@ -36,14 +36,14 @@ public class MetadataGraph /** entry point for tree-like structures */ MetadataGraphNode entry; - + public MetadataGraph( MetadataGraphNode entry ) { this(); - + this.entry = entry; } - + public MetadataGraph() { nodes = new ArrayList( 64 ); @@ -56,38 +56,38 @@ public class MetadataGraph /** * find a node by the GAV (metadata) - * + * * @param md * @return */ public MetadataGraphNode findNode( MavenArtifactMetadata md ) { - for( MetadataGraphNode mgn : nodes ) + for ( MetadataGraphNode mgn : nodes ) { - if( mgn.metadata.equals( md ) ) + if ( mgn.metadata.equals( md ) ) { return mgn; } } MetadataGraphNode node = new MetadataGraphNode( md ); - addNode( node ); + addNode( node ); return node; } - + /** * getter - * + * * @return */ public MetadataGraphNode getEntry() { return entry; } - + /** * getter - * + * * @return */ public Collection getNodes() diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java index bfaeb56e75..38ed9185f6 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java @@ -32,32 +32,32 @@ import java.util.List; public class MetadataGraphNode { /** node payload */ - MavenArtifactMetadata metadata; + MavenArtifactMetadata metadata; /** nodes, incident to this (depend on me) */ List inNodes; - + /** nodes, exident to this (I depend on) */ List exNodes; - + public MetadataGraphNode() { inNodes = new ArrayList(4); exNodes = new ArrayList(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 ); @@ -67,28 +67,36 @@ public class MetadataGraphNode @Override public boolean equals( Object obj ) { - if( obj == null ) + if ( obj == null ) + { return false; + } - if( MetadataGraphNode.class.isAssignableFrom( obj.getClass() ) ) + if ( MetadataGraphNode.class.isAssignableFrom( obj.getClass() ) ) { MetadataGraphNode node2 = (MetadataGraphNode) obj; - - if( node2.metadata == null ) + + if ( node2.metadata == null ) + { return metadata == null; - - return metadata == null ? false: metadata.toString().equals( node2.metadata.toString() ); + } + + return metadata == null ? false : metadata.toString().equals( node2.metadata.toString() ); } else + { return super.equals( obj ); + } } - + @Override public int hashCode() { - if( metadata == null ) + if ( metadata == null ) + { return super.hashCode(); - + } + return metadata.toString().hashCode(); } } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java index a0a1a15bc9..43b354570a 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java @@ -46,32 +46,33 @@ public class MetadataResolutionRequest private List remoteRepositories; - // This is like a filter but overrides all transitive versions + // 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 remoteRepositories ) - { + + public MetadataResolutionRequest( MavenArtifactMetadata md, ArtifactRepository localRepository, + List remoteRepositories ) + { this.mad = md; this.localRepository = localRepository; this.remoteRepositories = remoteRepositories; } - + public MavenArtifactMetadata getArtifactMetadata() { return mad; @@ -141,7 +142,7 @@ public class MetadataResolutionRequest .append( "localRepository: " ).append( localRepository ).append( "\n" ) .append( "remoteRepositories: " ).append( remoteRepositories ).append( "\n" ) ; - + return sb.toString(); } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java index 6efcd07f88..484f3023a5 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java @@ -30,8 +30,6 @@ 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; -import org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector; - /** * @@ -65,11 +63,11 @@ public class MetadataResolutionResult private Set requestedArtifacts; private Set artifacts; - + private MetadataGraph dirtyTree; - + private MetadataGraph resolvedTree; - + private MetadataGraph resolvedGraph; public Artifact getOriginatingArtifact() @@ -235,8 +233,10 @@ public class MetadataResolutionResult public MetadataResolutionResult addError( Exception e ) { - if( exceptions == null ) + if ( exceptions == null ) + { initList( exceptions ); + } exceptions.add( e ); @@ -353,5 +353,5 @@ public class MetadataResolutionResult { this.resolvedTree = resolvedTree; } - + } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java b/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java index 8adc8242dc..993caa74f1 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java @@ -35,25 +35,23 @@ public class VersionNotFoundException extends Exception { private Dependency dependency; - + private String projectId; private File pomFile; - private InvalidVersionSpecificationException cause; + private InvalidVersionSpecificationException cause; - public VersionNotFoundException( String projectId - , Dependency dependency - , File pomFile - , InvalidVersionSpecificationException cause - ) + public VersionNotFoundException( String projectId, Dependency dependency, File pomFile, + InvalidVersionSpecificationException cause ) { - super( projectId+", "+formatLocationInPom( dependency )+ " " +dependency.getVersion()+", pom file "+pomFile, cause ); - + super( projectId + ", " + formatLocationInPom( dependency ) + " " + dependency.getVersion() + ", pom file " + + pomFile, cause ); + this.projectId = projectId; - + this.pomFile = pomFile; - + this.cause = cause; - + this.dependency = dependency; } @@ -81,6 +79,6 @@ public class VersionNotFoundException { return cause; } - - + + } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java index 23323854f2..f7a750b2a1 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java @@ -41,7 +41,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.Logger; -@Component(role=UpdateCheckManager.class) +@Component( role = UpdateCheckManager.class ) public class DefaultUpdateCheckManager extends AbstractLogEnabled implements UpdateCheckManager @@ -390,7 +390,8 @@ public class DefaultUpdateCheckManager } catch ( IOException e ) { - getLogger().debug( "Error releasing shared lock for resolution tracking file: " + touchfile, e ); + getLogger().debug( "Error releasing shared lock for resolution tracking file: " + touchfile, + e ); } } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java index 655fb90b79..a2bfe8c857 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java @@ -53,8 +53,8 @@ import org.codehaus.plexus.util.FileUtils; //TODO: remove the update check manager //TODO: separate into retriever and publisher -//TODO: rmeove hardcoding of checksum logic -@Component(role = WagonManager.class) +//TODO: remove hardcoding of checksum logic +@Component( role = WagonManager.class ) public class DefaultWagonManager implements WagonManager { @@ -74,8 +74,9 @@ public class DefaultWagonManager // // Retriever - // - public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, boolean force ) + // + public void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, + boolean force ) throws TransferFailedException, ResourceDoesNotExistException { String remotePath = repository.pathOf( artifact ); @@ -138,7 +139,8 @@ public class DefaultWagonManager } } - public void getArtifact( Artifact artifact, List remoteRepositories, TransferListener downloadMonitor, boolean force ) + public void getArtifact( Artifact artifact, List remoteRepositories, + TransferListener downloadMonitor, boolean force ) throws TransferFailedException, ResourceDoesNotExistException { TransferFailedException tfe = null; @@ -195,7 +197,8 @@ public class DefaultWagonManager } } - public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy ) + public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination, + String checksumPolicy ) throws TransferFailedException, ResourceDoesNotExistException { String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); @@ -203,7 +206,8 @@ public class DefaultWagonManager getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true ); } - public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy ) + public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository, + File destination, String checksumPolicy ) throws TransferFailedException, ResourceDoesNotExistException { String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata ); @@ -213,13 +217,13 @@ public class DefaultWagonManager /** * 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 ) + private void connectWagon( Wagon wagon, ArtifactRepository repository ) throws ConnectionException, AuthenticationException { if ( repository.getProxy() != null && logger.isDebugEnabled() ) @@ -235,7 +239,8 @@ public class DefaultWagonManager } else if ( repository.getAuthentication() != null ) { - wagon.connect( new Repository( repository.getId(), repository.getUrl() ), authenticationInfo( repository ) ); + wagon.connect( new Repository( repository.getId(), repository.getUrl() ), + authenticationInfo( repository ) ); } else if ( repository.getProxy() != null ) { @@ -245,16 +250,16 @@ public class DefaultWagonManager { 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; + return ai; } - + private ProxyInfo proxyInfo( ArtifactRepository repository ) { ProxyInfo proxyInfo = new ProxyInfo(); @@ -263,11 +268,12 @@ public class DefaultWagonManager proxyInfo.setPort( repository.getProxy().getPort() ); proxyInfo.setNonProxyHosts( repository.getProxy().getNonProxyHosts() ); proxyInfo.setUserName( repository.getProxy().getUserName() ); - proxyInfo.setPassword( repository.getProxy().getPassword() ); + proxyInfo.setPassword( repository.getProxy().getPassword() ); return proxyInfo; } - - public void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force ) + + public void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, + TransferListener downloadMonitor, String checksumPolicy, boolean force ) throws TransferFailedException, ResourceDoesNotExistException { String protocol = repository.getProtocol(); @@ -297,7 +303,7 @@ public class DefaultWagonManager try { connectWagon( wagon, repository ); - + boolean firstRun = true; boolean retry = true; @@ -407,7 +413,8 @@ public class DefaultWagonManager catch ( ResourceDoesNotExistException md5TryException ) { // this was a failed transfer, and we don't want to retry. - handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath, md5TryException ); + handleChecksumFailure( checksumPolicy, "Error retrieving checksum file for " + remotePath, + md5TryException ); } } @@ -470,7 +477,8 @@ public class DefaultWagonManager } catch ( IOException e ) { - throw new TransferFailedException( "Error copying temporary file to the final destination: " + e.getMessage(), e ); + throw new TransferFailedException( "Error copying temporary file to the final destination: " + + e.getMessage(), e ); } } } @@ -478,8 +486,9 @@ public class DefaultWagonManager // // Publisher - // - public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) + // + public void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, + TransferListener downloadMonitor ) throws TransferFailedException { putRemoteFile( deploymentRepository, source, deploymentRepository.pathOf( artifact ), downloadMonitor ); @@ -492,7 +501,8 @@ public class DefaultWagonManager putRemoteFile( repository, source, repository.pathOfRemoteRepositoryMetadata( artifactMetadata ), null ); } - public void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) + public void putRemoteFile( ArtifactRepository repository, File source, String remotePath, + TransferListener downloadMonitor ) throws TransferFailedException { String protocol = repository.getProtocol(); @@ -521,7 +531,7 @@ public class DefaultWagonManager { checksums.put( CHECKSUM_IDS[i], addChecksumObserver( wagon, CHECKSUM_ALGORITHMS[i] ) ); } - + List temporaryFiles = new ArrayList(); try @@ -583,7 +593,7 @@ public class DefaultWagonManager { // MNG-4543 cleanupTemporaryFiles( temporaryFiles ); - + // Remove every checksum listener for ( String aCHECKSUM_IDS : CHECKSUM_IDS ) { @@ -600,7 +610,7 @@ public class DefaultWagonManager } } - private void cleanupTemporaryFiles(List files) + private void cleanupTemporaryFiles( List files ) { for ( File file : files ) { @@ -615,9 +625,9 @@ public class DefaultWagonManager + e.getMessage() ); } } - + } - + private ChecksumObserver addChecksumObserver( Wagon wagon, String algorithm ) throws TransferFailedException { @@ -648,7 +658,8 @@ public class DefaultWagonManager // otherwise it is ignore } - private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination, String remotePath, String checksumFileExtension, Wagon wagon ) + private void verifyChecksum( ChecksumObserver checksumObserver, File destination, File tempDestination, + String remotePath, String checksumFileExtension, Wagon wagon ) throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException { try @@ -666,7 +677,8 @@ public class DefaultWagonManager 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 ) ) + if ( expectedChecksum.regionMatches( true, 0, "MD", 0, 2 ) + || expectedChecksum.regionMatches( true, 0, "SHA", 0, 3 ) ) { int lastSpacePos = expectedChecksum.lastIndexOf( ' ' ); expectedChecksum = expectedChecksum.substring( lastSpacePos + 1 ); @@ -693,7 +705,8 @@ public class DefaultWagonManager } else { - throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum + "'; remote = '" + expectedChecksum + "'" ); + throw new ChecksumFailedException( "Checksum failed on download: local = '" + actualChecksum + + "'; remote = '" + expectedChecksum + "'" ); } } catch ( IOException e ) @@ -732,8 +745,8 @@ public class DefaultWagonManager throws UnsupportedProtocolException { return getWagon( repository.getProtocol() ); - } - + } + @Deprecated public Wagon getWagon( String protocol ) throws UnsupportedProtocolException @@ -758,5 +771,5 @@ public class DefaultWagonManager return wagon; } - + } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java index 277fdca699..c2fd990cd8 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -70,7 +74,7 @@ import org.codehaus.plexus.util.StringUtils; /** * @author Jason van Zyl */ -@Component(role = RepositorySystem.class, hint = "default") +@Component( role = RepositorySystem.class, hint = "default" ) public class LegacyRepositorySystem implements RepositorySystem { @@ -112,7 +116,8 @@ public class LegacyRepositorySystem return artifactFactory.createBuildArtifact( groupId, artifactId, version, packaging ); } - public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) + public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, + String classifier ) { return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); } @@ -134,7 +139,9 @@ public class LegacyRepositorySystem return null; } - Artifact artifact = artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), d.getScope(), d.isOptional() ); + 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 ) { @@ -225,8 +232,11 @@ public class LegacyRepositorySystem 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 ); + 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() @@ -241,7 +251,9 @@ public class LegacyRepositorySystem public ArtifactRepository createLocalRepository( String url, String repositoryId ) throws IOException { - return createRepository( canonicalFileUrl( url ), repositoryId, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, + return createRepository( canonicalFileUrl( url ), repositoryId, true, + ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, + ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); } @@ -278,15 +290,17 @@ public class LegacyRepositorySystem { /* * Probably is not worth it, but here I make sure I restore request - * to its original state. + * to its original state. */ try { - LocalArtifactRepository ideWorkspace = plexus.lookup( LocalArtifactRepository.class, LocalArtifactRepository.IDE_WORKSPACE ); + LocalArtifactRepository ideWorkspace = + plexus.lookup( LocalArtifactRepository.class, LocalArtifactRepository.IDE_WORKSPACE ); if ( request.getLocalRepository() instanceof DelegatingLocalArtifactRepository ) { - DelegatingLocalArtifactRepository delegatingLocalRepository = (DelegatingLocalArtifactRepository) request.getLocalRepository(); + DelegatingLocalArtifactRepository delegatingLocalRepository = + (DelegatingLocalArtifactRepository) request.getLocalRepository(); LocalArtifactRepository orig = delegatingLocalRepository.getIdeWorspace(); @@ -304,7 +318,8 @@ public class LegacyRepositorySystem else { ArtifactRepository localRepository = request.getLocalRepository(); - DelegatingLocalArtifactRepository delegatingLocalRepository = new DelegatingLocalArtifactRepository( localRepository ); + DelegatingLocalArtifactRepository delegatingLocalRepository = + new DelegatingLocalArtifactRepository( localRepository ); delegatingLocalRepository.setIdeWorkspace( ideWorkspace ); request.setLocalRepository( delegatingLocalRepository ); try @@ -370,7 +385,8 @@ public class LegacyRepositorySystem for ( List aliasedRepos : reposByKey.values() ) { - List releasePolicies = new ArrayList( aliasedRepos.size() ); + List releasePolicies = + new ArrayList( aliasedRepos.size() ); for ( ArtifactRepository aliasedRepo : aliasedRepos ) { @@ -379,7 +395,8 @@ public class LegacyRepositorySystem ArtifactRepositoryPolicy releasePolicy = getEffectivePolicy( releasePolicies ); - List snapshotPolicies = new ArrayList( aliasedRepos.size() ); + List snapshotPolicies = + new ArrayList( aliasedRepos.size() ); for ( ArtifactRepository aliasedRepo : aliasedRepos ) { @@ -390,8 +407,9 @@ public class LegacyRepositorySystem ArtifactRepository aliasedRepo = aliasedRepos.get( 0 ); - ArtifactRepository effectiveRepository = - createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(), snapshotPolicy, releasePolicy ); + ArtifactRepository effectiveRepository = + createArtifactRepository( aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(), + snapshotPolicy, releasePolicy ); effectiveRepository.setAuthentication( aliasedRepo.getAuthentication() ); @@ -567,11 +585,12 @@ public class LegacyRepositorySystem // List listeners, // List conflictResolvers ) // ArtifactResolutionResult result = artifactCollector. - + return null; } - public void retrieve( ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener ) + public void retrieve( ArtifactRepository repository, File destination, String remotePath, + ArtifactTransferListener transferListener ) throws ArtifactTransferFailedException, ArtifactDoesNotExistException { try @@ -590,7 +609,8 @@ public class LegacyRepositorySystem } } - public void publish( ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener ) + public void publish( ArtifactRepository repository, File source, String remotePath, + ArtifactTransferListener transferListener ) throws ArtifactTransferFailedException { try @@ -609,7 +629,7 @@ public class LegacyRepositorySystem // public ArtifactRepository buildArtifactRepository( Repository repo ) throws InvalidRepositoryException - { + { if ( repo != null ) { String id = repo.getId(); @@ -629,7 +649,7 @@ public class LegacyRepositorySystem ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() ); ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() ); - + return createArtifactRepository( id, url, layouts.get( repo.getLayout() ), snapshots, releases ); } else @@ -637,24 +657,33 @@ public class LegacyRepositorySystem 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 ); + 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 ) + 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 ); + ArtifactRepository artifactRepository = + artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots, + releases ); return artifactRepository; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java index 4ead3b7544..73ead26958 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -21,7 +25,6 @@ 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.repository.ArtifactTransferListener; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; import org.apache.maven.wagon.UnsupportedProtocolException; @@ -41,26 +44,31 @@ public interface WagonManager // // Retriever - // + // void getArtifact( Artifact artifact, ArtifactRepository repository, TransferListener transferListener, boolean force ) throws TransferFailedException, ResourceDoesNotExistException; - void getArtifact( Artifact artifact, List remoteRepositories, TransferListener transferListener, boolean force ) + void getArtifact( Artifact artifact, List remoteRepositories, + TransferListener transferListener, boolean force ) throws TransferFailedException, ResourceDoesNotExistException; - void getRemoteFile( ArtifactRepository repository, File destination, String remotePath, TransferListener downloadMonitor, String checksumPolicy, boolean force ) + 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 ) + void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination, + String checksumPolicy ) throws TransferFailedException, ResourceDoesNotExistException; - void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn ) + void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, + File file, String checksumPolicyWarn ) throws TransferFailedException, ResourceDoesNotExistException; // // Deployer // - void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor ) + void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository, + TransferListener downloadMonitor ) throws TransferFailedException; void putRemoteFile( ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java index 351005c6ae..b982f91767 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -36,12 +40,15 @@ public interface ArtifactRepositoryFactory ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) throws UnknownRepositoryLayoutException; - ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion ); + ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, + boolean uniqueVersion ); - ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) + 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 ); + ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, + ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); void setGlobalUpdatePolicy( String snapshotPolicy ); diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java index 52303152b9..85a6bc45da 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java @@ -33,7 +33,7 @@ import org.codehaus.plexus.component.annotations.Requirement; /** * @author jdcasey */ -@Component(role=ArtifactRepositoryFactory.class) +@Component( role = ArtifactRepositoryFactory.class ) public class DefaultArtifactRepositoryFactory implements ArtifactRepositoryFactory { @@ -42,7 +42,7 @@ public class DefaultArtifactRepositoryFactory private String globalChecksumPolicy; - @Requirement(role=ArtifactRepositoryLayout.class) + @Requirement( role = ArtifactRepositoryLayout.class ) private Map repositoryLayouts; public ArtifactRepositoryLayout getLayout( String layoutId ) @@ -51,9 +51,7 @@ public class DefaultArtifactRepositoryFactory return repositoryLayouts.get( layoutId ); } - public ArtifactRepository createDeploymentArtifactRepository( String id, - String url, - String layoutId, + public ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion ) throws UnknownRepositoryLayoutException { @@ -64,9 +62,7 @@ public class DefaultArtifactRepositoryFactory return createDeploymentArtifactRepository( id, url, layout, uniqueVersion ); } - private void checkLayout( String repositoryId, - String layoutId, - ArtifactRepositoryLayout layout ) + private void checkLayout( String repositoryId, String layoutId, ArtifactRepositoryLayout layout ) throws UnknownRepositoryLayoutException { if ( layout == null ) @@ -75,17 +71,14 @@ public class DefaultArtifactRepositoryFactory } } - public ArtifactRepository createDeploymentArtifactRepository( String id, - String url, + 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, + public ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) throws UnknownRepositoryLayoutException @@ -97,8 +90,7 @@ public class DefaultArtifactRepositoryFactory return createArtifactRepository( id, url, layout, snapshots, releases ); } - public ArtifactRepository createArtifactRepository( String id, - String url, + public ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java index 1a76f667d2..90e85c5d85 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java @@ -59,7 +59,7 @@ import org.codehaus.plexus.logging.Logger; * @author Brett Porter * @author Jason van Zyl */ -@Component(role=LegacyArtifactCollector.class) +@Component( role = LegacyArtifactCollector.class ) public class DefaultLegacyArtifactCollector implements LegacyArtifactCollector { @@ -87,13 +87,10 @@ public class DefaultLegacyArtifactCollector } } - public ArtifactResolutionResult collect( Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, + ArtifactMetadataSource source, ArtifactFilter filter, List listeners, List conflictResolvers ) { @@ -105,12 +102,9 @@ public class DefaultLegacyArtifactCollector conflictResolvers ); } - public ArtifactResolutionResult collect( Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactResolutionRequest repositoryRequest, - ArtifactMetadataSource source, - ArtifactFilter filter, + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactResolutionRequest repositoryRequest, + ArtifactMetadataSource source, ArtifactFilter filter, List listeners, List conflictResolvers ) { @@ -148,7 +142,8 @@ public class DefaultLegacyArtifactCollector try { - recurse( result, root, resolvedArtifacts, versionMap, repositoryRequest, source, filter, listeners, conflictResolvers ); + recurse( result, root, resolvedArtifacts, versionMap, repositoryRequest, source, filter, listeners, + conflictResolvers ); } catch ( CyclicDependencyException e ) { @@ -187,7 +182,7 @@ public class DefaultLegacyArtifactCollector artifact.setDependencyTrail( node.getDependencyTrail() ); set.add( node ); - + // This is required right now. result.addArtifact( artifact ); } @@ -242,15 +237,10 @@ public class DefaultLegacyArtifactCollector return versionMap; } - private void recurse( ArtifactResolutionResult result, - ResolutionNode node, - Map> resolvedArtifacts, - ManagedVersionMap managedVersions, - ArtifactResolutionRequest request, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers ) + private void recurse( ArtifactResolutionResult result, ResolutionNode node, + Map> resolvedArtifacts, ManagedVersionMap managedVersions, + ArtifactResolutionRequest request, ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, List conflictResolvers ) throws ArtifactResolutionException { fireEvent( ResolutionListener.TEST_ARTIFACT, listeners, node ); @@ -324,13 +314,17 @@ public class DefaultLegacyArtifactCollector catch ( ArtifactMetadataRetrievalException e ) { resetArtifact.setDependencyTrail( node.getDependencyTrail() ); - throw new ArtifactResolutionException( "Unable to get dependency information: " + e.getMessage(), resetArtifact, request.getRemoteRepositories(), e ); + 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() ); + ArtifactVersion selectedVersion = + resetArtifact.getVersionRange().matchVersion( resetArtifact.getAvailableVersions() ); if ( selectedVersion != null ) { resetArtifact.selectVersion( selectedVersion.toString() ); @@ -359,15 +353,19 @@ public class DefaultLegacyArtifactCollector 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() ); + 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() ) ); + result.addVersionRangeViolation( new ArtifactResolutionException( + "Conflict resolver returned unknown resolution node: ", + resolved.getArtifact() ) ); } // TODO: should this be part of mediation? @@ -513,8 +511,9 @@ public class DefaultLegacyArtifactCollector { throw new OverConstrainedVersionException( "No versions are present in the repository for the artifact with a range " - + versionRange, artifact, - childRemoteRepositories ); + + versionRange, + artifact, + childRemoteRepositories ); } throw new OverConstrainedVersionException( "Couldn't find a version in " @@ -543,7 +542,7 @@ public class DefaultLegacyArtifactCollector if ( parentArtifact != null && parentArtifact.getDependencyFilter() != null && !parentArtifact.getDependencyFilter().include( artifact ) ) { - // MNG-3769: the [probably relocated] artifact is excluded. + // 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 @@ -601,7 +600,8 @@ public class DefaultLegacyArtifactCollector } } - private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions, List listeners ) + private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions, + List listeners ) { Artifact artifact = (Artifact) managedVersions.get( node.getKey() ); @@ -649,7 +649,8 @@ public class DefaultLegacyArtifactCollector /* 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() ) ) ) + && ( Artifact.SCOPE_TEST.equals( nearestArtifact.getScope() ) + || Artifact.SCOPE_PROVIDED.equals( nearestArtifact.getScope() ) ) ) { updateScope = true; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java index 5e5738f0c1..43886099da 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java @@ -26,7 +26,6 @@ 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.repository.RepositoryRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ResolutionListener; @@ -44,24 +43,15 @@ import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; public interface LegacyArtifactCollector { - ArtifactResolutionResult collect( Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactResolutionRequest repositoryRequest, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, + ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, Map managedVersions, + ArtifactResolutionRequest repositoryRequest, ArtifactMetadataSource source, + ArtifactFilter filter, List listeners, List conflictResolvers ); - ArtifactResolutionResult collect( Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers ); + ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, Map managedVersions, + ArtifactRepository localRepository, List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, List conflictResolvers ); // used by maven-dependency-tree and maven-dependency-plugin @Deprecated diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java index 19aa5375ad..7ac3b18b86 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java @@ -30,7 +30,7 @@ import org.apache.maven.artifact.resolver.ResolutionNode; */ public interface ConflictResolver { - static String ROLE = ConflictResolver.class.getName(); + String ROLE = ConflictResolver.class.getName(); /** * Determines which of the specified versions of an artifact to use when there are conflicting declarations. @@ -41,6 +41,5 @@ public interface ConflictResolver * this conflict cannot be resolved * @since 3.0 */ - ResolutionNode resolveConflict( ResolutionNode node1, - ResolutionNode node2 ); + ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ); } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java index 8845fc214f..7402094f60 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java @@ -1,7 +1,5 @@ package org.apache.maven.repository.legacy.resolver.conflict; -import org.codehaus.plexus.component.annotations.Component; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -21,6 +19,8 @@ import org.codehaus.plexus.component.annotations.Component; * under the License. */ +import org.codehaus.plexus.component.annotations.Component; + /** * The default conflict resolver that delegates to the nearest strategy. * @@ -30,7 +30,7 @@ import org.codehaus.plexus.component.annotations.Component; * @deprecated As of 3.0, use a specific implementation instead, e.g. {@link NearestConflictResolver} */ @Deprecated -@Component(role=ConflictResolver.class) +@Component( role = ConflictResolver.class ) public class DefaultConflictResolver extends NearestConflictResolver { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java index bbb7f843c7..7d29420cb2 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java @@ -36,17 +36,16 @@ import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; * @todo you don't need the container in here with the active maps (jvz). * @since 3.0 */ -@Component(role=ConflictResolverFactory.class) +@Component( role = ConflictResolverFactory.class ) public class DefaultConflictResolverFactory - implements ConflictResolverFactory, - Contextualizable + implements ConflictResolverFactory, Contextualizable { // fields ----------------------------------------------------------------- /** * The plexus container used to obtain instances from. */ - @Requirement + @Requirement private PlexusContainer container; // ConflictResolverFactory methods ---------------------------------------- diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java index ec3e7e06b6..667195a33d 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java @@ -30,7 +30,7 @@ import org.codehaus.plexus.component.annotations.Component; * @version $Id$ * @since 3.0 */ -@Component(role=ConflictResolver.class, hint="farthest") +@Component( role = ConflictResolver.class, hint = "farthest" ) public class FarthestConflictResolver implements ConflictResolver { @@ -41,8 +41,7 @@ public class FarthestConflictResolver * org.apache.maven.artifact.resolver.ResolutionNode) */ - public ResolutionNode resolveConflict( ResolutionNode node1, - ResolutionNode node2 ) + public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) { return node1.getDepth() >= node2.getDepth() ? node1 : node2; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java index ba2e9b0ef2..419ce8436c 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java @@ -31,7 +31,7 @@ import org.codehaus.plexus.component.annotations.Component; * @version $Id$ * @since 3.0 */ -@Component(role=ConflictResolver.class, hint="nearest") +@Component( role = ConflictResolver.class, hint = "nearest" ) public class NearestConflictResolver implements ConflictResolver { @@ -42,8 +42,7 @@ public class NearestConflictResolver * org.apache.maven.artifact.resolver.ResolutionNode) */ - public ResolutionNode resolveConflict( ResolutionNode node1, - ResolutionNode node2 ) + public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) { return node1.getDepth() <= node2.getDepth() ? node1 : node2; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java index 455ce162fd..8b42378c27 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java @@ -33,7 +33,7 @@ import org.codehaus.plexus.component.annotations.Component; * @see ArtifactVersion#compareTo(Object) * @since 3.0 */ -@Component(role=ConflictResolver.class, hint="newest") +@Component( role = ConflictResolver.class, hint = "newest" ) public class NewestConflictResolver implements ConflictResolver { @@ -44,8 +44,7 @@ public class NewestConflictResolver * org.apache.maven.artifact.resolver.ResolutionNode) */ - public ResolutionNode resolveConflict( ResolutionNode node1, - ResolutionNode node2 ) + public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) { try { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java index 9d49dd82ba..b1644417aa 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java @@ -33,7 +33,7 @@ import org.codehaus.plexus.component.annotations.Component; * @see ArtifactVersion#compareTo(Object) * @since 3.0 */ -@Component(role=ConflictResolver.class, hint="oldest") +@Component( role = ConflictResolver.class, hint = "oldest" ) public class OldestConflictResolver implements ConflictResolver { @@ -44,8 +44,7 @@ public class OldestConflictResolver * org.apache.maven.artifact.resolver.ResolutionNode) */ - public ResolutionNode resolveConflict( ResolutionNode node1, - ResolutionNode node2 ) + public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 ) { try { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java index e8876e8373..9137261532 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java @@ -36,7 +36,7 @@ public interface ArtifactTransformationManager /** * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occured the original artifact is returned. + * transformation has occurred the original artifact is returned. * * @param artifact Artifact to be transformed. * @param request the repositories to check @@ -47,18 +47,19 @@ public interface ArtifactTransformationManager /** * Take in a artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occured the original artifact is returned. + * 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 remoteRepositories, ArtifactRepository localRepository ) + void transformForResolve( Artifact artifact, List 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 occured the original artifact is returned. + * transformation has occurred the original artifact is returned. * * @param artifact Artifact to be transformed. * @param localRepository the local repository it will be stored in @@ -67,14 +68,15 @@ public interface ArtifactTransformationManager throws ArtifactInstallationException; /** - * Take in a artifact and return the transformed artifact for distributing toa remote repository. If no - * transformation has occured the original artifact is returned. + * 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 ) + void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, + ArtifactRepository localRepository ) throws ArtifactDeploymentException; List getArtifactTransformations(); diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java index ed9fa0ebe4..e9b1afbce6 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java @@ -34,11 +34,11 @@ import org.codehaus.plexus.component.annotations.Requirement; /** * @author Jason van Zyl */ -@Component(role=ArtifactTransformationManager.class) +@Component( role = ArtifactTransformationManager.class ) public class DefaultArtifactTransformationManager implements ArtifactTransformationManager { - @Requirement(role=ArtifactTransformation.class, hints={"release", "latest", "snapshot"}) + @Requirement( role = ArtifactTransformation.class, hints = { "release", "latest", "snapshot" } ) private List artifactTransformations; public void transformForResolve( Artifact artifact, RepositoryRequest request ) @@ -50,8 +50,7 @@ public class DefaultArtifactTransformationManager } } - public void transformForResolve( Artifact artifact, - List remoteRepositories, + public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -61,8 +60,7 @@ public class DefaultArtifactTransformationManager } } - public void transformForInstall( Artifact artifact, - ArtifactRepository localRepository ) + public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) throws ArtifactInstallationException { for ( ArtifactTransformation transform : artifactTransformations ) @@ -71,8 +69,7 @@ public class DefaultArtifactTransformationManager } } - public void transformForDeployment( Artifact artifact, - ArtifactRepository remoteRepository, + public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) throws ArtifactDeploymentException { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java index 616a86545e..7b0e85130a 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java @@ -28,7 +28,7 @@ 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") +@Component( role = ArtifactTransformation.class, hint = "latest" ) public class LatestArtifactTransformation extends AbstractVersionTransformation { @@ -56,21 +56,18 @@ public class LatestArtifactTransformation } } - public void transformForInstall( Artifact artifact, - ArtifactRepository localRepository ) + public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) { // metadata is added via addPluginArtifactMetadata } - public void transformForDeployment( Artifact artifact, - ArtifactRepository remoteRepository, + public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) { // metadata is added via addPluginArtifactMetadata } - protected String constructVersion( Versioning versioning, - String baseVersion ) + protected String constructVersion( Versioning versioning, String baseVersion ) { return versioning.getLatest(); } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java index 696620d48f..95f7ddb5f1 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java @@ -36,7 +36,7 @@ import org.codehaus.plexus.component.annotations.Component; * @author Brett Porter * @version $Id$ */ -@Component(role=ArtifactTransformation.class, hint="release") +@Component( role = ArtifactTransformation.class, hint = "release" ) public class ReleaseArtifactTransformation extends AbstractVersionTransformation { @@ -65,16 +65,14 @@ public class ReleaseArtifactTransformation } } - public void transformForInstall( Artifact artifact, - ArtifactRepository localRepository ) + public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) { ArtifactMetadata metadata = createMetadata( artifact ); artifact.addMetadata( metadata ); } - public void transformForDeployment( Artifact artifact, - ArtifactRepository remoteRepository, + public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) { ArtifactMetadata metadata = createMetadata( artifact ); @@ -96,8 +94,7 @@ public class ReleaseArtifactTransformation return new ArtifactRepositoryMetadata( artifact, versioning ); } - protected String constructVersion( Versioning versioning, - String baseVersion ) + protected String constructVersion( Versioning versioning, String baseVersion ) { return versioning.getRelease(); } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java index 049f701f49..d68e8a4db0 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java @@ -43,7 +43,7 @@ import org.codehaus.plexus.util.StringUtils; * @author Michal Maczka * @version $Id$ */ -@Component(role=ArtifactTransformation.class, hint="snapshot") +@Component( role = ArtifactTransformation.class, hint = "snapshot" ) public class SnapshotTransformation extends AbstractVersionTransformation { @@ -71,8 +71,7 @@ public class SnapshotTransformation } } - public void transformForInstall( Artifact artifact, - ArtifactRepository localRepository ) + public void transformForInstall( Artifact artifact, ArtifactRepository localRepository ) { if ( artifact.isSnapshot() ) { @@ -84,8 +83,7 @@ public class SnapshotTransformation } } - public void transformForDeployment( Artifact artifact, - ArtifactRepository remoteRepository, + public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository ) throws ArtifactDeploymentException { @@ -126,8 +124,7 @@ public class SnapshotTransformation return deploymentTimestamp; } - protected String constructVersion( Versioning versioning, - String baseVersion ) + protected String constructVersion( Versioning versioning, String baseVersion ) { String version = null; Snapshot snapshot = versioning.getSnapshot(); @@ -146,8 +143,7 @@ public class SnapshotTransformation return version; } - private int resolveLatestSnapshotBuildNumber( Artifact artifact, - ArtifactRepository localRepository, + private int resolveLatestSnapshotBuildNumber( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) throws RepositoryMetadataResolutionException { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java index cc99ccaf3c..00749470d5 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java @@ -1,5 +1,24 @@ 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; @@ -7,15 +26,15 @@ import org.apache.maven.artifact.ArtifactScopeEnum; /** * Artifact Metadata that is resolved independent of Artifact itself. - * + * * @author Oleg Gusakov * */ public class ArtifactMetadata { - /** - * standard glorified artifact coordinates - */ + /** + * standard glorified artifact coordinates + */ protected String groupId; protected String artifactId; protected String version; @@ -23,12 +42,12 @@ public class ArtifactMetadata protected ArtifactScopeEnum artifactScope; protected String classifier; - /** + /** * explanation: why this MD was chosen over it's siblings - * in the resulting structure (classpath for now) + * in the resulting structure (classpath for now) */ protected String why; - + /** dependencies of the artifact behind this metadata */ protected Collection dependencies; @@ -37,7 +56,7 @@ public class ArtifactMetadata /** is metadata found anywhere */ protected boolean resolved = false; - + /** does the actual artifact for this metadata exists */ protected boolean artifactExists = false; /** artifact URI */ @@ -45,93 +64,69 @@ public class ArtifactMetadata /** 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 ); - } + 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 ) + + // ------------------------------------------------------------------ + public ArtifactMetadata( String groupId, String name, String version ) { this( groupId, name, version, null ); } //------------------------------------------------------------------ - public ArtifactMetadata( String groupId, - String name, - String version, - String type ) + 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 ) + 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, + 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 - ) + 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 - ) + 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; @@ -145,29 +140,12 @@ public class ArtifactMetadata 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 - ) + 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 - ); + this( groupId, name, version, type, + scopeString == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scopeString ), + classifier, artifactUri, why, resolved, error ); } //------------------------------------------------------------------ @@ -265,10 +243,7 @@ public class ArtifactMetadata public void setScope( String scope ) { - this.artifactScope = scope == null - ? ArtifactScopeEnum.DEFAULT_SCOPE - : ArtifactScopeEnum.valueOf( scope ) - ; + this.artifactScope = scope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf( scope ); } public String getClassifier() @@ -310,62 +285,62 @@ public class ArtifactMetadata { return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope; } - + public boolean isArtifactExists() - { - return artifactExists; - } + { + return artifactExists; + } + + public void setArtifactExists(boolean artifactExists) + { + this.artifactExists = artifactExists; + } + - public void setArtifactExists(boolean artifactExists) - { - this.artifactExists = artifactExists; - } - - public Collection getDependencies() - { - return dependencies; - } + { + return dependencies; + } - public void setDependencies(Collection dependencies) - { - this.dependencies = dependencies; - } + public void setDependencies(Collection dependencies) + { + this.dependencies = dependencies; + } - public String getArtifactUri() - { - return artifactUri; - } + public String getArtifactUri() + { + return artifactUri; + } + + public void setArtifactUri(String artifactUri) + { + this.artifactUri = 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 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/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java index 927506e39b..593daac9c7 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java @@ -34,7 +34,7 @@ import org.apache.maven.artifact.ArtifactScopeEnum; public class ClasspathContainer implements Iterable { - private List classpath; + private List classpath; private ArtifactScopeEnum scope; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java index 1f1af4aaf9..eece413302 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java @@ -1,11 +1,29 @@ 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 Oleg Gusakov * */ @@ -16,15 +34,13 @@ public interface ClasspathTransformation /** * 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 + * @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; + ClasspathContainer transform( MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve ) + throws MetadataGraphTransformationException; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java index a6ac824508..f3f459a281 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java @@ -34,9 +34,9 @@ import org.codehaus.plexus.component.annotations.Requirement; * @author Oleg Gusakov * */ -@Component(role=ClasspathTransformation.class) +@Component( role = ClasspathTransformation.class ) public class DefaultClasspathTransformation -implements ClasspathTransformation + implements ClasspathTransformation { @Requirement GraphConflictResolver conflictResolver; @@ -136,7 +136,7 @@ implements ClasspathTransformation // } // ); - List exits = graph.getExcidentEdges(node); + List exits = graph.getExcidentEdges( node ); if ( exits != null && exits.size() > 0 ) { diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java index 320bbd85cb..14bfe3553d 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java @@ -29,20 +29,20 @@ import org.codehaus.plexus.component.annotations.Configuration; * * @version $Id$ */ -@Component(role=GraphConflictResolutionPolicy.class) +@Component( role = GraphConflictResolutionPolicy.class ) public class DefaultGraphConflictResolutionPolicy -implements GraphConflictResolutionPolicy + implements GraphConflictResolutionPolicy { /** * artifact, closer to the entry point, is selected */ - @Configuration(name="closer-first", value="true") + @Configuration( name = "closer-first", value = "true" ) private boolean closerFirst = true; /** * newer artifact is selected */ - @Configuration(name="newer-first", value="true") + @Configuration( name = "newer-first", value = "true" ) private boolean newerFirst = true; public MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java index caf41a426a..f0d3f4b8cf 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java @@ -29,18 +29,18 @@ import org.codehaus.plexus.component.annotations.Requirement; /** * Default conflict resolver.Implements closer newer first policy by default, but could be configured via plexus - * + * * @author Oleg Gusakov * @version $Id$ */ -@Component(role=GraphConflictResolver.class) +@Component( role = GraphConflictResolver.class ) public class DefaultGraphConflictResolver implements GraphConflictResolver { /** * artifact, closer to the entry point, is selected */ - @Requirement(role=GraphConflictResolutionPolicy.class) + @Requirement( role = GraphConflictResolutionPolicy.class ) protected GraphConflictResolutionPolicy policy; // ------------------------------------------------------------------------------------- @@ -49,20 +49,30 @@ public class DefaultGraphConflictResolver 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 vertices = graph.getVertices(); @@ -70,7 +80,9 @@ public class DefaultGraphConflictResolver { // edge case - single vertex graph if ( vertices.size() == 1 ) + { return new MetadataGraph( entry ); + } final ArtifactScopeEnum requestedScope = ArtifactScopeEnum.checkScope( scope ); @@ -138,7 +150,9 @@ public class DefaultGraphConflictResolver private MetadataGraph findLinkedSubgraph( MetadataGraph g ) { if ( g.getVertices().size() == 1 ) + { return g; + } List visited = new ArrayList( g.getVertices().size() ); visit( g.getEntry(), visited, g ); @@ -149,11 +163,15 @@ public class DefaultGraphConflictResolver for ( MetadataGraphVertex v : g.getVertices() ) { if ( !visited.contains( v ) ) + { dropList.add( v ); + } } if ( dropList.size() < 1 ) + { return g; + } // now - drop vertices TreeSet vertices = g.getVertices(); @@ -169,7 +187,9 @@ public class DefaultGraphConflictResolver private void visit( MetadataGraphVertex from, List visited, MetadataGraph graph ) { if ( visited.contains( from ) ) + { return; + } visited.add( from ); @@ -185,16 +205,21 @@ public class DefaultGraphConflictResolver } // ------------------------------------------------------------------------------------- - private MetadataGraphEdge cleanEdges( MetadataGraphVertex v, List edges, ArtifactScopeEnum scope ) + private MetadataGraphEdge cleanEdges( MetadataGraphVertex v, List 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; } @@ -204,12 +229,18 @@ public class DefaultGraphConflictResolver 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/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java index 1888a4ddd0..62f4c18a4c 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java @@ -1,34 +1,52 @@ package org.apache.maven.repository.metadata; -/** - * - * @author Oleg Gusakov - * - * @version $Id$ +/* + * 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 + * + * @version $Id$ + */ public class GraphConflictResolutionException -extends Exception + extends Exception { - private static final long serialVersionUID = 2677613140287940255L; + private static final long serialVersionUID = 2677613140287940255L; - public GraphConflictResolutionException() - { - } + public GraphConflictResolutionException() + { + } - public GraphConflictResolutionException(String message) - { - super(message); - } + public GraphConflictResolutionException( String message ) + { + super( message ); + } - public GraphConflictResolutionException(Throwable cause) - { - super(cause); - } + public GraphConflictResolutionException( Throwable cause ) + { + super( cause ); + } - public GraphConflictResolutionException(String message, Throwable cause) - { - super(message, cause); - } + public GraphConflictResolutionException( String message, Throwable cause ) + { + super( message, cause ); + } } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java index e16a9d0690..f394a55d08 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java @@ -1,21 +1,36 @@ 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 + * MetadataGraph edge selection policy. Complements * GraphConflictResolver by being injected into it - * + * * @author Oleg Gusakov - * + * * @version $Id$ */ public interface GraphConflictResolutionPolicy { - static String ROLE = GraphConflictResolutionPolicy.class.getName(); + String ROLE = GraphConflictResolutionPolicy.class.getName(); - public MetadataGraphEdge apply( - MetadataGraphEdge e1 - , MetadataGraphEdge e2 - ); + MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 ); } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java index 9eeca9bd59..594fff0544 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java @@ -22,7 +22,7 @@ package org.apache.maven.repository.metadata; import org.apache.maven.artifact.ArtifactScopeEnum; /** - * Resolves conflicts in the supplied dependency graph. + * Resolves conflicts in the supplied dependency graph. * Different implementations will implement different conflict resolution policies. * * @author Oleg Gusakov @@ -30,20 +30,20 @@ import org.apache.maven.artifact.ArtifactScopeEnum; */ public interface GraphConflictResolver { - static String ROLE = GraphConflictResolver.class.getName(); + 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 + * between any two nodes, if multiple exists. Uses scope relationships, defined * in ArtifactScopeEnum * * @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; + throws GraphConflictResolutionException; } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java index f6900fa8c7..d898739275 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java @@ -33,7 +33,6 @@ import org.apache.maven.artifact.ArtifactScopeEnum; * @author Oleg Gusakov * */ - public class MetadataGraph { public static final int DEFAULT_VERTICES = 32; @@ -79,7 +78,7 @@ public class MetadataGraph * construct a single vertex */ public MetadataGraph( MetadataGraphVertex entry ) - throws MetadataResolutionException + throws MetadataResolutionException { checkVertex( entry ); checkVertices( 1 ); @@ -95,7 +94,7 @@ public class MetadataGraph * construct graph from a "dirty" tree */ public MetadataGraph( MetadataTreeNode tree ) - throws MetadataResolutionException + throws MetadataResolutionException { this( tree, false, false ); } @@ -109,7 +108,7 @@ public class MetadataGraph * */ public MetadataGraph( MetadataTreeNode tree, boolean versionedVertices, boolean scopedVertices ) - throws MetadataResolutionException + throws MetadataResolutionException { if ( tree == null ) { @@ -129,12 +128,8 @@ public class MetadataGraph processTreeNodes( null, tree, 0, 0 ); } //------------------------------------------------------------------------ - private void processTreeNodes( MetadataGraphVertex parentVertex - , MetadataTreeNode node - , int depth - , int pomOrder - ) - throws MetadataResolutionException + private void processTreeNodes( MetadataGraphVertex parentVertex, MetadataTreeNode node, int depth, int pomOrder ) + throws MetadataResolutionException { if ( node == null ) { @@ -150,7 +145,8 @@ public class MetadataGraph 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 ); + MetadataGraphEdge e = + new MetadataGraphEdge( md.version, md.resolved, md.artifactScope, md.artifactUri, depth, pomOrder ); addEdge( parentVertex, vertex, e ); } else @@ -275,7 +271,7 @@ public class MetadataGraph } //------------------------------------------------------------------------ private static void checkVertex( MetadataGraphVertex v ) - throws MetadataResolutionException + throws MetadataResolutionException { if ( v == null ) { @@ -288,7 +284,7 @@ public class MetadataGraph } //------------------------------------------------------------------------ private static void checkEdge( MetadataGraphEdge e ) - throws MetadataResolutionException + throws MetadataResolutionException { if ( e == null ) { @@ -318,7 +314,7 @@ public class MetadataGraph } //------------------------------------------------------------------------ public MetadataGraph addEdge( MetadataGraphVertex vFrom, MetadataGraphVertex vTo, MetadataGraphEdge e ) - throws MetadataResolutionException + throws MetadataResolutionException { checkVertex( vFrom ); checkVertex( vTo ); diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java index 506ce17d29..4a50b207b7 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java @@ -1,12 +1,30 @@ 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 + * metadata graph edge - combination of version, scope and depth define * an edge in the graph - * + * * @author Oleg Gusakov * */ @@ -19,24 +37,19 @@ public class MetadataGraphEdge 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 - ) + public MetadataGraphEdge( String version, boolean resolved, ArtifactScopeEnum scope, String artifactUri, int depth, + int pomOrder ) { super(); this.version = version; @@ -50,16 +63,13 @@ public class MetadataGraphEdge /** * helper for equals */ - private static boolean objectsEqual( Object o1, - Object o2 ) + private static boolean objectsEqual( Object o1, Object o2 ) { if ( o1 == null && o2 == null ) { return true; } - if ( ( o1 == null && o2 != null ) - || ( o1 != null && o2 == null ) - ) + if ( ( o1 == null && o2 != null ) || ( o1 != null && o2 == null ) ) { return false; } @@ -76,14 +86,10 @@ public class MetadataGraphEdge 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 objectsEqual( version, e.version ) + && ArtifactScopeEnum.checkScope( scope ).getScope().equals( ArtifactScopeEnum.checkScope( e.scope ).getScope() ) + && depth == e.depth; } return false; } @@ -124,57 +130,60 @@ public class MetadataGraphEdge return resolved; } - public void setResolved(boolean resolved) - { - this.resolved = resolved; - } + public void setResolved( boolean resolved ) + { + this.resolved = resolved; + } - public int getPomOrder() - { - return pomOrder; - } + public int getPomOrder() + { + return pomOrder; + } - public void setPomOrder(int pomOrder) - { - this.pomOrder = 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; + } - 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+"]" - ; - } + 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/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java index af1c8d65d4..16a34a8c13 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java @@ -1,5 +1,24 @@ 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 Oleg Gusakov * @@ -9,23 +28,23 @@ public class MetadataGraphTransformationException { private static final long serialVersionUID = -4029897098314019152L; - public MetadataGraphTransformationException() - { - } + public MetadataGraphTransformationException() + { + } - public MetadataGraphTransformationException(String message) - { - super(message); - } + public MetadataGraphTransformationException( String message ) + { + super( message ); + } - public MetadataGraphTransformationException(Throwable cause) - { - super(cause); - } + public MetadataGraphTransformationException( Throwable cause ) + { + super( cause ); + } - public MetadataGraphTransformationException(String message, Throwable cause) - { - super(message, cause); - } + public MetadataGraphTransformationException( String message, Throwable cause ) + { + super( message, cause ); + } } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java index 6115a7038b..770ae79d2f 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java @@ -1,13 +1,32 @@ 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 { @@ -22,33 +41,31 @@ public class MetadataResolution this.artifactMetadata = artifactMetadata; } //------------------------------------------------------------------- - public MetadataResolution( ArtifactMetadata artifactMetadata, - Collection metadataRepositories ) + public MetadataResolution( ArtifactMetadata artifactMetadata, Collection metadataRepositories ) { - this( artifactMetadata ); + this( artifactMetadata ); this.metadataRepositories = metadataRepositories; } //------------------------------------------------------------------- - public Collection getMetadataRepositories() - { - return metadataRepositories; - } + public Collection getMetadataRepositories() + { + return metadataRepositories; + } - public void setMetadataRepositories( - Collection metadataRepositories) - { - this.metadataRepositories = metadataRepositories; - } + public void setMetadataRepositories( Collection metadataRepositories ) + { + this.metadataRepositories = metadataRepositories; + } //------------------------------------------------------------------- - public ArtifactMetadata getArtifactMetadata() - { - return artifactMetadata; - } + public ArtifactMetadata getArtifactMetadata() + { + return artifactMetadata; + } - public void setArtifactMetadata(ArtifactMetadata artifactMetadata) - { - this.artifactMetadata = artifactMetadata; - } + public void setArtifactMetadata(ArtifactMetadata artifactMetadata) + { + this.artifactMetadata = artifactMetadata; + } //------------------------------------------------------------------- //------------------------------------------------------------------- } diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java index f9c6cd9168..24f832efde 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java @@ -1,5 +1,24 @@ 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 { @@ -21,8 +40,7 @@ public class MetadataResolutionException // TODO Auto-generated constructor stub } - public MetadataResolutionException( String message, - Throwable cause ) + public MetadataResolutionException( String message, Throwable cause ) { super( message, cause ); // TODO Auto-generated constructor stub diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java index 5bac06eb34..e1f6fe1ee8 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java @@ -1,10 +1,28 @@ 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 { @@ -18,8 +36,7 @@ public class MetadataResolutionRequest } //-------------------------------------------------------------------- - public MetadataResolutionRequest( ArtifactMetadata query, - ArtifactRepository localRepository, + public MetadataResolutionRequest( ArtifactMetadata query, ArtifactRepository localRepository, List remoteRepositories ) { this.query = query; diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java index 25435a1737..f305497a10 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java @@ -1,5 +1,24 @@ 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 ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java index bf7cc1ab5f..263f90681a 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java @@ -61,20 +61,20 @@ public class MetadataResolutionResult } public void initTreeProcessing( PlexusContainer plexus ) - throws ComponentLookupException + throws ComponentLookupException { classpathTransformation = (ClasspathTransformation) plexus.lookup( ClasspathTransformation.class ); conflictResolver = (GraphConflictResolver) plexus.lookup( GraphConflictResolver.class ); } //---------------------------------------------------------------------------- public MetadataGraph getGraph() - throws MetadataResolutionException + throws MetadataResolutionException { return treeRoot == null ? null : new MetadataGraph( treeRoot ); } //---------------------------------------------------------------------------- public MetadataGraph getGraph( ArtifactScopeEnum scope ) - throws MetadataResolutionException, GraphConflictResolutionException + throws MetadataResolutionException, GraphConflictResolutionException { if ( treeRoot == null ) { @@ -90,7 +90,7 @@ public class MetadataResolutionResult } //---------------------------------------------------------------------------- public MetadataGraph getGraph( MetadataResolutionRequestTypeEnum requestType ) - throws MetadataResolutionException, GraphConflictResolutionException + throws MetadataResolutionException, GraphConflictResolutionException { if ( requestType == null ) { @@ -139,7 +139,7 @@ public class MetadataResolutionResult } //---------------------------------------------------------------------------- public ClasspathContainer getClasspath( ArtifactScopeEnum scope ) - throws MetadataGraphTransformationException, MetadataResolutionException + throws MetadataGraphTransformationException, MetadataResolutionException { if ( classpathTransformation == null ) { @@ -157,7 +157,7 @@ public class MetadataResolutionResult //---------------------------------------------------------------------------- public MetadataTreeNode getClasspathTree( ArtifactScopeEnum scope ) - throws MetadataGraphTransformationException, MetadataResolutionException + throws MetadataGraphTransformationException, MetadataResolutionException { ClasspathContainer cpc = getClasspath( scope ); if ( cpc == null ) diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java index 486474914b..fef0f9a873 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java @@ -41,15 +41,12 @@ public class MetadataRetrievalException this( null, cause, null ); } - public MetadataRetrievalException( String message, - Throwable cause ) + public MetadataRetrievalException( String message, Throwable cause ) { this( message, cause, null ); } - public MetadataRetrievalException( String message, - Throwable cause, - ArtifactMetadata artifact ) + public MetadataRetrievalException( String message, Throwable cause, ArtifactMetadata artifact ) { super( message, cause ); diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java index 6cebb1a160..bc77e9be55 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java @@ -34,6 +34,7 @@ public interface MetadataSource { String ROLE = MetadataSource.class.getName(); - MetadataResolution retrieve( ArtifactMetadata artifact, ArtifactRepository localRepository, List remoteRepositories ) + MetadataResolution retrieve( ArtifactMetadata artifact, ArtifactRepository localRepository, + List remoteRepositories ) throws MetadataRetrievalException; } \ No newline at end of file diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java index e15cb188d5..dd720d3866 100644 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java +++ b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java @@ -1,14 +1,33 @@ 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 Oleg Gusakov * */ - public class MetadataTreeNode { ArtifactMetadata md; // this node @@ -21,44 +40,38 @@ public class MetadataTreeNode MetadataTreeNode[] children; // of cause public int getNChildren() - { - return nChildren; - } + { + return nChildren; + } - public void setNChildren(int children) - { - nChildren = children; - } + public void setNChildren( int children ) + { + nChildren = children; + } - //------------------------------------------------------------------------ + //------------------------------------------------------------------------ public MetadataTreeNode() { } //------------------------------------------------------------------------ - public MetadataTreeNode( ArtifactMetadata md, - MetadataTreeNode parent, - boolean resolved, - ArtifactScopeEnum scope ) + public MetadataTreeNode( ArtifactMetadata md, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope ) { if ( md != null ) { - md.setArtifactScope( ArtifactScopeEnum.checkScope(scope) ); - md.setResolved(resolved); + md.setArtifactScope( ArtifactScopeEnum.checkScope( scope ) ); + md.setResolved( resolved ); } this.md = md; this.parent = parent; } //------------------------------------------------------------------------ - public MetadataTreeNode( Artifact af, - MetadataTreeNode parent, - boolean resolved, - ArtifactScopeEnum scope - ) + 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 ) @@ -66,17 +79,21 @@ public class MetadataTreeNode return; } - if( children == null ) - children = new MetadataTreeNode[nChildren]; - + 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 @@ -84,8 +101,7 @@ public class MetadataTreeNode if ( md == null ) { throw new MetadataResolutionException( "treenode without metadata, parent: " - + ( parent == null ? "null" : parent.toString() ) - ); + + ( parent == null ? "null" : parent.toString() ) ); } return md.groupId + ":" + md.artifactId; diff --git a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java index b6c992286b..e0192ca0a2 100644 --- a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java +++ b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java @@ -72,11 +72,13 @@ public class ExpressionDocumenter } catch ( IOException e ) { - throw new ExpressionDocumentationException( "Failed to read documentation for expression root: " + EXPRESSION_ROOTS[i], e ); + throw new ExpressionDocumentationException( "Failed to read documentation for expression root: " + + EXPRESSION_ROOTS[i], e ); } catch ( XmlPullParserException e ) { - throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: " + EXPRESSION_ROOTS[i], e ); + throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: " + + EXPRESSION_ROOTS[i], e ); } finally { @@ -110,8 +112,8 @@ public class ExpressionDocumenter * ]]> * * - * @throws IOException - * @throws XmlPullParserException + * @throws IOException + * @throws XmlPullParserException */ private static Map parseExpressionDocumentation( InputStream docStream ) throws IOException, XmlPullParserException diff --git a/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java b/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java index 604bbc8264..abcf15dfe0 100644 --- a/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java +++ b/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java @@ -1,53 +1,58 @@ package org.apache.maven; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * 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. + * 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.execution.MavenSession; /** - * Allows core extensions to participate in build lifecycle. - * - * All callback methods (will) follow beforeXXX/afterXXX naming pattern to - * indicate at what lifecycle point it is being called. - * + * Allows core extensions to participate in build lifecycle. + * + * All callback methods (will) follow beforeXXX/afterXXX naming pattern to + * indicate at what lifecycle point it is being called. + * */ public abstract class AbstractMavenLifecycleParticipant { /** * Invoked after all MavenProject instances have been created. - * + * * This callback is intended to allow extensions to manipulate MavenProjects * before they are sorted and actual build execution starts. */ - public void afterProjectsRead( MavenSession session ) throws MavenExecutionException + public void afterProjectsRead( MavenSession session ) + throws MavenExecutionException { // do nothing } /** - * Invoked after MavenSession instance has been created. - * + * Invoked after MavenSession instance has been created. + * * This callback is intended to allow extensions to inject execution properties, * activate profiles and perform similar tasks that affect MavenProject * instance construction. */ // TODO: This is too early for build extensions, so maybe just remove it? - public void afterSessionStart( MavenSession session ) throws MavenExecutionException + public void afterSessionStart( MavenSession session ) + throws MavenExecutionException { // do nothing } diff --git a/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java b/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java index 33e3d73159..c97bbfe333 100644 --- a/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java +++ b/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java @@ -1,5 +1,24 @@ package org.apache.maven; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * 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.Set; public interface ArtifactFilterManagerDelegate diff --git a/maven-core/src/main/java/org/apache/maven/BuildFailureException.java b/maven-core/src/main/java/org/apache/maven/BuildFailureException.java index 9eaea990e6..3880faf107 100644 --- a/maven-core/src/main/java/org/apache/maven/BuildFailureException.java +++ b/maven-core/src/main/java/org/apache/maven/BuildFailureException.java @@ -1,6 +1,5 @@ package org.apache.maven; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java index 17f5959436..7cef5e89e7 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java @@ -1,18 +1,22 @@ package org.apache.maven; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * 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. + * 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; @@ -37,7 +41,6 @@ import org.apache.maven.execution.MavenExecutionRequestPopulator; import org.apache.maven.execution.MavenExecutionResult; import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.ProjectDependencyGraph; -import org.apache.maven.lifecycle.LifecycleExecutor; import org.apache.maven.lifecycle.internal.ExecutionEventCatapult; import org.apache.maven.lifecycle.internal.LifecycleStarter; import org.apache.maven.model.building.ModelProblem; @@ -64,7 +67,7 @@ import org.codehaus.plexus.util.dag.CycleDetectedException; /** * @author Jason van Zyl */ -@Component(role = Maven.class) +@Component( role = Maven.class ) public class DefaultMaven implements Maven { @@ -114,17 +117,18 @@ public class DefaultMaven return result; } - @SuppressWarnings({"ThrowableInstanceNeverThrown", "ThrowableResultOfMethodCallIgnored"}) + @SuppressWarnings( { "ThrowableInstanceNeverThrown", "ThrowableResultOfMethodCallIgnored" } ) private MavenExecutionResult doExecute( MavenExecutionRequest request ) { //TODO: Need a general way to inject standard properties if ( request.getStartTime() != null ) { - request.getSystemProperties().put( "${build.timestamp}", new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) ); - } - + request.getSystemProperties().put( "${build.timestamp}", + new SimpleDateFormat( "yyyyMMdd-hhmm" ).format( request.getStartTime() ) ); + } + request.setStartTime( new Date() ); - + MavenExecutionResult result = new DefaultMavenExecutionResult(); try @@ -138,11 +142,11 @@ public class DefaultMaven DelegatingLocalArtifactRepository delegatingLocalArtifactRepository = new DelegatingLocalArtifactRepository( request.getLocalRepository() ); - - request.setLocalRepository( delegatingLocalArtifactRepository ); - MavenSession session = new MavenSession( container, request, result); - + request.setLocalRepository( delegatingLocalArtifactRepository ); + + MavenSession session = new MavenSession( container, request, result ); + try { for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections. emptyList() ) ) @@ -158,11 +162,11 @@ public class DefaultMaven eventCatapult.fire( ExecutionEvent.Type.ProjectDiscoveryStarted, session, null ); //TODO: optimize for the single project or no project - + List projects; try { - projects = getProjectsForMavenReactor( request ); + projects = getProjectsForMavenReactor( request ); } catch ( ProjectBuildingException e ) { @@ -172,14 +176,14 @@ public class DefaultMaven session.setProjects( projects ); result.setTopologicallySortedProjects( session.getProjects() ); - + result.setProject( session.getTopLevelProject() ); try { Map projectMap; projectMap = getProjectMap( session.getProjects() ); - + // Desired order of precedence for local artifact repositories // // Reactor @@ -222,7 +226,7 @@ public class DefaultMaven session.setProjectDependencyGraph( projectDependencyGraph ); } catch ( CycleDetectedException e ) - { + { String message = "The projects in the reactor contain a cyclic reference: " + e.getMessage(); ProjectCycleException error = new ProjectCycleException( message, e ); @@ -257,7 +261,7 @@ public class DefaultMaven return result; } - @SuppressWarnings({"ResultOfMethodCallIgnored"}) + @SuppressWarnings( { "ResultOfMethodCallIgnored" } ) private void validateLocalRepository( MavenExecutionRequest request ) throws LocalRepositoryNotAccessibleException { @@ -330,7 +334,7 @@ public class DefaultMaven return result; } - + private List getProjectsForMavenReactor( MavenExecutionRequest request ) throws ProjectBuildingException { @@ -348,8 +352,8 @@ public class DefaultMaven request.setProjectPresent( false ); return projects; } - - List files = Arrays.asList( request.getPom().getAbsoluteFile() ); + + List files = Arrays.asList( request.getPom().getAbsoluteFile() ); collectProjects( projects, files, request ); return projects; } @@ -401,7 +405,8 @@ public class DefaultMaven { ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest(); - List results = projectBuilder.build( files, request.isRecursive(), projectBuildingRequest ); + List results = + projectBuilder.build( files, request.isRecursive(), projectBuildingRequest ); boolean problems = false; @@ -418,7 +423,8 @@ public class DefaultMaven for ( ModelProblem problem : result.getProblems() ) { String location = ModelProblemUtils.formatLocation( problem, result.getProjectId() ); - logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( location ) ? " @ " + location : "" ) ); + logger.warn( problem.getMessage() + + ( StringUtils.isNotEmpty( location ) ? " @ " + location : "" ) ); } problems = true; diff --git a/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java index 37a42329a6..30a551d25c 100644 --- a/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java @@ -42,7 +42,7 @@ import org.apache.maven.repository.RepositorySystem; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -@Component(role = ProjectDependenciesResolver.class) +@Component( role = ProjectDependenciesResolver.class ) public class DefaultProjectDependenciesResolver implements ProjectDependenciesResolver { @@ -97,15 +97,15 @@ public class DefaultProjectDependenciesResolver return resolved; } - if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) && - ( scopesToResolve == null || scopesToResolve.isEmpty() ) ) + if ( ( scopesToCollect == null || scopesToCollect.isEmpty() ) + && ( scopesToResolve == null || scopesToResolve.isEmpty() ) ) { return resolved; } /* - Logic for transitve global exclusions + Logic for transitive global exclusions List exclusions = new ArrayList(); @@ -126,7 +126,8 @@ public class DefaultProjectDependenciesResolver if ( ! exclusions.isEmpty() ) { - filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{ new ExcludesArtifactFilter( exclusions ), scopeFilter } ) ); + filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{ new ExcludesArtifactFilter( exclusions ), + scopeFilter } ) ); } else { @@ -140,10 +141,10 @@ public class DefaultProjectDependenciesResolver collectionScopeFilter = new CumulativeScopeArtifactFilter( collectionScopeFilter, resolutionScopeFilter ); ArtifactResolutionRequest request = - new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true ).setCollectionFilter( - collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter ).setLocalRepository( - session.getLocalRepository() ).setOffline( session.isOffline() ).setForceUpdate( - session.getRequest().isUpdateSnapshots() ).setCache( session.getRepositoryCache() ); + new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true ) + .setCollectionFilter( collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter ) + .setLocalRepository( session.getLocalRepository() ).setOffline( session.isOffline() ) + .setForceUpdate( session.getRequest().isUpdateSnapshots() ).setCache( session.getRepositoryCache() ); request.setTransferListener( session.getRequest().getTransferListener() ); request.setServers( session.getRequest().getServers() ); request.setMirrors( session.getRequest().getMirrors() ); diff --git a/maven-core/src/main/java/org/apache/maven/MissingModuleException.java b/maven-core/src/main/java/org/apache/maven/MissingModuleException.java index f8cfada2af..c920a6eac2 100644 --- a/maven-core/src/main/java/org/apache/maven/MissingModuleException.java +++ b/maven-core/src/main/java/org/apache/maven/MissingModuleException.java @@ -1,5 +1,23 @@ package org.apache.maven; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * 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; diff --git a/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java b/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java index 86a496f996..cba44620d8 100644 --- a/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java +++ b/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java @@ -1,5 +1,24 @@ package org.apache.maven; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * 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.dag.CycleDetectedException; /** diff --git a/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java index 951082405d..7c1ae45d48 100644 --- a/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java @@ -39,7 +39,7 @@ public interface ProjectDependenciesResolver * @param session The current build session, must not be {@code null}. * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. */ - public Set resolve( MavenProject project, Collection scopesToResolve, MavenSession session ) + Set resolve( MavenProject project, Collection scopesToResolve, MavenSession session ) throws ArtifactResolutionException, ArtifactNotFoundException; /** @@ -51,8 +51,8 @@ public interface ProjectDependenciesResolver * @param session The current build session, must not be {@code null}. * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. */ - public Set resolve( MavenProject project, Collection scopesToCollect, - Collection scopesToResolve, MavenSession session ) + Set resolve( MavenProject project, Collection scopesToCollect, + Collection scopesToResolve, MavenSession session ) throws ArtifactResolutionException, ArtifactNotFoundException; /** @@ -65,9 +65,8 @@ public interface ProjectDependenciesResolver * @param ignoreableArtifacts Artifacts that need not be resolved * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. */ - public Set resolve( MavenProject project, Collection scopesToCollect, - Collection scopesToResolve, MavenSession session, - Set ignoreableArtifacts ) + Set resolve( MavenProject project, Collection scopesToCollect, + Collection scopesToResolve, MavenSession session, Set ignoreableArtifacts ) throws ArtifactResolutionException, ArtifactNotFoundException; @@ -83,8 +82,7 @@ public interface ProjectDependenciesResolver * @return The transitive dependencies of the specified projects that match the requested scopes, never {@code null} * . */ - public Set resolve( Collection projects, Collection scopes, - MavenSession session ) + Set resolve( Collection projects, Collection scopes, MavenSession session ) throws ArtifactResolutionException, ArtifactNotFoundException; } diff --git a/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java index 596e21d12f..dee5e3581e 100644 --- a/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java +++ b/maven-core/src/main/java/org/apache/maven/ReactorArtifactRepository.java @@ -25,11 +25,16 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.repository.LocalArtifactRepository; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * An implementation of a repository that knows how to search the Maven reactor for artifacts. - * + * * @author Jason van Zyl */ public class ReactorArtifactRepository @@ -42,7 +47,7 @@ public class ReactorArtifactRepository private final int hashCode; - @SuppressWarnings({"ConstantConditions"}) + @SuppressWarnings( { "ConstantConditions" } ) public ReactorArtifactRepository( Map reactorProjects ) { projectsByGAV = reactorProjects; @@ -172,7 +177,7 @@ public class ReactorArtifactRepository /** * Tries to resolve the specified artifact from the artifacts of the given project. - * + * * @param project The project to try to resolve the artifact from, must not be null. * @param requestedArtifact The artifact to resolve, must not be null. * @return The matching artifact from the project or null if not found. @@ -226,7 +231,7 @@ public class ReactorArtifactRepository * Gets the repository conflict id of the specified artifact. Unlike the dependency conflict id, the repository * conflict id uses the artifact file extension instead of the artifact type. Hence, the repository conflict id more * closely reflects the identity of artifacts as perceived by a repository. - * + * * @param artifact The artifact, must not be null. * @return The repository conflict id, never null. */ @@ -252,7 +257,7 @@ public class ReactorArtifactRepository /** * Determines whether the specified artifact refers to test classes. - * + * * @param artifact The artifact to check, must not be {@code null}. * @return {@code true} if the artifact refers to test classes, {@code false} otherwise. */ diff --git a/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java b/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java index deeead58be..ad43efc484 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java @@ -1,9 +1,5 @@ package org.apache.maven.artifact; -import java.net.MalformedURLException; - -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -23,6 +19,10 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti * under the License. */ +import java.net.MalformedURLException; + +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; + /** * Error constructing an artifact repository. * @@ -34,17 +34,13 @@ public class InvalidRepositoryException { private final String repositoryId; - public InvalidRepositoryException( String message, - String repositoryId, - MalformedURLException cause ) + public InvalidRepositoryException( String message, String repositoryId, MalformedURLException cause ) { super( message, cause ); this.repositoryId = repositoryId; } - protected InvalidRepositoryException( String message, - String repositoryId, - ComponentLookupException cause ) + protected InvalidRepositoryException( String message, String repositoryId, ComponentLookupException cause ) { super( message, cause ); this.repositoryId = repositoryId; @@ -57,8 +53,7 @@ public class InvalidRepositoryException this.repositoryId = null; } - public InvalidRepositoryException( String message, - String repositoryId ) + public InvalidRepositoryException( String message, String repositoryId ) { super( message ); this.repositoryId = repositoryId; diff --git a/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java b/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java index 9a91c05613..a16f64f682 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java @@ -1,18 +1,22 @@ package org.apache.maven.artifact.factory; /* - * 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. + * 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; @@ -26,15 +30,20 @@ public interface ArtifactFactory Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type ); - Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ); + Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, + String classifier ); - Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope ); + Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, + String classifier, String scope ); - Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, boolean optional ); + Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, + String classifier, String scope, boolean optional ); - Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope ); + Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, + String classifier, String scope, String inheritedScope ); - Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ); + Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, + String classifier, String scope, String inheritedScope, boolean optional ); Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging ); diff --git a/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java b/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java index f139a8234d..dfcac01949 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java @@ -27,7 +27,7 @@ import org.apache.maven.artifact.versioning.VersionRange; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; -@Component(role=ArtifactFactory.class) +@Component( role = ArtifactFactory.class ) public class DefaultArtifactFactory implements ArtifactFactory { @@ -39,27 +39,33 @@ public class DefaultArtifactFactory return createArtifact( groupId, artifactId, version, scope, type, null, null ); } - public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) + public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, + String classifier ) { return createArtifact( groupId, artifactId, version, null, type, classifier, null ); } - public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope ) + public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, + String type, String classifier, String scope ) { return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null ); } - public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, boolean optional ) + public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, + String type, String classifier, String scope, boolean optional ) { return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null, optional ); } - public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope ) + public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, + String type, String classifier, String scope, String inheritedScope ) { return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope ); } - public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ) + public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, + String type, String classifier, String scope, String inheritedScope, + boolean optional ) { return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, optional ); } @@ -94,7 +100,8 @@ public class DefaultArtifactFactory return createArtifact( groupId, artifactId, versionRange, "jar", null, Artifact.SCOPE_RUNTIME, null ); } - private Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type, String classifier, String inheritedScope ) + private Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type, + String classifier, String inheritedScope ) { VersionRange versionRange = null; if ( version != null ) @@ -104,15 +111,17 @@ public class DefaultArtifactFactory return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope ); } - private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope ) + private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, + String classifier, String scope, String inheritedScope ) { return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, false ); } - private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional ) + private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type, + String classifier, String scope, String inheritedScope, boolean optional ) { String desiredScope = Artifact.SCOPE_RUNTIME; - + if ( inheritedScope == null ) { desiredScope = scope; @@ -145,6 +154,7 @@ public class DefaultArtifactFactory ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type ); - return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler, optional ); + return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler, + optional ); } } diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java index 2688adbb8f..3e66a2255e 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java @@ -1,7 +1,5 @@ package org.apache.maven.artifact.handler; -import org.codehaus.plexus.component.annotations.Component; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -21,12 +19,14 @@ import org.codehaus.plexus.component.annotations.Component; * under the License. */ +import org.codehaus.plexus.component.annotations.Component; + /** * @author Brett Porter * @author Jason van Zyl * @version $Id$ */ -@Component(role=ArtifactHandler.class) +@Component( role = ArtifactHandler.class ) public class DefaultArtifactHandler implements ArtifactHandler { diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java index 7cc55faca3..d4a04b4995 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java @@ -33,5 +33,5 @@ public interface ArtifactHandlerManager ArtifactHandler getArtifactHandler( String type ); - void addHandlers( Map handlers ); + void addHandlers( Map handlers ); } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java b/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java index 2aadb418be..e00044b9d0 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java @@ -31,12 +31,12 @@ import org.codehaus.plexus.component.annotations.Requirement; * @author Jason van Zyl * @version $Id$ */ -@Component(role=ArtifactHandlerManager.class) +@Component( role = ArtifactHandlerManager.class ) public class DefaultArtifactHandlerManager implements ArtifactHandlerManager { - @Requirement(role=ArtifactHandler.class) - private Map artifactHandlers; + @Requirement( role = ArtifactHandler.class ) + private Map artifactHandlers; public ArtifactHandler getArtifactHandler( String type ) { @@ -50,7 +50,7 @@ public class DefaultArtifactHandlerManager return handler; } - public void addHandlers( Map handlers ) + public void addHandlers( Map handlers ) { artifactHandlers.putAll( handlers ); } diff --git a/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java b/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java index 7975297e12..ccd58363e1 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java @@ -34,15 +34,19 @@ public interface ArtifactMetadataSource ResolutionGroup retrieve( MetadataResolutionRequest request ) throws ArtifactMetadataRetrievalException; - ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) throws ArtifactMetadataRetrievalException; List retrieveAvailableVersions( MetadataResolutionRequest request ) throws ArtifactMetadataRetrievalException; - List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) throws ArtifactMetadataRetrievalException; - List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, + ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) throws ArtifactMetadataRetrievalException; } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java b/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java index 84583b9eaf..c219b24ef1 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java @@ -1,18 +1,22 @@ package org.apache.maven.artifact.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. + * 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; diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java index 189c6ebd4f..6139b66692 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java @@ -28,7 +28,7 @@ import org.apache.maven.repository.ArtifactTransferListener; /** * Collects basic settings to access the repository system. - * + * * @author Benjamin Bentmann */ public class DefaultRepositoryRequest @@ -57,7 +57,7 @@ public class DefaultRepositoryRequest /** * Creates a shallow copy of the specified repository request. - * + * * @param repositoryRequest The repository request to copy from, must not be {@code null}. */ public DefaultRepositoryRequest( RepositoryRequest repositoryRequest ) @@ -70,17 +70,19 @@ public class DefaultRepositoryRequest setTransferListener( repositoryRequest.getTransferListener() ); } - public static RepositoryRequest getRepositoryRequest(MavenSession session, MavenProject project) { + public static RepositoryRequest getRepositoryRequest( MavenSession session, MavenProject project ) + { RepositoryRequest request = new DefaultRepositoryRequest(); - request.setCache(session.getRepositoryCache()); - request.setLocalRepository(session.getLocalRepository()); - if (project != null) { - request.setRemoteRepositories(project.getPluginArtifactRepositories()); + request.setCache( session.getRepositoryCache() ); + request.setLocalRepository( session.getLocalRepository() ); + if ( project != null ) + { + request.setRemoteRepositories( project.getPluginArtifactRepositories() ); } - request.setOffline(session.isOffline()); - request.setForceUpdate(session.getRequest().isUpdateSnapshots()); - request.setTransferListener(session.getRequest().getTransferListener()); + request.setOffline( session.isOffline() ); + request.setForceUpdate( session.getRequest().isUpdateSnapshots() ); + request.setTransferListener( session.getRequest().getTransferListener() ); return request; } diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java index 642013f3e0..59d238f30d 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java @@ -33,23 +33,23 @@ public class MavenArtifactRepository implements ArtifactRepository { private String id; - + private String url; - + private String basedir; - + private String protocol; - + private ArtifactRepositoryLayout layout; private ArtifactRepositoryPolicy snapshots; private ArtifactRepositoryPolicy releases; - + private Authentication authentication; - + private Proxy proxy; - + public MavenArtifactRepository() { } @@ -63,18 +63,19 @@ public class MavenArtifactRepository * @param snapshots the policies to use for snapshots * @param releases the policies to use for releases */ - public MavenArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) + public MavenArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, + ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ) { this.id = id; this.url = url; this.layout = layout; this.snapshots = snapshots; - this.releases = releases; + this.releases = releases; // // Derive these from the URL // this.protocol = protocol( url ); - this.basedir = basedir( url ); + this.basedir = basedir( url ); } public String pathOf( Artifact artifact ) @@ -96,7 +97,7 @@ public class MavenArtifactRepository { this.layout = layout; } - + public ArtifactRepositoryLayout getLayout() { return layout; @@ -106,7 +107,7 @@ public class MavenArtifactRepository { this.snapshots = snapshots; } - + public ArtifactRepositoryPolicy getSnapshots() { return snapshots; @@ -126,7 +127,7 @@ public class MavenArtifactRepository { return getId(); } - + public String toString() { StringBuilder sb = new StringBuilder(); @@ -134,13 +135,13 @@ public class MavenArtifactRepository sb.append( " id: " ).append( getId() ).append( "\n" ); sb.append( " url: " ).append( getUrl() ).append( "\n" ); sb.append( " layout: " ).append( layout != null ? layout.getId() : "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() ); @@ -153,7 +154,7 @@ public class MavenArtifactRepository 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 ); @@ -200,7 +201,7 @@ public class MavenArtifactRepository } // Path Utils - + /** * /** * Return the protocol name. @@ -224,7 +225,7 @@ public class MavenArtifactRepository /** * Derive the path portion of the given URL. - * + * * @param url the repository URL * @return the basedir of the repository * @todo need to URL decode for spaces? @@ -289,7 +290,7 @@ public class MavenArtifactRepository /** * Decodes the specified (portion of a) URL. Note: This decoder assumes that ISO-8859-1 is used to * convert URL-encoded octets to characters. - * + * * @param url The URL to decode, may be null. * @return The decoded URL or null if the input was null. */ @@ -352,7 +353,7 @@ public class MavenArtifactRepository public void setAuthentication( Authentication authentication ) { - this.authentication = authentication; + this.authentication = authentication; } public Proxy getProxy() @@ -374,7 +375,7 @@ public class MavenArtifactRepository { // no op } - + public boolean isUniqueVersion() { return true; diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java index 4b9c863441..4bb5d794d3 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java @@ -28,7 +28,7 @@ import org.codehaus.plexus.component.annotations.Component; /** * @author jdcasey */ -@Component(role=ArtifactRepositoryLayout.class, hint="default") +@Component( role = ArtifactRepositoryLayout.class, hint = "default" ) public class DefaultRepositoryLayout implements ArtifactRepositoryLayout { @@ -42,7 +42,7 @@ public class DefaultRepositoryLayout { return "default"; } - + public String pathOf( Artifact artifact ) { ArtifactHandler artifactHandler = artifact.getArtifactHandler(); diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java index 38ec0519e3..35626e5872 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java @@ -31,10 +31,12 @@ public interface RepositoryMetadataManager void resolve( RepositoryMetadata repositoryMetadata, RepositoryRequest repositoryRequest ) throws RepositoryMetadataResolutionException; - void resolve( RepositoryMetadata repositoryMetadata, List repositories, ArtifactRepository localRepository ) + void resolve( RepositoryMetadata repositoryMetadata, List repositories, + ArtifactRepository localRepository ) throws RepositoryMetadataResolutionException; - void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) throws RepositoryMetadataResolutionException; /** @@ -44,7 +46,8 @@ public interface RepositoryMetadataManager * @param localRepository the local repository to install to first * @param deploymentRepository the remote repository to deploy to */ - void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository ) + void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository, + ArtifactRepository deploymentRepository ) throws RepositoryMetadataDeploymentException; /** diff --git a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java index 6d880f302f..7f554e4346 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java @@ -29,7 +29,7 @@ import org.apache.maven.artifact.repository.metadata.Metadata; /** * Handles deserialization of metadata from some kind of textual format like XML. - * + * * @author Benjamin Bentmann */ public interface MetadataReader @@ -39,11 +39,11 @@ public interface MetadataReader * The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code * true}. If {@code false}, unknown elements will be ignored instead of causing a failure. */ - static final String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict"; + final String IS_STRICT = "org.apache.maven.artifact.repository.metadata.io.isStrict"; /** * Reads the metadata from the specified file. - * + * * @param input The file to deserialize the metadata from, must not be {@code null}. * @param options The options to use for deserialization, may be {@code null} to use the default values. * @return The deserialized metadata, never {@code null}. @@ -56,7 +56,7 @@ public interface MetadataReader /** * Reads the metadata from the specified character reader. The reader will be automatically closed before the method * returns. - * + * * @param input The reader to deserialize the metadata from, must not be {@code null}. * @param options The options to use for deserialization, may be {@code null} to use the default values. * @return The deserialized metadata, never {@code null}. @@ -69,7 +69,7 @@ public interface MetadataReader /** * Reads the metadata from the specified byte stream. The stream will be automatically closed before the method * returns. - * + * * @param input The stream to deserialize the metadata from, must not be {@code null}. * @param options The options to use for deserialization, may be {@code null} to use the default values. * @return The deserialized metadata, never {@code null}. diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java index f3878913bd..73a8a397a3 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -30,7 +34,7 @@ import org.apache.maven.artifact.versioning.OverConstrainedVersionException; *

* - missing metadata - version range violations - version circular dependencies - missing artifacts * - network/transfer errors - file system errors: permissions - * + * * @author Jason van Zyl * @TODO carlos: all these possible has*Exceptions and get*Exceptions methods make the clients too * complex requiring a long list of checks, need to create a parent/interfact/encapsulation diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java index 85fd10a511..a8caa79b23 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java @@ -69,7 +69,8 @@ public class DefaultResolutionErrorHandler if ( result.hasMissingArtifacts() ) { throw new MultipleArtifactsNotFoundException( request.getArtifact(), toList( result.getArtifacts() ), - result.getMissingArtifacts(), request.getRemoteRepositories() ); + result.getMissingArtifacts(), + request.getRemoteRepositories() ); } // this should never happen since we checked all possible error sources before but better be sure diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java index b857a51c4f..c54e5b6c70 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java @@ -25,7 +25,7 @@ package org.apache.maven.artifact.resolver; public interface ResolutionErrorHandler { - public void throwErrors( ArtifactResolutionRequest request, ArtifactResolutionResult result ) + void throwErrors( ArtifactResolutionRequest request, ArtifactResolutionResult result ) throws ArtifactResolutionException; } diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java index 2f5b65ba00..ae6c921447 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java @@ -80,7 +80,8 @@ public class ResolutionNode return artifact.getDependencyConflictId(); } - public void addDependencies( Set artifacts, List remoteRepositories, ArtifactFilter filter ) + public void addDependencies( Set artifacts, List remoteRepositories, + ArtifactFilter filter ) throws CyclicDependencyException, OverConstrainedVersionException { if ( artifacts != null && !artifacts.isEmpty() ) diff --git a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java index df7ca25f88..27879db1b0 100644 --- a/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java +++ b/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java @@ -38,7 +38,8 @@ import org.codehaus.plexus.util.StringUtils; /* - test projects for each of these -- how to categorize the problems so that the id of the problem can be match to a page with descriptive help and the test project +- how to categorize the problems so that the id of the problem can be match to a page with descriptive help and the test + project - nice little sample projects that could be run in the core as well as integration tests All Possible Errors @@ -52,7 +53,7 @@ All Possible Errors - extension metadata missing - extension artifact missing - artifact metadata retrieval problem -- version range violation +- version range violation - circular dependency - artifact missing - artifact retrieval exception @@ -78,7 +79,7 @@ Plugins: //PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException; -@Component(role=ExceptionHandler.class) +@Component( role = ExceptionHandler.class ) public class DefaultExceptionHandler implements ExceptionHandler { @@ -192,7 +193,7 @@ public class DefaultExceptionHandler reference = exception.getClass().getSimpleName(); } } - else if ( exception instanceof LifecycleExecutionException) + else if ( exception instanceof LifecycleExecutionException ) { reference = getReference( exception.getCause() ); } diff --git a/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java b/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java index bc32acb845..89665007ff 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java +++ b/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java @@ -1,6 +1,5 @@ package org.apache.maven.execution; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,7 +21,7 @@ package org.apache.maven.execution; /** * Provides a skeleton implementation for execution listeners. The methods of this class are empty. - * + * * @author Benjamin Bentmann */ public class AbstractExecutionListener diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java index fd6f15fc04..6965160f94 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java @@ -155,7 +155,8 @@ public class DefaultMavenExecutionRequest copy.setUserSettingsFile( original.getUserSettingsFile() ); copy.setGlobalSettingsFile( original.getGlobalSettingsFile() ); copy.setUserToolchainsFile( original.getUserToolchainsFile() ); - copy.setBaseDirectory( ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() ) : null ); + copy.setBaseDirectory( ( original.getBaseDirectory() != null ) + ? new File( original.getBaseDirectory() ) : null ); copy.setGoals( original.getGoals() ); copy.setRecursive( original.isRecursive() ); copy.setPom( original.getPom() ); diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java index e86b3dd323..1e103e9451 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java +++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java @@ -36,7 +36,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.util.StringUtils; -@Component(role = MavenExecutionRequestPopulator.class) +@Component( role = MavenExecutionRequestPopulator.class ) public class DefaultMavenExecutionRequestPopulator implements MavenExecutionRequestPopulator { diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 27bc40c58f..ea9795c440 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -45,45 +45,45 @@ public interface MavenExecutionRequest // Logging // ---------------------------------------------------------------------- - static final int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG; + final int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG; - static final int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO; + final int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO; - static final int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN; + final int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN; - static final int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR; + final int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR; - static final int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL; + final int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL; - static final int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED; + final int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED; // ---------------------------------------------------------------------- // Reactor Failure Mode // ---------------------------------------------------------------------- - static final String REACTOR_FAIL_FAST = "FAIL_FAST"; + final String REACTOR_FAIL_FAST = "FAIL_FAST"; - static final String REACTOR_FAIL_AT_END = "FAIL_AT_END"; + final String REACTOR_FAIL_AT_END = "FAIL_AT_END"; - static final String REACTOR_FAIL_NEVER = "FAIL_NEVER"; + final String REACTOR_FAIL_NEVER = "FAIL_NEVER"; // ---------------------------------------------------------------------- // Reactor Make Mode // ---------------------------------------------------------------------- - static final String REACTOR_MAKE_UPSTREAM = "make-upstream"; + final String REACTOR_MAKE_UPSTREAM = "make-upstream"; - static final String REACTOR_MAKE_DOWNSTREAM = "make-downstream"; + final String REACTOR_MAKE_DOWNSTREAM = "make-downstream"; - static final String REACTOR_MAKE_BOTH = "make-both"; + final String REACTOR_MAKE_BOTH = "make-both"; // ---------------------------------------------------------------------- // Artifact repository policies // ---------------------------------------------------------------------- - static final String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL; + final String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL; - static final String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN; + final String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN; // ---------------------------------------------------------------------- // @@ -155,7 +155,7 @@ public interface MavenExecutionRequest void setThreadCount( String threadCount ); String getThreadCount(); boolean isThreadConfigurationPresent(); - void setPerCoreThreadCount(boolean perCoreThreadCount); + void setPerCoreThreadCount( boolean perCoreThreadCount ); boolean isPerCoreThreadCount(); // Recursive (really to just process the top-level POM) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index b2c2912a2b..9f8787d16e 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle; +/* + * 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.execution.MavenSession; import org.apache.maven.lifecycle.internal.DependencyContext; import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator; @@ -49,7 +54,7 @@ import java.util.TreeSet; * A facade that provides lifecycle services to components outside maven core. * * Note that this component is not normally used from within core itself. - * + * * @author Jason van Zyl * @author Benjamin Bentmann * @author Kristian Rosenvold diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java index edb9f8b638..b7cd371ad0 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle; +/* + * 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; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.Logger; @@ -94,9 +99,8 @@ public class DefaultLifecycles else { Lifecycle original = phaseToLifecycleMap.get( phase ); - logger.warn( - "Duplicated lifecycle phase " + phase + ". Defined in " + original.getId() + " but also in " + - lifecycle.getId() ); + logger.warn( "Duplicated lifecycle phase " + phase + ". Defined in " + original.getId() + + " but also in " + lifecycle.getId() ); } } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java index 6cb7c19234..8649db812d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultSchedules.java @@ -1,17 +1,22 @@ package org.apache.maven.lifecycle; + /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import org.apache.maven.lifecycle.internal.BuilderCommon; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java b/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java index a498054811..50cff51946 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java @@ -1,21 +1,24 @@ +package org.apache.maven.lifecycle; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ -package org.apache.maven.lifecycle; - import java.util.Set; import org.apache.maven.model.Plugin; @@ -23,6 +26,7 @@ import org.apache.maven.model.Plugin; /** * @author Kristian Rosenvold */ -public interface LifeCyclePluginAnalyzer { - Set getPluginsBoundByDefaultToAllLifecycles(String packaging); +public interface LifeCyclePluginAnalyzer +{ + Set getPluginsBoundByDefaultToAllLifecycles( String packaging ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java b/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java index 2b01bdcd69..fcfde95148 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java @@ -27,10 +27,12 @@ import java.util.Map; */ public class Lifecycle { - public Lifecycle() { + public Lifecycle() + { } - public Lifecycle(String id, List phases, Map defaultPhases) { + public Lifecycle( String id, List phases, Map defaultPhases ) + { this.id = id; this.phases = phases; this.defaultPhases = defaultPhases; @@ -51,9 +53,9 @@ public class Lifecycle private String id; private List phases; - + private Map defaultPhases; - + public String getId() { return this.id; @@ -63,7 +65,7 @@ public class Lifecycle { return this.phases; } - + public Map getDefaultPhases() { return defaultPhases; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java b/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java index 082b38c618..8bb83bdd37 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java @@ -19,17 +19,26 @@ package org.apache.maven.lifecycle; * under the License. */ +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +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.lifecycle.internal.ExecutionPlanItem; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecution; -import java.util.*; - //TODO: lifecycles being executed //TODO: what runs in each phase //TODO: plugins that need downloading //TODO: project dependencies that need downloading -//TODO: unfortunately the plugins need to be downloaded in order to get the plugin.xml file. need to externalize this from the plugin archive. +//TODO: unfortunately the plugins need to be downloaded in order to get the plugin.xml file. need to externalize this +// from the plugin archive. //TODO: this will be the class that people get in IDEs to modify public class MavenExecutionPlan @@ -104,8 +113,6 @@ public class MavenExecutionPlan lastMojoExecutionForAllPhases.put( phase, lastSeenExecutionPlanItem ); } - - } @@ -204,10 +211,10 @@ public class MavenExecutionPlan } return plugins; } - - // Used by m2e but will be removed, really. - @SuppressWarnings({"UnusedDeclaration"}) + // Used by m2e but will be removed, really. + + @SuppressWarnings( { "UnusedDeclaration" } ) @Deprecated public List getExecutions() { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/Schedule.java b/maven-core/src/main/java/org/apache/maven/lifecycle/Schedule.java index 64c958d837..7e865ce476 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/Schedule.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/Schedule.java @@ -1,20 +1,24 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle; +/* + * 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.plugin.MojoExecution; /** @@ -142,8 +146,8 @@ public class Schedule @Override public String toString() { - return "Schedule{" + "phase='" + phase + '\'' + ", upstreamPhase='" + upstreamPhase + '\'' + ", pluginKey='" + - pluginKey + '\'' + ", mojoGoal='" + mojoGoal + '\'' + ", mojoSynchronized=" + mojoSynchronized + - ", parallel=" + parallel + '}'; + return "Schedule{" + "phase='" + phase + '\'' + ", upstreamPhase='" + upstreamPhase + '\'' + ", pluginKey='" + + pluginKey + '\'' + ", mojoGoal='" + mojoGoal + '\'' + ", mojoSynchronized=" + mojoSynchronized + + ", parallel=" + parallel + '}'; } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/Scheduling.java b/maven-core/src/main/java/org/apache/maven/lifecycle/Scheduling.java index b01d1d6650..078b396ecc 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/Scheduling.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/Scheduling.java @@ -1,20 +1,24 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle; +/* + * 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.plugin.MojoExecution; import java.util.List; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java index fdd2332305..9998cb175d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.annotations.Component; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildLogItem.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildLogItem.java index 5754bb67cb..e3b40c4b01 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildLogItem.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildLogItem.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.project.MavenProject; import java.util.ArrayList; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java index 4062339bf2..f81c72321d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.InternalErrorException; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.BuildFailure; @@ -47,7 +52,7 @@ import java.util.Set; * Builds one or more lifecycles for a full module * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = BuilderCommon.class) +@Component( role = BuilderCommon.class ) public class BuilderCommon { @Requirement @@ -64,17 +69,17 @@ public class BuilderCommon @Requirement private Logger logger; - - @SuppressWarnings({"UnusedDeclaration"}) + + @SuppressWarnings( { "UnusedDeclaration" } ) public BuilderCommon() { } - public BuilderCommon(LifecycleDebugLogger lifecycleDebugLogger, - LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator, - LifecycleDependencyResolver lifecycleDependencyResolver, Logger logger) + public BuilderCommon( LifecycleDebugLogger lifecycleDebugLogger, + LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator, + LifecycleDependencyResolver lifecycleDependencyResolver, Logger logger ) { this.lifecycleDebugLogger = lifecycleDebugLogger; this.lifeCycleExecutionPlanCalculator = lifeCycleExecutionPlanCalculator; @@ -172,8 +177,8 @@ public class BuilderCommon } } - // Todo: I'm really wondering where this method belongs; smells like it should be on MavenProject, but for some reason it isn't ? - // This localization is kind-of a code smell. + // Todo: I'm really wondering where this method belongs; smells like it should be on MavenProject, but for some reason + // it isn't ? This localization is kind-of a code smell. public static String getKey( MavenProject project ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraph.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraph.java index 82a0bf61e2..53bae2de8e 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraph.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraph.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.ProjectDependencyGraph; import org.apache.maven.project.MavenProject; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLogger.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLogger.java index 8592f059d7..21ed52422f 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLogger.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ConcurrentBuildLogger.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.project.MavenProject; import java.util.ArrayList; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java index 2b33d819db..41357373fa 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.MavenExecutionPlan; import org.apache.maven.project.MavenProject; @@ -28,7 +33,7 @@ import java.util.Collection; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -// TODO: From a concurrecy perspective, this class is not good. The combination of mutable/immutable state is not nice +// TODO: From a concurrency perspective, this class is not good. The combination of mutable/immutable state is not nice public class DependencyContext { @@ -102,8 +107,8 @@ public class DependencyContext { if ( isSameProject( session ) ) { - if ( lastDependencyArtifacts != lastProject.getDependencyArtifacts() || - ( lastDependencyArtifacts != null && lastDependencyArtifactCount != lastDependencyArtifacts.size() ) ) + if ( lastDependencyArtifacts != lastProject.getDependencyArtifacts() + || ( lastDependencyArtifacts != null && lastDependencyArtifactCount != lastDependencyArtifacts.size() ) ) { return true; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java index 5cd0b5c4fb..d6b543d212 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.lifecycle.Schedule; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecution; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java index 0b2ebcdf14..0eb4104c45 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /** * A task that is a goal *

diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java index eaba163f4c..890e93b72c 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.ProjectDependencyGraph; import org.apache.maven.lifecycle.MavenExecutionPlan; @@ -36,14 +41,14 @@ import java.util.Map; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifecycleDebugLogger.class) +@Component( role = LifecycleDebugLogger.class ) public class LifecycleDebugLogger { @Requirement private Logger logger; - @SuppressWarnings({"UnusedDeclaration"}) + @SuppressWarnings( { "UnusedDeclaration" } ) public LifecycleDebugLogger() { } @@ -108,8 +113,8 @@ public class LifecycleDebugLogger private void debugMojoExecution( MojoExecution mojoExecution ) { String mojoExecId = - mojoExecution.getGroupId() + ':' + mojoExecution.getArtifactId() + ':' + mojoExecution.getVersion() + ':' + - mojoExecution.getGoal() + " (" + mojoExecution.getExecutionId() + ')'; + mojoExecution.getGroupId() + ':' + mojoExecution.getArtifactId() + ':' + mojoExecution.getVersion() + ':' + + mojoExecution.getGoal() + " (" + mojoExecution.getExecutionId() + ')'; Map> forkedExecutions = mojoExecution.getForkedExecutions(); if ( !forkedExecutions.isEmpty() ) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java index 75286e54d3..63b40654ee 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java @@ -1,20 +1,24 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.ProjectDependenciesResolver; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; @@ -42,7 +46,7 @@ import java.util.*; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifecycleDependencyResolver.class) +@Component( role = LifecycleDependencyResolver.class ) public class LifecycleDependencyResolver { @Requirement @@ -54,7 +58,7 @@ public class LifecycleDependencyResolver @Requirement private ArtifactFactory artifactFactory; - @SuppressWarnings({"UnusedDeclaration"}) + @SuppressWarnings( { "UnusedDeclaration" } ) public LifecycleDependencyResolver() { } @@ -154,8 +158,8 @@ public class LifecycleDependencyResolver { /* * MNG-2277, the check below compensates for our bad plugin support where we ended up with aggregator - * plugins that require dependency resolution although they usually run in phases of the build where project - * artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare". + * plugins that require dependency resolution although they usually run in phases of the build where + * project artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare". */ artifacts = handleException( session, aggregating, e ); } @@ -178,15 +182,16 @@ public class LifecycleDependencyResolver MultipleArtifactsNotFoundException e ) throws MultipleArtifactsNotFoundException { - Set artifacts;/* + Set artifacts; + /* * MNG-2277, the check below compensates for our bad plugin support where we ended up with aggregator * plugins that require dependency resolution although they usually run in phases of the build where project * artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare". */ if ( aggregating && areAllArtifactsInReactor( session.getProjects(), e.getMissingArtifacts() ) ) { - logger.warn( "The following artifacts could not be resolved at this point of the build" + - " but seem to be part of the reactor:" ); + logger.warn( "The following artifacts could not be resolved at this point of the build" + + " but seem to be part of the reactor:" ); for ( Artifact artifact : e.getMissingArtifacts() ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java index 2498420f08..c7eb516253 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java @@ -1,25 +1,34 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.LifecycleNotFoundException; import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; import org.apache.maven.lifecycle.MavenExecutionPlan; -import org.apache.maven.plugin.*; +import org.apache.maven.plugin.InvalidPluginDescriptorException; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.MojoNotFoundException; +import org.apache.maven.plugin.PluginDescriptorParsingException; +import org.apache.maven.plugin.PluginNotFoundException; +import org.apache.maven.plugin.PluginResolutionException; import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; import org.apache.maven.plugin.version.PluginVersionResolutionException; import org.apache.maven.project.MavenProject; @@ -38,7 +47,7 @@ public interface LifecycleExecutionPlanCalculator PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException; - public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session ) + void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session ) throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorImpl.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorImpl.java index 6778c5608b..65de1477c9 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorImpl.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorImpl.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.artifact.repository.DefaultRepositoryRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.DefaultLifecycles; @@ -244,11 +249,10 @@ public class LifecycleExecutionPlanCalculatorImpl if ( lifecycle == null ) { - throw new LifecyclePhaseNotFoundException( - "Unknown lifecycle phase \"" + lifecyclePhase + "\". You must specify a valid lifecycle phase" + - " or a goal in the format : or" + - " :[:]:. Available lifecycle phases are: " + - defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase ); + throw new LifecyclePhaseNotFoundException( "Unknown lifecycle phase \"" + lifecyclePhase + + "\". You must specify a valid lifecycle phase" + " or a goal in the format : or" + + " :[:]:. Available lifecycle phases are: " + + defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase ); } /* @@ -302,9 +306,10 @@ public class LifecycleExecutionPlanCalculatorImpl { for ( String goal : execution.getGoals() ) { - MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, - DefaultRepositoryRequest.getRepositoryRequest( - session, project ) ); + MojoDescriptor mojoDescriptor = + pluginManager.getMojoDescriptor( plugin, goal, + DefaultRepositoryRequest.getRepositoryRequest( session, + project ) ); Map> phaseBindings = mappings.get( mojoDescriptor.getPhase() ); if ( phaseBindings != null ) @@ -457,8 +462,8 @@ public class LifecycleExecutionPlanCalculatorImpl { parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() ); - if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) && - StringUtils.isNotEmpty( parameter.getImplementation() ) ) + if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) + && StringUtils.isNotEmpty( parameter.getImplementation() ) ) { parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() ); } @@ -481,8 +486,7 @@ public class LifecycleExecutionPlanCalculatorImpl PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException { - calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet() ); - + calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet() ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java index b45bab309b..1b33da6c8c 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java @@ -1,20 +1,24 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.BuildSuccess; import org.apache.maven.execution.ExecutionEvent; @@ -35,7 +39,7 @@ import java.util.HashSet; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifecycleModuleBuilder.class) +@Component( role = LifecycleModuleBuilder.class ) public class LifecycleModuleBuilder { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginAnalyzerImpl.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginAnalyzerImpl.java index 091686179b..f79e1543b8 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginAnalyzerImpl.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginAnalyzerImpl.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.lifecycle.DefaultLifecycles; import org.apache.maven.lifecycle.LifeCyclePluginAnalyzer; import org.apache.maven.lifecycle.Lifecycle; @@ -37,7 +42,7 @@ import java.util.Set; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifeCyclePluginAnalyzer.class) +@Component( role = LifeCyclePluginAnalyzer.class ) public class LifecyclePluginAnalyzerImpl implements LifeCyclePluginAnalyzer { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java index 8e2c02eb45..38ab1c5476 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginManagement; @@ -34,7 +39,7 @@ import java.util.Map; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifecyclePluginResolver.class) +@Component( role = LifecyclePluginResolver.class ) public class LifecyclePluginResolver { @Requirement @@ -46,7 +51,7 @@ public class LifecyclePluginResolver this.pluginVersionResolver = pluginVersionResolver; } - @SuppressWarnings({"UnusedDeclaration"}) + @SuppressWarnings( { "UnusedDeclaration" } ) public LifecyclePluginResolver() { } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java index cef192820a..f77ebd1e31 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.ExecutionEvent; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenExecutionResult; @@ -81,9 +86,9 @@ public class LifecycleStarter { if ( !session.isUsingPOMsFromFilesystem() && lifecycleTaskSegmentCalculator.requiresProject( session ) ) { - throw new MissingProjectException( "The goal you specified requires a project to execute" + - " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")." + - " Please verify you invoked Maven from the correct directory." ); + throw new MissingProjectException( "The goal you specified requires a project to execute" + + " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")." + + " Please verify you invoked Maven from the correct directory." ); } final MavenExecutionRequest executionRequest = session.getRequest(); @@ -96,10 +101,10 @@ public class LifecycleStarter if ( projectBuilds.isEmpty() ) { - throw new NoGoalSpecifiedException( "No goals have been specified for this build." + - " You must specify a valid lifecycle phase or a goal in the format : or" + - " :[:]:." + - " Available lifecycle phases are: " + defaultLifeCycles.getLifecyclePhaseList() + "." ); + throw new NoGoalSpecifiedException( "No goals have been specified for this build." + + " You must specify a valid lifecycle phase or a goal in the format : or" + + " :[:]:." + + " Available lifecycle phases are: " + defaultLifeCycles.getLifecyclePhaseList() + "." ); } ProjectIndex projectIndex = new ProjectIndex( session.getProjects() ); @@ -117,9 +122,10 @@ public class LifecycleStarter if ( isThreaded ) { - ExecutorService executor = threadConfigService.getExecutorService( executionRequest.getThreadCount(), - executionRequest.isPerCoreThreadCount(), - session.getProjects().size() ); + ExecutorService executor = + threadConfigService.getExecutorService( executionRequest.getThreadCount(), + executionRequest.isPerCoreThreadCount(), + session.getProjects().size() ); try { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java index 2d8cd23031..6a324ec459 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java @@ -1,20 +1,24 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /** * A task that is a lifecycle *

diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java index 4c86eb2e22..6d3a22852a 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java @@ -1,23 +1,32 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.LifecycleNotFoundException; import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; -import org.apache.maven.plugin.*; +import org.apache.maven.plugin.InvalidPluginDescriptorException; +import org.apache.maven.plugin.MojoNotFoundException; +import org.apache.maven.plugin.PluginDescriptorParsingException; +import org.apache.maven.plugin.PluginNotFoundException; +import org.apache.maven.plugin.PluginResolutionException; import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; import org.apache.maven.plugin.version.PluginVersionResolutionException; @@ -36,11 +45,11 @@ import java.util.List; public interface LifecycleTaskSegmentCalculator { - public List calculateTaskSegments( MavenSession session ) + List calculateTaskSegments( MavenSession session ) throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException, PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException; - public boolean requiresProject( MavenSession session ); + boolean requiresProject( MavenSession session ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImpl.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImpl.java index 07e0177f7c..dd51f0040a 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImpl.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImpl.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.LifecycleNotFoundException; import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java index a413b4d5fa..e11a13461a 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleThreadedBuilder.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.annotations.Component; @@ -35,11 +40,10 @@ import java.util.concurrent.Future; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = LifecycleThreadedBuilder.class) +@Component( role = LifecycleThreadedBuilder.class ) public class LifecycleThreadedBuilder { - @Requirement private Logger logger; @@ -47,7 +51,7 @@ public class LifecycleThreadedBuilder private LifecycleModuleBuilder lifecycleModuleBuilder; - @SuppressWarnings({"UnusedDeclaration"}) + @SuppressWarnings( { "UnusedDeclaration" } ) public LifecycleThreadedBuilder() { } @@ -65,7 +69,8 @@ public class LifecycleThreadedBuilder Map projectBuildMap = projectBuilds.selectSegment( taskSegment ); try { - multiThreadedProjectTaskSegmentBuild( analyzer, reactorContext, session, service, taskSegment, projectBuildMap, muxer ); + multiThreadedProjectTaskSegmentBuild( analyzer, reactorContext, session, service, taskSegment, + projectBuildMap, muxer ); if ( reactorContext.getReactorBuildStatus().isHalted( ) ) { break; @@ -82,7 +87,8 @@ public class LifecycleThreadedBuilder private void multiThreadedProjectTaskSegmentBuild( ConcurrencyDependencyGraph analyzer, ReactorContext reactorContext, MavenSession rootSession, CompletionService service, - TaskSegment taskSegment, Map projectBuildList, + TaskSegment taskSegment, + Map projectBuildList, ThreadOutputMuxer muxer ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java index 6641fb69e8..0c78e9556c 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.execution.BuildSuccess; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java index 887ecfb50d..5e86785e8b 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java @@ -1,27 +1,41 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.artifact.repository.DefaultRepositoryRequest; import org.apache.maven.artifact.repository.RepositoryRequest; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.*; +import org.apache.maven.plugin.BuildPluginManager; +import org.apache.maven.plugin.InvalidPluginDescriptorException; +import org.apache.maven.plugin.MojoNotFoundException; +import org.apache.maven.plugin.PluginDescriptorParsingException; +import org.apache.maven.plugin.PluginNotFoundException; +import org.apache.maven.plugin.PluginResolutionException; import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.prefix.*; +import org.apache.maven.plugin.prefix.DefaultPluginPrefixRequest; +import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; +import org.apache.maven.plugin.prefix.PluginPrefixRequest; +import org.apache.maven.plugin.prefix.PluginPrefixResolver; +import org.apache.maven.plugin.prefix.PluginPrefixResult; import org.apache.maven.plugin.version.DefaultPluginVersionRequest; import org.apache.maven.plugin.version.PluginVersionRequest; import org.apache.maven.plugin.version.PluginVersionResolutionException; @@ -47,7 +61,7 @@ import java.util.StringTokenizer; * NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = MojoDescriptorCreator.class) +@Component( role = MojoDescriptorCreator.class ) public class MojoDescriptorCreator { @Requirement @@ -59,7 +73,7 @@ public class MojoDescriptorCreator @Requirement private PluginPrefixResolver pluginPrefixResolver; - @SuppressWarnings({"UnusedDeclaration"}) + @SuppressWarnings( { "UnusedDeclaration" } ) public MojoDescriptorCreator() { } @@ -199,9 +213,10 @@ public class MojoDescriptorCreator return pluginManager.getMojoDescriptor( plugin, goal, repositoryRequest ); } - //TODO: take repo mans into account as one may be aggregating prefixes of many - //TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing - // or the user forces the issue + + // TODO: take repo mans into account as one may be aggregating prefixes of many + // TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing + // or the user forces the issue public Plugin findPluginForPrefix( String prefix, MavenSession session ) throws NoPluginFoundForPrefixException @@ -225,7 +240,6 @@ public class MojoDescriptorCreator plugin.setVersion( pluginVersionResolver.resolve( versionRequest ).getVersion() ); } - private void injectPluginDeclarationFromProject( Plugin plugin, MavenProject project ) { Plugin pluginInPom = findPlugin( plugin, project.getBuildPlugins() ); @@ -251,6 +265,4 @@ public class MojoDescriptorCreator return findPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugins ); } - } - diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java index c1e621aa92..c7ae7b837e 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java @@ -1,26 +1,36 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter; import org.apache.maven.execution.ExecutionEvent; import org.apache.maven.execution.MavenSession; import org.apache.maven.lifecycle.LifecycleExecutionException; import org.apache.maven.lifecycle.MissingProjectException; -import org.apache.maven.plugin.*; +import org.apache.maven.plugin.BuildPluginManager; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.PluginConfigurationException; +import org.apache.maven.plugin.PluginManagerException; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.component.annotations.Component; @@ -41,7 +51,7 @@ import java.util.Map; *

* NOTE: This class is not part of any public api and can be changed or deleted without prior notice. */ -@Component(role = MojoExecutor.class) +@Component( role = MojoExecutor.class ) public class MojoExecutor { @@ -78,7 +88,7 @@ public class MojoExecutor phaseRecorder.observeExecution( mojoExecution ); } - @SuppressWarnings({"ThrowableInstanceNeverThrown"}) + @SuppressWarnings( { "ThrowableInstanceNeverThrown" } ) private void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex, DependencyContext dependencyContext ) throws LifecycleExecutionException @@ -87,10 +97,10 @@ public class MojoExecutor if ( mojoDescriptor.isProjectRequired() && !session.isUsingPOMsFromFilesystem() ) { - Throwable cause = new MissingProjectException( - "Goal requires a project to execute" + " but there is no POM in this directory (" + - session.getExecutionRootDirectory() + ")." + - " Please verify you invoked Maven from the correct directory." ); + Throwable cause = + new MissingProjectException( "Goal requires a project to execute" + + " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")." + + " Please verify you invoked Maven from the correct directory." ); throw new LifecycleExecutionException( mojoExecution, null, cause ); } @@ -98,8 +108,9 @@ public class MojoExecutor { if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) ) { - Throwable cause = new IllegalStateException( - "Goal requires online mode for execution" + " but Maven is currently offline." ); + Throwable cause = + new IllegalStateException( "Goal requires online mode for execution" + + " but Maven is currently offline." ); throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), cause ); } else @@ -270,6 +281,4 @@ public class MojoExecutor return forkedProjects; } - - } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java index ba25fb0675..5b4bf64489 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.plugin.MojoExecution; import org.apache.maven.project.MavenProject; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java index 19c6ebe9b4..7cdfcb5bc0 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java @@ -1,25 +1,37 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import java.util.*; - /** * A list of project segments, ordered so that all ProjectSegments from first TaskSegment come before any * subsequent TaskSegments. @@ -33,9 +45,6 @@ public class ProjectBuildList { private final List items; - - - public ProjectBuildList( List items ) { this.items = Collections.unmodifiableList( items ); @@ -47,25 +56,27 @@ public class ProjectBuildList * @param taskSegment the requested tasksegment * @return a project build list for the supplied task segment */ - public ProjectBuildList getByTaskSegment(TaskSegment taskSegment) + public ProjectBuildList getByTaskSegment( TaskSegment taskSegment ) { List currentSegment = new ArrayList(); for ( ProjectSegment projectBuild : items ) { - if ( taskSegment == projectBuild.getTaskSegment()){ // NOTE: There's no notion of taskSegment equality. + if ( taskSegment == projectBuild.getTaskSegment() ) + { // NOTE: There's no notion of taskSegment equality. currentSegment.add( projectBuild ); } } return new ProjectBuildList( currentSegment ); } - - public Map selectSegment(TaskSegment taskSegment) + + public Map selectSegment( TaskSegment taskSegment ) { - Map result = new HashMap( ); + Map result = new HashMap(); for ( ProjectSegment projectBuild : items ) { - if ( taskSegment == projectBuild.getTaskSegment()){ // NOTE: There's no notion of taskSegment equality. - result.put( projectBuild.getProject(), projectBuild ); + if ( taskSegment == projectBuild.getTaskSegment() ) + { // NOTE: There's no notion of taskSegment equality. + result.put( projectBuild.getProject(), projectBuild ); } } return result; @@ -76,11 +87,12 @@ public class ProjectBuildList * @param mavenProject the requested project * @return The projectSegment or null. */ - public ProjectSegment findByMavenProject(MavenProject mavenProject) + public ProjectSegment findByMavenProject( MavenProject mavenProject ) { for ( ProjectSegment projectBuild : items ) { - if ( mavenProject.equals( projectBuild.getProject() )){ + if ( mavenProject.equals( projectBuild.getProject() ) ) + { return projectBuild; } } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java index ab63de4e43..8b8308ee96 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.project.MavenProject; import java.util.HashMap; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java index ee486529a1..32ae421981 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.ProjectDependencyGraph; import org.apache.maven.project.MavenProject; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java index f76c68a8b6..17791aa1ef 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.ProjectDependencyGraph; import org.apache.maven.project.MavenProject; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java index e8e24b0f93..01caf22301 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java @@ -1,20 +1,24 @@ -/* - * 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. - */ - package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.execution.MavenExecutionResult; /** diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java index 953224c50e..5aeae49385 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadConfigurationService.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadConfigurationService.java index 4faf0dd0df..b1d4d03953 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadConfigurationService.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadConfigurationService.java @@ -26,7 +26,7 @@ import org.codehaus.plexus.logging.Logger; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -@Component(role = ThreadConfigurationService.class) +@Component( role = ThreadConfigurationService.class ) public class ThreadConfigurationService { @Requirement @@ -35,7 +35,7 @@ public class ThreadConfigurationService private final int cpuCores; - @SuppressWarnings({"UnusedDeclaration"}) + @SuppressWarnings( { "UnusedDeclaration" } ) public ThreadConfigurationService() { cpuCores = Runtime.getRuntime().availableProcessors(); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadOutputMuxer.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadOutputMuxer.java index 0950eafd97..7cb03d92f3 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadOutputMuxer.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ThreadOutputMuxer.java @@ -1,19 +1,24 @@ -/* - * 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. - */ package org.apache.maven.lifecycle.internal; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; @@ -31,14 +36,15 @@ import java.util.Set; * This class in particular may spontaneusly self-combust and be replaced by a plexus-compliant thread aware * logger implementation at any time. */ -@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"}) +@SuppressWarnings( { "SynchronizationOnLocalVariableOrMethodParameter" } ) public class ThreadOutputMuxer { private final Iterator projects; private final ThreadLocal projectBuildThreadLocal = new ThreadLocal(); - private final Map streams = new HashMap(); + private final Map streams = + new HashMap(); private final Map printStreams = new HashMap(); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java index 7ac0c5ca07..9947e2fcce 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java @@ -1,18 +1,22 @@ package org.apache.maven.lifecycle.mapping; /* - * 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. + * 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; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java index c9f902aa06..6adf4f341d 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java @@ -35,7 +35,7 @@ public class Lifecycle /** * Field phases */ - private Map phases; + private Map phases; /* * NOTE: This exists merely for backward-compat with legacy-style lifecycle definitions and allows configuration @@ -55,7 +55,7 @@ public class Lifecycle /** * Method getPhases */ - public Map getPhases() + public Map getPhases() { return this.phases; } @@ -68,16 +68,16 @@ public class Lifecycle public void setId( String id ) { this.id = id; - } + } /** * Method setPhases * * @param phases */ - public void setPhases( Map phases ) + public void setPhases( Map phases ) { this.phases = phases; - } //-- void setPhases(java.util.List) + } //-- void setPhases(java.util.List) } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java index 6b61396097..8cdc7fb1f9 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java @@ -1,18 +1,22 @@ package org.apache.maven.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. + * 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.RepositoryRequest; @@ -29,11 +33,13 @@ public interface BuildPluginManager { // igorf: Way too many declared exceptions! PluginDescriptor loadPlugin( Plugin plugin, RepositoryRequest repositoryRequest ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException; + throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, + InvalidPluginDescriptorException; // igorf: Way too many declared exceptions! MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, RepositoryRequest repositoryRequest ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException; + throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, + MojoNotFoundException, InvalidPluginDescriptorException; ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor ) throws PluginResolutionException, PluginManagerException; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java index 7f593b5abb..4005349b47 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java @@ -1,18 +1,22 @@ package org.apache.maven.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. + * 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.ByteArrayOutputStream; @@ -32,7 +36,7 @@ import org.codehaus.plexus.component.annotations.Requirement; // TODO: the antrun plugin has its own configurator, the only plugin that does. might need to think about how that works // TODO: remove the coreArtifactFilterManager -@Component(role = BuildPluginManager.class) +@Component( role = BuildPluginManager.class ) public class DefaultBuildPluginManager implements BuildPluginManager { @@ -47,16 +51,17 @@ public class DefaultBuildPluginManager private LegacySupport legacySupport; /** - * + * * @param plugin * @param repositoryRequest * @return PluginDescriptor The component descriptor for the Maven plugin. * @throws PluginNotFoundException The plugin could not be found in any repositories. * @throws PluginResolutionException The plugin could be found but could not be resolved. - * @throws InvalidPluginDescriptorException + * @throws InvalidPluginDescriptorException */ public PluginDescriptor loadPlugin( Plugin plugin, RepositoryRequest repositoryRequest ) - throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException + throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, + InvalidPluginDescriptorException { return mavenPluginManager.getPluginDescriptor( plugin, repositoryRequest ); } @@ -170,9 +175,9 @@ public class DefaultBuildPluginManager /** * TODO pluginDescriptor classRealm and artifacts are set as a side effect of this * call, which is not nice. - * @throws PluginResolutionException + * @throws PluginResolutionException */ - public ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor ) + public ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor ) throws PluginResolutionException, PluginManagerException { ClassRealm pluginRealm = pluginDescriptor.getClassRealm(); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java index f5169ee758..2e73beed79 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java @@ -115,9 +115,10 @@ public class DefaultPluginRealmCache remoteRepositories ) ); } - public CacheRecord put( Plugin plugin, ClassLoader parentRealm, List parentImports,ArtifactFilter dependencyFilter, - ArtifactRepository localRepository, List remoteRepositories, - ClassRealm pluginRealm, List pluginArtifacts ) + public CacheRecord put( Plugin plugin, ClassLoader parentRealm, List parentImports, + ArtifactFilter dependencyFilter, ArtifactRepository localRepository, + List remoteRepositories, ClassRealm pluginRealm, + List pluginArtifacts ) { if ( pluginRealm == null || pluginArtifacts == null ) { @@ -177,7 +178,7 @@ public class DefaultPluginRealmCache { return eq( a.getGroupId(), b.getGroupId() ) // && eq( a.getArtifactId(), b.getArtifactId() ) // - && eq( a.getVersion(), b.getVersion() ) // + && eq( a.getVersion(), b.getVersion() ) // && a.isExtensions() == b.isExtensions() // && dependenciesEquals( a.getDependencies(), b.getDependencies() ); } @@ -199,7 +200,7 @@ public class DefaultPluginRealmCache boolean r = eq( aD.getGroupId(), bD.getGroupId() ) // && eq( aD.getArtifactId(), bD.getArtifactId() ) // - && eq( aD.getVersion(), bD.getVersion() ) // + && eq( aD.getVersion(), bD.getVersion() ) // && eq( aD.getType(), bD.getType() ) // && eq( aD.getClassifier(), bD.getClassifier() ) // && eq( aD.getScope(), bD.getScope() ); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java b/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java index 4c425b782d..73236915e8 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java @@ -1,8 +1,5 @@ package org.apache.maven.plugin; -import org.apache.maven.project.ProjectBuildingException; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,6 +19,9 @@ import org.apache.maven.project.artifact.InvalidDependencyVersionException; * under the License. */ +import org.apache.maven.project.ProjectBuildingException; +import org.apache.maven.project.artifact.InvalidDependencyVersionException; + /** * Thrown when a plugin is not internally consistent. * diff --git a/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java b/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java index 0af90c84c2..2eb2738b1c 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java @@ -1,18 +1,22 @@ package org.apache.maven.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. + * 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; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java index f414edd487..13b33e7d90 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java @@ -49,24 +49,27 @@ public class PluginConfigurationException this.originalMessage = originalMessage; } - public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, ExpressionEvaluationException cause ) + public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, + ExpressionEvaluationException cause ) { super( originalMessage, cause ); this.pluginDescriptor = pluginDescriptor; this.originalMessage = originalMessage; } - public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, ComponentConfigurationException cause ) - { - super( originalMessage, cause ); - this.pluginDescriptor = pluginDescriptor; - this.originalMessage = originalMessage; - } + public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, + ComponentConfigurationException cause ) + { + super( originalMessage, cause ); + this.pluginDescriptor = pluginDescriptor; + this.originalMessage = originalMessage; + } - public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, ComponentLookupException cause ) - { - super( originalMessage, cause ); - this.pluginDescriptor = pluginDescriptor; - this.originalMessage = originalMessage; - } + public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, + ComponentLookupException cause ) + { + super( originalMessage, cause ); + this.pluginDescriptor = pluginDescriptor; + this.originalMessage = originalMessage; + } } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java index f6122ee433..83009de22d 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java @@ -49,7 +49,8 @@ public class PluginContainerException this.pluginRealm = pluginRealm; } - public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, ComponentLookupException e ) + public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, + ComponentLookupException e ) { super( mojoDescriptor, message, e ); @@ -63,14 +64,16 @@ public class PluginContainerException this.pluginRealm = pluginRealm; } - public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, PlexusConfigurationException e ) + public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, + PlexusConfigurationException e ) { super( plugin, message, e ); this.pluginRealm = pluginRealm; } - public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, ComponentRepositoryException e ) + public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, + ComponentRepositoryException e ) { super( plugin, message, e ); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java index b380529c97..f0f652a0c4 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java @@ -47,7 +47,8 @@ public class PluginExecutionException this.mojoExecution = mojoExecution; } - public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, DuplicateArtifactAttachmentException cause ) + public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, + DuplicateArtifactAttachmentException cause ) { super( mojoExecution.getMojoDescriptor(), project, constructMessage( mojoExecution, cause ), cause ); this.mojoExecution = mojoExecution; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java index 5fbce2f003..85a21db303 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java @@ -1,15 +1,5 @@ package org.apache.maven.plugin; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.PlexusContainerException; -import org.codehaus.plexus.classworlds.realm.NoSuchRealmException; -import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException; -import org.codehaus.plexus.configuration.PlexusConfigurationException; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -29,6 +19,16 @@ import org.codehaus.plexus.configuration.PlexusConfigurationException; * under the License. */ +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.model.Plugin; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.PlexusContainerException; +import org.codehaus.plexus.classworlds.realm.NoSuchRealmException; +import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException; +import org.codehaus.plexus.configuration.PlexusConfigurationException; + /** * Exception in the plugin manager. * @@ -87,7 +87,8 @@ public class PluginManagerException goal = mojoDescriptor.getGoal(); } - protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, Throwable cause ) + protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, + Throwable cause ) { super( message, cause ); this.project = project; @@ -124,7 +125,8 @@ public class PluginManagerException pluginVersion = plugin.getVersion(); } - public PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, NoSuchRealmException cause ) + public PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message, + NoSuchRealmException cause ) { super( message, cause ); @@ -135,7 +137,8 @@ public class PluginManagerException goal = mojoDescriptor.getGoal(); } - public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project, PlexusContainerException cause ) + public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project, + PlexusContainerException cause ) { super( message, cause ); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java index b4d323289f..bd1cc34242 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java @@ -46,14 +46,16 @@ public class PluginParameterExpressionEvaluator private String basedir; - private Properties properties; + private Properties properties; @Deprecated //TODO: used by the Enforcer plugin - public PluginParameterExpressionEvaluator( MavenSession session, MojoExecution mojoExecution, PathTranslator pathTranslator, Logger logger, MavenProject project, Properties properties ) + public PluginParameterExpressionEvaluator( MavenSession session, MojoExecution mojoExecution, + PathTranslator pathTranslator, Logger logger, MavenProject project, + Properties properties ) { this( session, mojoExecution ); } - + public PluginParameterExpressionEvaluator( MavenSession session ) { this( session, null ); @@ -65,7 +67,7 @@ public class PluginParameterExpressionEvaluator this.mojoExecution = mojoExecution; this.properties = session.getExecutionProperties(); this.project = session.getCurrentProject(); - + String basedir = null; if ( project != null ) @@ -225,7 +227,7 @@ public class PluginParameterExpressionEvaluator // TODO: don't catch exception throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression, e ); - } + } } else if ( expression.equals( "mojo" ) ) { @@ -276,13 +278,14 @@ public class PluginParameterExpressionEvaluator else { value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), pluginDescriptor ); - } + } } catch ( Exception e ) { - throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression, e ); + throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression, + e ); } - } + } else if ( "settings".equals( expression ) ) { value = session.getSettings(); @@ -389,16 +392,9 @@ public class PluginParameterExpressionEvaluator { return true; } - else if ( ( type.isPrimitive() || type.getName().startsWith( "java.lang." ) ) - && value.getClass().getName().startsWith( "java.lang." ) ) - { - // likely Boolean -> boolean, Short -> int etc. conversions, it's not the problem case we try to avoid - return true; - } - else - { - return false; - } + // likely Boolean -> boolean, Short -> int etc. conversions, it's not the problem case we try to avoid + return ( ( type.isPrimitive() || type.getName().startsWith( "java.lang." ) ) + && value.getClass().getName().startsWith( "java.lang." ) ); } private String stripTokens( String expr ) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java index c13d27a1a7..56deb5f6de 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java @@ -32,13 +32,13 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm; * Caches plugin class realms. Warning: This is an internal utility interface that is only public for * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without * prior notice. - * + * * @author Igor Fedorenko * @author Benjamin Bentmann */ public interface PluginRealmCache { - + public static class CacheRecord { public final ClassRealm realm; @@ -57,7 +57,8 @@ public interface PluginRealmCache CacheRecord put( Plugin plugin, ClassLoader parentRealm, List parentImports, ArtifactFilter dependencyFilter, ArtifactRepository localRepository, - List remoteRepositories, ClassRealm pluginRealm, List pluginArtifacts ); + List remoteRepositories, ClassRealm pluginRealm, + List pluginArtifacts ); void flush(); @@ -65,7 +66,7 @@ public interface PluginRealmCache * Registers the specified cache record for usage with the given project. Integrators can use the information * collected from this method in combination with a custom cache implementation to dispose unused records from the * cache. - * + * * @param project The project that employs the plugin realm, must not be {@code null}. * @param record The cache record being used for the project, must not be {@code null}. */ diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java index a5c1a09189..168b4ba3f2 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java @@ -100,7 +100,8 @@ public class DefaultPluginManager PluginDescriptor pluginDescriptor; try { - RepositoryRequest repositoryRequest = DefaultRepositoryRequest.getRepositoryRequest( session, session.getCurrentProject() ); + RepositoryRequest repositoryRequest = + DefaultRepositoryRequest.getRepositoryRequest( session, session.getCurrentProject() ); pluginDescriptor = pluginManager.getPluginDescriptor( plugin, repositoryRequest ); @@ -132,7 +133,8 @@ public class DefaultPluginManager PluginDescriptor pluginDescriptor; try { - RepositoryRequest repositoryRequest = DefaultRepositoryRequest.getRepositoryRequest( session, session.getCurrentProject() ); + RepositoryRequest repositoryRequest = + DefaultRepositoryRequest.getRepositoryRequest( session, session.getCurrentProject() ); pluginDescriptor = pluginManager.getPluginDescriptor( plugin, repositoryRequest ); diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java index 7a48cab7cc..9b2f94079b 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java @@ -31,7 +31,7 @@ import org.apache.maven.plugin.PluginResolutionException; * Assists in resolving the dependencies of a plugin. Warning: This is an internal utility interface * that is only public for technical reasons, it is not part of the public API. In particular, this interface can be * changed or deleted without prior notice. - * + * * @author Benjamin Bentmann */ public interface PluginDependenciesResolver @@ -39,19 +39,19 @@ public interface PluginDependenciesResolver /** * Resolves the main artifact of the specified plugin. - * + * * @param plugin The plugin for which to resolve the main artifact, must not be {@code null}. * @param request A prepopulated resolution request that will be completed and used for the resolution, must not be * {@code null}. * @return The resolved plugin artifact, never {@code null}. * @throws PluginResolutionException If the plugin artifact could not be resolved. */ - public Artifact resolve( Plugin plugin, ArtifactResolutionRequest request ) + Artifact resolve( Plugin plugin, ArtifactResolutionRequest request ) throws PluginResolutionException; /** * Resolves the runtime dependencies of the specified plugin. - * + * * @param plugin The plugin for which to resolve the dependencies, must not be {@code null}. * @param pluginArtifact The plugin's main artifact, may be {@code null}. * @param request A prepopulated resolution request that will be completed and used for the resolution, must not be diff --git a/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java index cd08256787..d47d3145fc 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java @@ -47,7 +47,7 @@ import org.codehaus.plexus.logging.Logger; /** * Resolves a plugin prefix. - * + * * @author Benjamin Bentmann */ @Component( role = PluginPrefixResolver.class ) @@ -221,7 +221,8 @@ public class DefaultPluginPrefixResolver repos.add( repository ); } - PluginPrefixResult result = resolveFromRepository( request, pluginGroup, groupMetadataFile, repository ); + PluginPrefixResult result = resolveFromRepository( request, pluginGroup, groupMetadataFile, + repository ); if ( result != null ) { @@ -250,7 +251,8 @@ public class DefaultPluginPrefixResolver try { - repositorySystem.retrieve( repository, groupMetadataFile, remotePath, request.getTransferListener() ); + repositorySystem.retrieve( repository, groupMetadataFile, remotePath, + request.getTransferListener() ); } catch ( ArtifactTransferFailedException e ) { @@ -270,7 +272,8 @@ public class DefaultPluginPrefixResolver continue; } - PluginPrefixResult result = resolveFromRepository( request, pluginGroup, groupMetadataFile, repository ); + PluginPrefixResult result = resolveFromRepository( request, pluginGroup, groupMetadataFile, + repository ); if ( result != null ) { diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java b/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java index a8d8a30f08..108ca27206 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java @@ -44,7 +44,7 @@ import org.codehaus.plexus.util.StringUtils; /** * Resolves a version for a plugin. - * + * * @author Benjamin Bentmann */ @Component( role = PluginVersionResolver.class ) @@ -115,7 +115,7 @@ public class DefaultPluginVersionResolver File artifactMetadataFile = new File( localRepository.getBasedir(), localPath ); - if ( !request.isOffline() && ( !artifactMetadataFile.exists() /* || user requests snapshot updates */) ) + if ( !request.isOffline() && ( !artifactMetadataFile.exists() /* || user requests snapshot updates */ ) ) { String remotePath = getRemoteMetadataPath( request, repository ); diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java index 0854d431e2..014bb56b6a 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java @@ -37,7 +37,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; -@Component(role = MavenProjectHelper.class) +@Component( role = MavenProjectHelper.class ) public class DefaultMavenProjectHelper extends AbstractLogEnabled implements MavenProjectHelper @@ -105,7 +105,8 @@ public class DefaultMavenProjectHelper { getLogger().warn( dae.getMessage() ); - // We can throw this because it's unchecked, and won't change the MavenProjectHelper API, which would break backward compat if it did. + // We can throw this because it's unchecked, and won't change the MavenProjectHelper API, which would break + // backward compat if it did. throw dae; } } @@ -149,7 +150,8 @@ public class DefaultMavenProjectHelper { throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), parent.getType(), - "An attached artifact must have a different ID than its corresponding main artifact." ); + "An attached artifact must have a different ID than " + + "its corresponding main artifact." ); } } diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index dc8989c5a7..7b471d3129 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -51,7 +55,7 @@ import org.codehaus.plexus.util.StringUtils; /** * @version $Id$ */ -@Component(role = ProjectBuilder.class) +@Component( role = ProjectBuilder.class ) public class DefaultProjectBuilder implements ProjectBuilder { @@ -107,11 +111,11 @@ public class DefaultProjectBuilder DefaultModelBuildingListener listener = new DefaultModelBuildingListener( project, projectBuildingHelper, configuration ); request.setModelBuildingListener( listener ); - + request.setPomFile( pomFile ); request.setModelSource( modelSource ); request.setLocationTracking( pomFile != null ); - + ModelBuildingResult result; try { @@ -210,7 +214,9 @@ public class DefaultProjectBuilder { if ( !artifact.getType().equals( "pom" ) ) { - artifact = repositorySystem.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); + artifact = + repositorySystem.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), + artifact.getVersion() ); } ArtifactResolutionRequest request = new ArtifactResolutionRequest() diff --git a/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java b/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java index 42f66c3575..ccfc2cd733 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java +++ b/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java @@ -1,7 +1,5 @@ package org.apache.maven.project; -import java.io.File; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -21,6 +19,8 @@ import java.io.File; * under the License. */ +import java.io.File; + /** * Exception that occurs when the project list contains duplicate projects instead of ignoring one. * diff --git a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java index 9122b90ea2..7e8dd0372d 100644 --- a/maven-core/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-core/src/main/java/org/apache/maven/project/MavenProject.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -166,7 +170,7 @@ public class MavenProject private ProjectBuildingRequest projectBuilderConfiguration; private RepositorySystem repositorySystem; - + private File parentFile; private Map context; @@ -201,10 +205,10 @@ public class MavenProject { deepCopy( project ); } - + @Deprecated public MavenProject( Model model, RepositorySystem repositorySystem ) - { + { this.repositorySystem = repositorySystem; setModel( model ); } @@ -221,13 +225,14 @@ public class MavenProject /** * Constructor - * + * * @param repositorySystem - may not be null * @param mavenProjectBuilder * @param projectBuilderConfiguration * @throws InvalidRepositoryException */ - MavenProject( RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder, ProjectBuildingRequest projectBuilderConfiguration ) + MavenProject( RepositorySystem repositorySystem, ProjectBuilder mavenProjectBuilder, + ProjectBuildingRequest projectBuilderConfiguration ) { if ( repositorySystem == null ) { @@ -364,7 +369,7 @@ public class MavenProject { this.parent = parent; } - + public boolean hasParent() { return getParent() != null; @@ -485,11 +490,12 @@ public class MavenProject list.add( getBuild().getOutputDirectory() ); for ( Artifact a : getArtifacts() ) - { + { if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) + if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) + || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { addArtifactPath( a, list ); } @@ -510,7 +516,8 @@ public class MavenProject if ( a.getArtifactHandler().isAddedToClasspath() ) { // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) + if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) + || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { list.add( a ); } @@ -534,7 +541,8 @@ public class MavenProject for ( Artifact a : getArtifacts() ) { // TODO: let the scope handler deal with this - if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) + if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) + || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) { Dependency dependency = new Dependency(); @@ -561,11 +569,11 @@ public class MavenProject list.add( getBuild().getTestOutputDirectory() ); list.add( getBuild().getOutputDirectory() ); - + for ( Artifact a : getArtifacts() ) - { + { if ( a.getArtifactHandler().isAddedToClasspath() ) - { + { addArtifactPath( a, list ); } } @@ -1053,7 +1061,7 @@ public class MavenProject * All dependencies that this project has, including transitive ones. Contents are lazily * populated, so depending on what phases have run dependencies in some scopes won't be * included. eg. if only compile phase has run, dependencies with scope test won't be included. - * + * * @return {@link Set} < {@link Artifact} > * @see #getDependencyArtifacts() to get only direct dependencies */ @@ -1227,7 +1235,8 @@ public class MavenProject version = ext.getVersion(); } - Artifact artifact = repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" ); + Artifact artifact = + repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" ); if ( artifact != null ) { @@ -1361,7 +1370,8 @@ public class MavenProject public ArtifactRepository getDistributionManagementArtifactRepository() { - return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository() : getReleaseArtifactRepository(); + return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository() + : getReleaseArtifactRepository(); } public List getPluginRepositories() @@ -1397,7 +1407,7 @@ public class MavenProject * settings.xml}. The profile identifiers are grouped by the identifier of their source, e.g. {@code * ::} for a POM profile or {@code external} for profiles from the {@code * settings.xml}. - * + * * @return The identifiers of all injected profiles, indexed by the source from which the profiles originated, never * {@code null}. */ @@ -1537,7 +1547,7 @@ public class MavenProject /** * Direct dependencies that this project has. - * + * * @return {@link Set} < {@link Artifact} > * @see #getArtifacts() to get all transitive dependencies */ @@ -1589,7 +1599,8 @@ public class MavenProject List deps; DependencyManagement dependencyManagement = getDependencyManagement(); - if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) && ( deps.size() > 0 ) ) + if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null ) + && ( deps.size() > 0 ) ) { map = new HashMap(); for ( Iterator i = dependencyManagement.getDependencies().iterator(); i.hasNext(); ) @@ -1664,7 +1675,8 @@ public class MavenProject public void addProjectReference( MavenProject project ) { - projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project ); + projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), + project.getVersion() ), project ); } /** @@ -1822,7 +1834,7 @@ public class MavenProject { } } - + return releaseArtifactRepository; } @@ -1842,7 +1854,7 @@ public class MavenProject { } } - + return snapshotArtifactRepository; } @@ -1970,9 +1982,9 @@ public class MavenProject * Sets the value of the context value of this project identified * by the given key. If the supplied value is null, * the context value is removed from this project. - * + * * Context values are intended to allow core extensions to associate - * derived state with project instances. + * derived state with project instances. */ public void setContextValue( String key, Object value ) { @@ -1991,8 +2003,8 @@ public class MavenProject } /** - * Returns context value of this project associated with the given key - * or null if this project has no such value. + * Returns context value of this project associated with the given key + * or null if this project has no such value. */ public Object getContextValue( String key ) { @@ -2007,7 +2019,7 @@ public class MavenProject * Sets the project's class realm. Warning: This is an internal utility method that is only public * for technical reasons, it is not part of the public API. In particular, this method can be changed or deleted * without prior notice and must not be used by plugins. - * + * * @param classRealm The class realm hosting the build extensions of this project, may be {@code null}. */ public void setClassRealm( ClassRealm classRealm ) @@ -2020,7 +2032,7 @@ public class MavenProject * Warning: This is an internal utility method that is only public for technical reasons, it is not * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be * used by plugins. - * + * * @return The project's class realm or {@code null}. */ public ClassRealm getClassRealm() @@ -2032,7 +2044,7 @@ public class MavenProject * Sets the artifact filter used to exclude shared extension artifacts from plugin realms. Warning: * This is an internal utility method that is only public for technical reasons, it is not part of the public API. * In particular, this method can be changed or deleted without prior notice and must not be used by plugins. - * + * * @param extensionArtifactFilter The artifact filter to apply to plugins, may be {@code null}. */ public void setExtensionArtifactFilter( ArtifactFilter extensionArtifactFilter ) @@ -2044,7 +2056,7 @@ public class MavenProject * Gets the artifact filter used to exclude shared extension artifacts from plugin realms. Warning: * This is an internal utility method that is only public for technical reasons, it is not part of the public API. * In particular, this method can be changed or deleted without prior notice and must not be used by plugins. - * + * * @return The artifact filter or {@code null}. */ public ArtifactFilter getExtensionArtifactFilter() @@ -2057,7 +2069,7 @@ public class MavenProject * Warning: This is an internal utility method that is only public for technical reasons, it is not * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be * used by plugins. - * + * * @param artifacts The set of artifacts, may be {@code null}. */ public void setResolvedArtifacts( Set artifacts ) @@ -2072,7 +2084,7 @@ public class MavenProject * Warning: This is an internal utility method that is only public for technical reasons, it is not * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be * used by plugins. - * + * * @param artifactFilter The artifact filter, may be {@code null} to exclude all artifacts. */ public void setArtifactFilter( ArtifactFilter artifactFilter ) @@ -2098,7 +2110,7 @@ public class MavenProject * Warning: This is an internal utility method that is only public for technical reasons, it is not * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be * used by plugins. - * + * * @param lifecyclePhase The lifecycle phase to add, must not be {@code null}. */ public void addLifecyclePhase( String lifecyclePhase ) diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java index 4599bd1a4b..371528942b 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java @@ -1,18 +1,22 @@ 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. + * 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; @@ -29,7 +33,7 @@ public interface ProjectBuilder /** * Builds a project descriptor from the specified POM file. - * + * * @param projectFile The POM file to build the project from, must not be {@code null}. * @param request The project building request that holds further parameters, must not be {@code null}. * @return The result of the project building, never {@code null}. @@ -40,7 +44,7 @@ public interface ProjectBuilder /** * Builds a project descriptor for the specified artifact. - * + * * @param projectArtifact The POM artifact to build the project from, must not be {@code null}. * @param request The project building request that holds further parameters, must not be {@code null}. * @return The result of the project building, never {@code null}. @@ -51,7 +55,7 @@ public interface ProjectBuilder /** * Builds a project descriptor for the specified artifact. - * + * * @param projectArtifact The POM artifact to build the project from, must not be {@code null}. * @param allowStubModel A flag controlling the case of a missing POM artifact. If {@code true} and the specified * POM artifact does not exist, a simple stub model will be returned. If {@code false}, an exception will @@ -65,7 +69,7 @@ public interface ProjectBuilder /** * Builds a project descriptor for the specified model source. - * + * * @param modelSource The source of the model to built the project descriptor from, must not be {@code null}. * @param request The project building request that holds further parameters, must not be {@code null}. * @return The result of the project building, never {@code null}. @@ -76,7 +80,7 @@ public interface ProjectBuilder /** * Builds the projects for the specified POM files and optionally their children. - * + * * @param pomFiles The POM files to build, must not be {@code null}. * @param recursive {@code true} to recursively build sub modules referenced by the POM files, {@code false} to * build only the specified POM files. diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java index f48bc320f5..e7a4ed4550 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java @@ -30,7 +30,7 @@ public interface ProjectBuilderConfiguration extends ProjectBuildingRequest { ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository ); - + ArtifactRepository getLocalRepository(); ProjectBuilderConfiguration setRemoteRepositories( List remoteRepositories ); @@ -41,36 +41,36 @@ public interface ProjectBuilderConfiguration Properties getSystemProperties(); - void setProject(MavenProject mavenProject); + void setProject( MavenProject mavenProject ); MavenProject getProject(); - + ProjectBuilderConfiguration setProcessPlugins( boolean processPlugins ); - + boolean isProcessPlugins(); // Profiles - + /** * Set any active profiles that the {@link ProjectBuilder} should consider while constructing * a {@link MavenProject}. */ void setActiveProfileIds( List activeProfileIds ); - + List getActiveProfileIds(); void setInactiveProfileIds( List inactiveProfileIds ); List getInactiveProfileIds(); - + /** - * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration - * like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. + * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom + * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. * @param profile */ void addProfile( Profile profile ); - + void setProfiles( List profiles ); - + List getProfiles(); } diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java index 2a02041d08..52b3a8810a 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java @@ -32,7 +32,7 @@ import org.apache.maven.plugin.version.PluginVersionResolutionException; * Assists the project builder. Warning: This is an internal utility interface that is only public for * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without * prior notice. - * + * * @author Benjamin Bentmann */ public interface ProjectBuildingHelper @@ -40,7 +40,7 @@ public interface ProjectBuildingHelper /** * Creates the effective artifact repositories from the specified POM repositories. - * + * * @param pomRepositories The POM repositories to create the artifact repositories from, must not be {@code null}. * @param externalRepositories The external (and already mirrored) repositories to merge into the result list, may * be {@code null}. @@ -56,7 +56,7 @@ public interface ProjectBuildingHelper /** * Creates the project realm that hosts the build extensions of the specified model. - * + * * @param project The project to create the project realm for, must not be {@code null} * @param model The model to create the project realm for, must not be {@code null} * @param request The project building request holding further settings like repository settings, must not be @@ -64,14 +64,15 @@ public interface ProjectBuildingHelper * @return The record with the project realm and extension artifact filter, never {@code null}. * @throws PluginResolutionException If any build extension could not be resolved. */ - ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model, ProjectBuildingRequest request ) + ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model, + ProjectBuildingRequest request ) throws PluginResolutionException, PluginVersionResolutionException; /** * Updates the context class loader such that the container will search the project realm when the model builder * injects the lifecycle bindings from the packaging in the next step. The context class loader is to be reset by * the project builder when the project is fully assembled. - * + * * @param project The project whose class realm should be selected, must not be {@code null}. */ void selectProjectRealm( MavenProject project ); diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java index 7165290bd0..f43fbd1cb6 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java @@ -26,7 +26,6 @@ import java.util.Properties; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.RepositoryCache; import org.apache.maven.model.Profile; -import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.repository.ArtifactTransferListener; import org.apache.maven.settings.Mirror; import org.apache.maven.settings.Proxy; @@ -48,7 +47,7 @@ public interface ProjectBuildingRequest RepositoryCache getRepositoryCache(); ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository ); - + ArtifactRepository getLocalRepository(); ProjectBuildingRequest setRemoteRepositories( List remoteRepositories ); @@ -74,7 +73,7 @@ public interface ProjectBuildingRequest /** * Sets the system properties to use for interpolation and profile activation. The system properties are collected * from the runtime environment like {@link System#getProperties()} and environment variables. - * + * * @param systemProperties The system properties, may be {@code null}. * @return This request, never {@code null}. */ @@ -83,7 +82,7 @@ public interface ProjectBuildingRequest /** * Gets the system properties to use for interpolation and profile activation. The system properties are collected * from the runtime environment like {@link System#getProperties()} and environment variables. - * + * * @return The system properties, never {@code null}. */ Properties getSystemProperties(); @@ -92,7 +91,7 @@ public interface ProjectBuildingRequest * Sets the user properties to use for interpolation and profile activation. The user properties have been * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command * line. - * + * * @param userProperties The user properties, may be {@code null}. * @return This request, never {@code null}. */ @@ -102,12 +101,12 @@ public interface ProjectBuildingRequest * Gets the user properties to use for interpolation and profile activation. The user properties have been * configured directly by the user on his discretion, e.g. via the {@code -Dkey=value} parameter on the command * line. - * + * * @return The user properties, never {@code null}. */ Properties getUserProperties(); - void setProject(MavenProject mavenProject); + void setProject( MavenProject mavenProject ); MavenProject getProject(); @@ -121,7 +120,7 @@ public interface ProjectBuildingRequest /** * Controls the level of validation to perform on processed models. By default, models are validated in strict mode. - * + * * @param validationLevel The level of validation to perform on processed models, e.g. * {@link ModelBuildingRequest#VALIDATION_LEVEL_STRICT}. * @return This configuration, never {@code null}. @@ -130,46 +129,46 @@ public interface ProjectBuildingRequest /** * Gets the level of validation to perform on processed models. - * + * * @return The level of validation to perform on processed models. */ int getValidationLevel(); // Profiles - + /** * Set any active profiles that the {@link ProjectBuilder} should consider while constructing * a {@link MavenProject}. */ void setActiveProfileIds( List activeProfileIds ); - + List getActiveProfileIds(); void setInactiveProfileIds( List inactiveProfileIds ); List getInactiveProfileIds(); - + /** - * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom configuration - * like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. + * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom + * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse. * @param profile */ void addProfile( Profile profile ); - + void setProfiles( List profiles ); - + List getProfiles(); /** * Gets the start time of the build. - * + * * @return The start time of the build or {@code null} if unknown. */ Date getBuildStartTime(); /** * Sets the start time of the build. - * + * * @param buildStartTime The start time of the build, may be {@code null}. * @return This request, never {@code null}. */ diff --git a/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java b/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java index 15b6ff077d..eafbc7475a 100644 --- a/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java +++ b/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java @@ -42,7 +42,7 @@ public class ProjectSorter private DAG dag; private List sortedProjects; - + private Map projectMap; private MavenProject topLevelProject; @@ -120,7 +120,8 @@ public class ProjectSorter if ( parent != null ) { - // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has in conflict + // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has + // in conflict addEdge( projectMap, vertexMap, null, projectVertex, parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), true, false ); } @@ -273,15 +274,15 @@ public class ProjectSorter { return ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ); } - + public DAG getDAG() { return dag; } - + public Map getProjectMap() { return projectMap; } - + } diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java index 939fda870c..07fd11da6f 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java @@ -1,21 +1,24 @@ package org.apache.maven.project.artifact; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ - import java.io.File; import java.util.ArrayList; import java.util.Iterator; @@ -39,8 +42,8 @@ public class DefaultMavenMetadataCache { protected final Map cache = new ConcurrentHashMap(); - - public static class CacheKey + + public static class CacheKey { private final Artifact artifact; private final long pomHash; @@ -85,12 +88,12 @@ public class DefaultMavenMetadataCache { return true; } - - if ( !(o instanceof CacheKey) ) + + if ( !( o instanceof CacheKey ) ) { return false; } - + CacheKey other = (CacheKey) o; return pomHash == other.pomHash && artifactEquals( artifact, other.artifact ) @@ -111,7 +114,7 @@ public class DefaultMavenMetadataCache } result = 31 * result + ( a.getClassifier() != null ? a.getClassifier().hashCode() : 0 ); result = 31 * result + ( a.getScope() != null ? a.getScope().hashCode() : 0 ); - result = 31 * result + ( a.getDependencyFilter() != null? a.getDependencyFilter().hashCode() : 0 ); + result = 31 * result + ( a.getDependencyFilter() != null ? a.getDependencyFilter().hashCode() : 0 ); result = 31 * result + ( a.isOptional() ? 1 : 0 ); return result; } @@ -192,7 +195,7 @@ public class DefaultMavenMetadataCache private static boolean eq( T s1, T s2 ) { - return s1 != null? s1.equals( s2 ): s2 == null; + return s1 != null ? s1.equals( s2 ) : s2 == null; } public class CacheRecord diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java b/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java index fc54ff8991..4a58ac1d7c 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java @@ -1,12 +1,5 @@ package org.apache.maven.project.artifact; -import java.io.File; - -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.model.Dependency; -import org.apache.maven.project.InvalidProjectVersionException; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -26,6 +19,13 @@ import org.apache.maven.project.InvalidProjectVersionException; * under the License. */ +import java.io.File; + +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.model.Dependency; +import org.apache.maven.project.InvalidProjectVersionException; + /** * Thrown if a dependency has an invalid version. * diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java index 2aa7c20a5a..036ee86c56 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java @@ -1,27 +1,30 @@ package org.apache.maven.project.artifact; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.metadata.ResolutionGroup; -/* - * 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 interface MavenMetadataCache { diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java index ca2ccedc8d..d1a666f29b 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java @@ -1,18 +1,22 @@ package org.apache.maven.project.artifact; /* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. + * 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; @@ -29,7 +33,6 @@ import java.util.Properties; import java.util.Set; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; @@ -87,7 +90,7 @@ public class MavenMetadataSource @Requirement private ArtifactFactory repositorySystem; - //TODO: This prevents a cycle in the composition which shows us another problem we need to deal with. + //TODO: This prevents a cycle in the composition which shows us another problem we need to deal with. //@Requirement private ProjectBuilder projectBuilder; @@ -98,7 +101,7 @@ public class MavenMetadataSource private Logger logger; @Requirement - private MavenMetadataCache cache; + private MavenMetadataCache cache; @Requirement private LegacySupport legacySupport; @@ -187,7 +190,7 @@ public class MavenMetadataSource else { ProjectRelocation rel = retrieveRelocatedProject( artifact, request ); - + if ( rel == null ) { return null; @@ -215,8 +218,8 @@ public class MavenMetadataSource } } - Set artifacts = Collections.emptySet(); - + Set artifacts = Collections.emptySet(); + if ( !artifact.getArtifactHandler().isIncludesDependencies() ) { artifacts = new LinkedHashSet(); @@ -312,8 +315,8 @@ public class MavenMetadataSource } } - private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency, String inheritedScope, - ArtifactFilter inheritedFilter ) + private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency, + String inheritedScope, ArtifactFilter inheritedFilter ) throws InvalidVersionSpecificationException { String effectiveScope = getEffectiveScope( dependency.getScope(), inheritedScope ); @@ -412,7 +415,8 @@ public class MavenMetadataSource return effectiveFilter; } - public List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + public List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) throws ArtifactMetadataRetrievalException { MetadataResolutionRequest request = new DefaultMetadataResolutionRequest(); @@ -442,7 +446,9 @@ public class MavenMetadataSource return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions ); } - public List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository deploymentRepository ) + public List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, + ArtifactRepository localRepository, + ArtifactRepository deploymentRepository ) throws ArtifactMetadataRetrievalException { RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); @@ -461,7 +467,8 @@ public class MavenMetadataSource return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions ); } - private List retrieveAvailableVersionsFromMetadata( Metadata repoMetadata, List availableVersions ) + private List retrieveAvailableVersionsFromMetadata( Metadata repoMetadata, + List availableVersions ) { Collection versions = new LinkedHashSet(); @@ -482,9 +489,11 @@ public class MavenMetadataSource return artifactVersions; } - // USED BY MAVEN ASSEMBLY PLUGIN + // USED BY MAVEN ASSEMBLY PLUGIN @Deprecated - public static Set createArtifacts( ArtifactFactory artifactFactory, List dependencies, String inheritedScope, ArtifactFilter dependencyFilter, MavenProject project ) + public static Set createArtifacts( ArtifactFactory artifactFactory, List dependencies, + String inheritedScope, ArtifactFilter dependencyFilter, + MavenProject project ) throws InvalidDependencyVersionException { Set artifacts = new LinkedHashSet(); diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java b/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java index e5a8b7d9e2..d348d59c8a 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java @@ -36,7 +36,8 @@ public class PluginArtifact public PluginArtifact( Plugin plugin, Artifact pluginArtifact ) { - super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null, new PluginArtifactHandler() ); + super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null, + new PluginArtifactHandler() ); this.plugin = plugin; setFile( pluginArtifact.getFile() ); setResolved( true ); diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java index 227bd0ddc3..e4b44e79a9 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java @@ -36,7 +36,8 @@ public class ProjectArtifact public ProjectArtifact( MavenProject project ) { - super( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, "pom", null, new PomArtifactHandler() ); + super( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, "pom", null, + new PomArtifactHandler() ); this.project = project; setFile( project.getFile() ); setResolved( true ); @@ -46,7 +47,7 @@ public class ProjectArtifact { return project; } - + public List getDependencies() { return project.getDependencies(); diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java index 6f7e1f85d8..1b29261c39 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java @@ -69,7 +69,9 @@ public class ProjectArtifactMetadata public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository ) throws RepositoryMetadataStoreException { - File destination = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( this, remoteRepository ) ); + File destination = + new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( this, + remoteRepository ) ); // ---------------------------------------------------------------------------- // I'm fully aware that the file could just be moved using File.rename but @@ -119,6 +121,6 @@ public class ProjectArtifactMetadata public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata ) { - this.merge( (ArtifactMetadata)metadata ); + this.merge( (ArtifactMetadata) metadata ); } } diff --git a/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java b/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java index 7870e95acd..69a4edf326 100644 --- a/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java +++ b/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java @@ -40,17 +40,17 @@ import org.apache.maven.settings.Server; */ public interface RepositorySystem { - static final String DEFAULT_LOCAL_REPO_ID = "local"; - - static final String userHome = System.getProperty( "user.home" ); - - static final File userMavenConfigurationHome = new File( userHome, ".m2" ); - - static final File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); - - static final String DEFAULT_REMOTE_REPO_ID = "central"; + final String DEFAULT_LOCAL_REPO_ID = "local"; - static final String DEFAULT_REMOTE_REPO_URL = "http://repo1.maven.org/maven2"; + final String userHome = System.getProperty( "user.home" ); + + final File userMavenConfigurationHome = new File( userHome, ".m2" ); + + final File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" ); + + final String DEFAULT_REMOTE_REPO_ID = "central"; + + final String DEFAULT_REMOTE_REPO_URL = "http://repo1.maven.org/maven2"; Artifact createArtifact( String groupId, String artifactId, String version, String packaging ); @@ -58,40 +58,42 @@ public interface RepositorySystem Artifact createProjectArtifact( String groupId, String artifactId, String version ); - Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ); - + Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, + String classifier ); + Artifact createPluginArtifact( Plugin plugin ); - + Artifact createDependencyArtifact( Dependency dependency ); - + ArtifactRepository buildArtifactRepository( Repository repository ) throws InvalidRepositoryException; - + ArtifactRepository createDefaultRemoteRepository() - throws InvalidRepositoryException; - + throws InvalidRepositoryException; + ArtifactRepository createDefaultLocalRepository() throws InvalidRepositoryException; - + ArtifactRepository createLocalRepository( File localRepository ) throws InvalidRepositoryException; - ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); + ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, + ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases ); /** * Calculates the effective repositories for the given input repositories which are assumed to be already mirrored * (if applicable). This process will essentially remove duplicate repositories by merging them into one equivalent * repository. It is worth to point out that merging does not simply choose one of the input repositories and * discards the others but actually combines their possibly different policies. - * + * * @param repositories The original repositories, may be {@code null}. * @return The effective repositories or {@code null} if the input was {@code null}. */ - List getEffectiveRepositories( List repositories ); + List getEffectiveRepositories( List repositories ); /** * 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. @@ -103,7 +105,7 @@ public interface RepositorySystem * mirror, its URL and ID will be updated to match the values from the mirror specification. Repositories without a * matching mirror will pass through unchanged. Note: This method must be called before * {@link #injectAuthentication(List, List)} or the repositories will end up with the wrong credentials. - * + * * @param repositories The repositories into which to inject the mirror information, may be {@code null}. * @param mirrors The available mirrors, may be {@code null}. */ @@ -114,7 +116,7 @@ public interface RepositorySystem * its proxy data will be set accordingly. Repositories without a matching proxy will have their proxy cleared. * Note: This method must be called after {@link #injectMirror(List, List)} or the repositories will end up * with the wrong proxies. - * + * * @param repositories The repositories into which to inject the proxy information, may be {@code null}. * @param proxies The available proxies, may be {@code null}. */ @@ -125,7 +127,7 @@ public interface RepositorySystem * server, its credentials will be updated to match the values from the server specification. Repositories without a * matching server will have their credentials cleared. Note: This method must be called after * {@link #injectMirror(List, List)} or the repositories will end up with the wrong credentials. - * + * * @param repositories The repositories into which to inject the authentication information, may be {@code null}. * @param servers The available servers, may be {@code null}. */ @@ -134,18 +136,20 @@ public interface RepositorySystem ArtifactResolutionResult resolve( ArtifactResolutionRequest request ); // Install - + // Deploy - + // Map types of artifacts - + // // Raw file transfers // - void publish( ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener ) + void publish( ArtifactRepository repository, File source, String remotePath, + ArtifactTransferListener transferListener ) throws ArtifactTransferFailedException; - - void retrieve( ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener ) - throws ArtifactTransferFailedException, ArtifactDoesNotExistException; + + void retrieve( ArtifactRepository repository, File destination, String remotePath, + ArtifactTransferListener transferListener ) + throws ArtifactTransferFailedException, ArtifactDoesNotExistException; } diff --git a/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java b/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java index 4bfb90c150..deba5a80f4 100644 --- a/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java +++ b/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java @@ -38,7 +38,8 @@ public interface ArtifactMetadataSource ResolutionGroup retrieve( MetadataResolutionRequest request ) throws ArtifactMetadataRetrievalException; - ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) throws ArtifactMetadataRetrievalException; /** @@ -53,7 +54,8 @@ public interface ArtifactMetadataSource * @throws ArtifactMetadataRetrievalException * in case of error while retrieving repository metadata from the repository. */ - List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories ) + List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) throws ArtifactMetadataRetrievalException; /** @@ -69,7 +71,9 @@ public interface ArtifactMetadataSource * @throws ArtifactMetadataRetrievalException * in case of error while retrieving repository metadata from the repository. */ - List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository ) + List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, + ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) throws ArtifactMetadataRetrievalException; } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java b/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java index 12ef966031..f11c4418fd 100644 --- a/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java @@ -36,7 +36,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * @author jdcasey */ -@Component(role = MavenSettingsBuilder.class) +@Component( role = MavenSettingsBuilder.class ) public class DefaultMavenSettingsBuilder extends AbstractLogEnabled implements MavenSettingsBuilder @@ -49,7 +49,8 @@ public class DefaultMavenSettingsBuilder throws IOException, XmlPullParserException { File userSettingsFile = - getFile( "${user.home}/.m2/settings.xml", "user.home", MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION ); + getFile( "${user.home}/.m2/settings.xml", "user.home", + MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION ); return buildSettings( userSettingsFile ); } @@ -71,7 +72,7 @@ public class DefaultMavenSettingsBuilder request.setUserSettingsFile( userSettingsFile ); request.setGlobalSettingsFile( globalSettingsFile ); request.setSystemProperties( System.getProperties() ); - return build(request); + return build( request ); } public Settings buildSettings( File userSettingsFile, boolean useCachedSettings ) @@ -102,8 +103,8 @@ public class DefaultMavenSettingsBuilder settingsRequest.setGlobalSettingsFile( request.getGlobalSettingsFile() ); settingsRequest.setUserProperties( request.getUserProperties() ); settingsRequest.setSystemProperties( request.getSystemProperties() ); - - return build(settingsRequest); + + return build( settingsRequest ); } private File getFile( String pathPattern, String basedirSysProp, String altLocationSysProp ) diff --git a/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java b/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java index 3620d5bb9e..2d08d04018 100644 --- a/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java @@ -44,7 +44,7 @@ import org.codehaus.plexus.interpolation.RegexBasedInterpolator; /** * Builds the effective settings from a user settings file and/or a global settings file. - * + * * @author Benjamin Bentmann */ @Component( role = SettingsBuilder.class ) @@ -159,7 +159,8 @@ public class DefaultSettingsBuilder return settings; } - private Settings interpolate( Settings settings, SettingsBuildingRequest request, SettingsProblemCollector problems ) + private Settings interpolate( Settings settings, SettingsBuildingRequest request, + SettingsProblemCollector problems ) { StringWriter writer = new StringWriter( 1024 * 4 ); diff --git a/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java b/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java index f7ef584497..3c4b88581e 100644 --- a/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java +++ b/maven-core/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java @@ -34,7 +34,7 @@ import org.codehaus.plexus.util.StringUtils; /** * @author Milos Kleint */ -@Component(role = SettingsValidator.class) +@Component( role = SettingsValidator.class ) public class DefaultSettingsValidator implements SettingsValidator { @@ -108,7 +108,8 @@ public class DefaultSettingsValidator for ( Profile profile : profiles ) { validateRepositories( problems, profile.getRepositories(), "repositories.repository" ); - validateRepositories( problems, profile.getPluginRepositories(), "pluginRepositories.pluginRepository" ); + validateRepositories( problems, profile.getPluginRepositories(), + "pluginRepositories.pluginRepository" ); } } } @@ -148,7 +149,8 @@ public class DefaultSettingsValidator *

  • string.length > 0 * */ - private boolean validateStringNotEmpty( SettingsProblemCollector problems, String fieldName, String string, String sourceHint ) + private boolean validateStringNotEmpty( SettingsProblemCollector problems, String fieldName, String string, + String sourceHint ) { if ( !validateNotNull( problems, fieldName, string, sourceHint ) ) { diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java b/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java index 8536262b62..2052b52a51 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -68,14 +68,13 @@ public abstract class DefaultToolchain return model; } - public final void addProvideToken( String type, - RequirementMatcher matcher ) + public final void addProvideToken( String type, RequirementMatcher matcher ) { provides.put( type, matcher ); } - public boolean matchesRequirements(Map requirements) + public boolean matchesRequirements( Map requirements ) { Iterator it = requirements.keySet().iterator(); while ( it.hasNext() ) @@ -86,12 +85,12 @@ public abstract class DefaultToolchain if ( matcher == null ) { - getLog().debug( "Toolchain " + this + " is missing required property: " + key ); + getLog().debug( "Toolchain " + this + " is missing required property: " + key ); return false; } - if ( !matcher.matches( (String) requirements.get(key) ) ) + if ( !matcher.matches( (String) requirements.get( key ) ) ) { - getLog().debug( "Toolchain " + this + " doesn't match required property: " + key ); + getLog().debug( "Toolchain " + this + " doesn't match required property: " + key ); return false; } } diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java b/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java index bd1cde9a1b..140bc804ae 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - /** * * @author mkleint @@ -32,8 +32,7 @@ public class MisconfiguredToolchainException super( message ); } - public MisconfiguredToolchainException( String message, - Throwable orig ) + public MisconfiguredToolchainException( String message, Throwable orig ) { super( message, orig ); } diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java b/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java index ecf6e7148d..26390e405c 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - /** * * @author mkleint diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java b/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java index 15219c98b5..c638a2f8d7 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java b/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java index 6a194d9a9f..adcae3abb4 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,9 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - - /** * @author Milos Kleint * @author Jason van Zyl diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java index e1c008a90e..3436883c03 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - import org.apache.maven.toolchain.model.ToolchainModel; /** diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java index 4aef19d3d3..1265e5e233 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - import org.apache.maven.execution.MavenSession; @@ -36,6 +36,5 @@ public interface ToolchainManager /** * to be used from plugins capable of working with toolchains. */ - Toolchain getToolchainFromBuildContext( String type, - MavenSession context ); + Toolchain getToolchainFromBuildContext( String type, MavenSession context ); } diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java index 17e408715a..81f54a188e 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,9 +19,6 @@ * under the License. */ - -package org.apache.maven.toolchain; - import org.apache.maven.execution.MavenSession; diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java index 4a6b052844..93664f901f 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain; - import java.util.Map; import org.apache.maven.toolchain.model.ToolchainModel; diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java index d0fca8f8c8..200caff063 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain.java; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain.java; - import java.io.File; import org.apache.maven.toolchain.DefaultToolchain; @@ -31,7 +31,7 @@ import org.codehaus.plexus.util.Os; /** * @author Milos Kleint */ -@Component(role=JavaToolChain.class) +@Component( role = JavaToolChain.class ) public class DefaultJavaToolChain extends DefaultToolchain implements JavaToolChain diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java index 3d7f754e89..776f314562 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolchainFactory.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain.java; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +19,6 @@ * under the License. */ -package org.apache.maven.toolchain.java; - import java.io.File; import org.apache.maven.toolchain.MisconfiguredToolchainException; diff --git a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java index c2f40d6fe6..80c7509211 100644 --- a/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java +++ b/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolChain.java @@ -1,3 +1,5 @@ +package org.apache.maven.toolchain.java; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,11 +19,8 @@ * under the License. */ -package org.apache.maven.toolchain.java; - import org.apache.maven.toolchain.Toolchain; - /** * @author Jason van Zyl * @author Milos Kleint diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java index 53e50cedbb..21d95a0825 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java @@ -1,18 +1,22 @@ package org.apache.maven.cli; /* - * 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. + * 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.PrintStream; @@ -96,7 +100,7 @@ public class CLIManager private Options options; - @SuppressWarnings("static-access") + @SuppressWarnings( "static-access" ) public CLIManager() { options = new Options(); @@ -132,7 +136,7 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) ); // Adding this back in for compatibility with the verifier that hard codes this option. - + options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) ); options.addOption( OptionBuilder.withLongOpt( "check-plugin-updates" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "cpu" ) ); options.addOption( OptionBuilder.withLongOpt( "update-plugins" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "up" ) ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java index 1d82460f8c..cf093bab8f 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java @@ -164,7 +164,8 @@ public final class CLIReportingUtils InputStream resourceAsStream = null; try { - resourceAsStream = MavenCli.class.getClassLoader().getResourceAsStream( "org/apache/maven/messages/build.properties" ); + resourceAsStream = + MavenCli.class.getClassLoader().getResourceAsStream( "org/apache/maven/messages/build.properties" ); if ( resourceAsStream != null ) { diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java index 7cd9074264..44c11e567e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java @@ -37,7 +37,7 @@ import org.codehaus.plexus.logging.Logger; /** * Logs execution events to a user-supplied logger. - * + * * @author Benjamin Bentmann */ class ExecutionEventLogger @@ -204,7 +204,7 @@ class ExecutionEventLogger String wallClock = session.getRequest().isThreadConfigurationPresent() ? " (Wall Clock)" : ""; - logger.info( "Total time: " + getFormattedTime( time ) + wallClock); + logger.info( "Total time: " + getFormattedTime( time ) + wallClock ); logger.info( "Finished at: " + finish ); diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 9d4f79c840..3f43a38c94 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -1,18 +1,22 @@ package org.apache.maven.cli; /* - * 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. + * 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; @@ -79,7 +83,8 @@ public class MavenCli public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" ); - public static final File DEFAULT_GLOBAL_SETTINGS_FILE = new File( System.getProperty( "maven.home", System.getProperty( "user.dir", "" ) ), "conf/settings.xml" ); + public static final File DEFAULT_GLOBAL_SETTINGS_FILE = + new File( System.getProperty( "maven.home", System.getProperty( "user.dir", "" ) ), "conf/settings.xml" ); public static final File DEFAULT_USER_TOOLCHAINS_FILE = new File( userMavenConfigurationHome, "toolchains.xml" ); @@ -96,8 +101,8 @@ public class MavenCli private MavenExecutionRequestPopulator executionRequestPopulator; - private SettingsBuilder settingsBuilder; - + private SettingsBuilder settingsBuilder; + private DefaultSecDispatcher dispatcher; public MavenCli() @@ -172,7 +177,7 @@ public class MavenCli catch ( Exception e ) { CLIReportingUtils.showError( logger, "Error executing Maven.", e, cliRequest.showErrors ); - + return 1; } finally @@ -208,19 +213,19 @@ public class MavenCli { cliRequest.workingDirectory = System.getProperty( "user.dir" ); } - + // // Make sure the Maven home directory is an absolute path to save us from confusion with say drive-relative // Windows paths. // String mavenHome = System.getProperty( "maven.home" ); - + if ( mavenHome != null ) { System.setProperty( "maven.home", new File( mavenHome ).getAbsolutePath() ); } } - + // // Logging needs to be handled in a standard way at the container level. // @@ -239,7 +244,8 @@ public class MavenCli // TODO: we need to do some more work here. Some plugins use sys out or log errors at info level. // Ideally, we could use Warn across the board cliRequest.request.setLoggingLevel( MavenExecutionRequest.LOGGING_LEVEL_ERROR ); - // TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing. + // TODO:Additionally, we can't change the mojo level because the component key includes the version and + // it isn't known ahead of time. This seems worth changing. } else { @@ -268,10 +274,10 @@ public class MavenCli { logger.setStream( cliRequest.stdout ); } - - cliRequest.request.setExecutionListener( new ExecutionEventLogger( logger ) ); + + cliRequest.request.setExecutionListener( new ExecutionEventLogger( logger ) ); } - + // // Every bit of information taken from the CLI should be processed here. // @@ -305,7 +311,7 @@ public class MavenCli throw new ExitException( 0 ); } } - + private void commands( CliRequest cliRequest ) { if ( cliRequest.debug || cliRequest.commandLine.hasOption( CLIManager.SHOW_VERSION ) ) @@ -319,7 +325,7 @@ public class MavenCli } // - // TODO: move checksum policies to + // TODO: move checksum policies to // if ( MavenExecutionRequest.CHECKSUM_POLICY_WARN.equals( cliRequest.request.getGlobalChecksumPolicy() ) ) { @@ -376,11 +382,11 @@ public class MavenCli dispatcher = (DefaultSecDispatcher) container.lookup( SecDispatcher.class, "maven" ); } - + protected void customizeContainer( PlexusContainer container ) { } - + // // This should probably be a separate tool and not be baked into Maven. // @@ -393,7 +399,8 @@ public class MavenCli DefaultPlexusCipher cipher = new DefaultPlexusCipher(); - cliRequest.stdout.println( cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); + cliRequest.stdout.println( cipher.encryptAndDecorate( passwd, + DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); throw new ExitException( 0 ); } @@ -430,11 +437,11 @@ public class MavenCli throw new ExitException( 0 ); } } - + private int execute( CliRequest cliRequest ) { - MavenExecutionResult result = maven.execute( cliRequest.request ); - + MavenExecutionResult result = maven.execute( cliRequest.request ); + if ( result.hasExceptions() ) { ExceptionHandler handler = new DefaultExceptionHandler(); @@ -469,7 +476,8 @@ public class MavenCli if ( !references.isEmpty() ) { logger.error( "" ); - logger.error( "For more information about the errors and possible solutions" + ", please read the following articles:" ); + logger.error( "For more information about the errors and possible solutions" + + ", please read the following articles:" ); for ( Map.Entry entry : references.entrySet() ) { @@ -501,7 +509,8 @@ public class MavenCli } } - private void logSummary( ExceptionSummary summary, Map references, String indent, boolean showErrors ) + private void logSummary( ExceptionSummary summary, Map references, String indent, + boolean showErrors ) { String referenceKey = ""; @@ -579,7 +588,8 @@ public class MavenCli if ( cliRequest.commandLine.hasOption( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) ) { - globalSettingsFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) ); + globalSettingsFile = + new File( cliRequest.commandLine.getOptionValue( CLIManager.ALTERNATE_GLOBAL_SETTINGS ) ); globalSettingsFile = resolveFile( globalSettingsFile, cliRequest.workingDirectory ); if ( !globalSettingsFile.isFile() ) @@ -624,7 +634,7 @@ public class MavenCli private MavenExecutionRequest populateRequest( CliRequest cliRequest ) { - MavenExecutionRequest request = cliRequest.request; + MavenExecutionRequest request = cliRequest.request; CommandLine commandLine = cliRequest.commandLine; String workingDirectory = cliRequest.workingDirectory; boolean debug = cliRequest.debug; @@ -640,7 +650,7 @@ public class MavenCli + " is deprecated and will be removed in future Maven versions." ); } } - + // ---------------------------------------------------------------------- // Now that we have everything that we need we will fire up plexus and // bring the maven component to life for use. @@ -784,7 +794,8 @@ public class MavenCli // TODO: we need to do some more work here. Some plugins use sys out or log errors at info level. // Ideally, we could use Warn across the board loggingLevel = MavenExecutionRequest.LOGGING_LEVEL_ERROR; - // TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing. + // TODO:Additionally, we can't change the mojo level because the component key includes the version and + // it isn't known ahead of time. This seems worth changing. } else { @@ -850,15 +861,18 @@ public class MavenCli request.setSelectedProjects( Arrays.asList( projects ) ); } - if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && !commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) ) + if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) + && !commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) ) { request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_UPSTREAM ); } - else if ( !commandLine.hasOption( CLIManager.ALSO_MAKE ) && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) ) + else if ( !commandLine.hasOption( CLIManager.ALSO_MAKE ) + && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) ) { request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM ); } - else if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) ) + else if ( commandLine.hasOption( CLIManager.ALSO_MAKE ) + && commandLine.hasOption( CLIManager.ALSO_MAKE_DEPENDENTS ) ) { request.setMakeBehavior( MavenExecutionRequest.REACTOR_MAKE_BOTH ); } @@ -974,23 +988,23 @@ public class MavenCli System.setProperty( name, value ); } - + static class CliRequest { String[] args; CommandLine commandLine; PrintStream stdout; PrintStream stderr; - ClassWorld classWorld; + ClassWorld classWorld; String workingDirectory; boolean debug; boolean quiet; - boolean showErrors = true; + boolean showErrors = true; PrintStream fileStream; Properties userProperties = new Properties(); Properties systemProperties = new Properties(); MavenExecutionRequest request; - + CliRequest( String[] args, ClassWorld classWorld ) { this.args = args; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index cc1d155e02..bf6c0b3b2d 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -185,17 +185,15 @@ public class DefaultModelBuilder return this; } - public DefaultModelBuilder setDependencyManagementImporter( - DependencyManagementImporter dependencyManagementImporter ) + public DefaultModelBuilder setDependencyManagementImporter( DependencyManagementImporter depMngmntImporter ) { - this.dependencyManagementImporter = dependencyManagementImporter; + this.dependencyManagementImporter = depMngmntImporter; return this; } - public DefaultModelBuilder setDependencyManagementInjector( - DependencyManagementInjector dependencyManagementInjector ) + public DefaultModelBuilder setDependencyManagementInjector( DependencyManagementInjector depMngmntInjector ) { - this.dependencyManagementInjector = dependencyManagementInjector; + this.dependencyManagementInjector = depMngmntInjector; return this; } @@ -331,7 +329,7 @@ public class DefaultModelBuilder problems.setSource( inputModel ); checkPluginVersions( lineage, request, problems ); - + assembleInheritance( lineage, request, problems ); Model resultModel = resultData.getModel(); @@ -500,7 +498,8 @@ public class DefaultModelBuilder } catch ( ModelParseException e ) { - problems.add( Severity.FATAL, "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage(), null, e ); + problems.add( Severity.FATAL, "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage(), + null, e ); throw new ModelBuildingException( problems.getRootModel(), problems.getRootModelId(), problems.getProblems() ); } @@ -647,7 +646,8 @@ public class DefaultModelBuilder return result; } - private ModelData readParent( Model childModel, ModelBuildingRequest request, DefaultModelProblemCollector problems ) + private ModelData readParent( Model childModel, ModelBuildingRequest request, + DefaultModelProblemCollector problems ) throws ModelBuildingException { ModelData parentData; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java index c5fae8e977..ea037a0796 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java @@ -22,7 +22,7 @@ package org.apache.maven.model.building; /** * Assists in firing events from a generic method by abstracting from the actual callback method to be called on the * listener. - * + * * @author Benjamin Bentmann */ interface ModelBuildingEventCatapult @@ -30,13 +30,13 @@ interface ModelBuildingEventCatapult /** * Notifies the specified listener of the given event. - * + * * @param listener The listener to notify, must not be {@code null}. * @param event The event to fire, must not be {@code null}. */ void fire( ModelBuildingListener listener, ModelBuildingEvent event ); - static final ModelBuildingEventCatapult BUILD_EXTENSIONS_ASSEMBLED = new ModelBuildingEventCatapult() + final ModelBuildingEventCatapult BUILD_EXTENSIONS_ASSEMBLED = new ModelBuildingEventCatapult() { public void fire( ModelBuildingListener listener, ModelBuildingEvent event ) { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java index 53d3641a31..d2b01c1dab 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java @@ -28,7 +28,7 @@ import java.io.File; /** * Replaces expressions of the form ${token} with their effective values. Effective values are basically * calculated from the elements of the model itself and the execution properties from the building request. - * + * * @author jdcasey *

    * Created on Feb 2, 2005 @@ -40,7 +40,7 @@ public interface ModelInterpolator * Interpolates expressions in the specified model. Note that implementations are free to either interpolate the * provided model directly or to create a clone of the model and interpolate the clone. Callers should always use * the returned model and must not rely on the input model being updated. - * + * * @param model The model to interpolate, must not be {@code null}. * @param projectDir The project directory, may be {@code null} if the model does not belong to a local project but * to some artifact's metadata. @@ -48,6 +48,7 @@ public interface ModelInterpolator * @param problems The container used to collect problems that were encountered, must not be {@code null}. * @return The interpolated model, never {@code null}. */ - Model interpolateModel( Model model, File projectDir, ModelBuildingRequest request, ModelProblemCollector problems ); + Model interpolateModel( Model model, File projectDir, ModelBuildingRequest request, + ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java index df6c051946..6a34b6b11c 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java @@ -28,7 +28,7 @@ import java.util.Collection; import java.util.List; /** - * + * * @version $Id$ */ class PathTranslatingPostProcessor @@ -40,7 +40,8 @@ class PathTranslatingPostProcessor private final PathTranslator pathTranslator; private final List expressionPrefixes; - public PathTranslatingPostProcessor( List expressionPrefixes, Collection unprefixedPathKeys, File projectDir, PathTranslator pathTranslator ) + public PathTranslatingPostProcessor( List expressionPrefixes, Collection unprefixedPathKeys, + File projectDir, PathTranslator pathTranslator ) { this.expressionPrefixes = expressionPrefixes; this.unprefixedPathKeys = unprefixedPathKeys; diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java index 7147dab44f..8f7085ad8d 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java @@ -35,7 +35,11 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @Component( role = ModelInterpolator.class ) @@ -44,9 +48,9 @@ public class StringSearchModelInterpolator { private static final Map, Field[]> fieldsByClass = - new ConcurrentHashMap, Field[]>(80, 0.75f, 2); // Empirical data from 3.x, actual =40 + new ConcurrentHashMap, Field[]>( 80, 0.75f, 2 ); // Empirical data from 3.x, actual =40 private static final Map, Boolean> fieldIsPrimitiveByClass = - new ConcurrentHashMap, Boolean>(62, 0.75f, 2); // Empirical data from 3.x, actual 31 + new ConcurrentHashMap, Boolean>( 62, 0.75f, 2 ); // Empirical data from 3.x, actual 31 public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config, ModelProblemCollector problems ) @@ -95,7 +99,8 @@ public class StringSearchModelInterpolator public InterpolateObjectAction( Object target, List valueSources, List postProcessors, - StringSearchModelInterpolator modelInterpolator, ModelProblemCollector problems) + StringSearchModelInterpolator modelInterpolator, + ModelProblemCollector problems ) { this.valueSources = valueSources; this.postProcessors = postProcessors; @@ -120,7 +125,7 @@ public class StringSearchModelInterpolator return null; } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) private void traverseObjectWithParents( Class cls, Object target ) { if ( cls == null ) @@ -128,20 +133,19 @@ public class StringSearchModelInterpolator return; } - if ( cls.isArray() ) { evaluateArray( target ); } else if ( isQualifiedForInterpolation( cls ) ) { - Field[] fields = getFields(cls); - for (Field currentField : fields) + for ( Field currentField : getFields( cls ) ) { Class type = currentField.getType(); if ( isQualifiedForInterpolation( currentField, type ) ) { - synchronized ( currentField){ + synchronized ( currentField ) + { boolean isAccessible = currentField.isAccessible(); currentField.setAccessible( true ); try @@ -282,13 +286,13 @@ public class StringSearchModelInterpolator } catch ( IllegalArgumentException e ) { - problems.add( Severity.ERROR, "Failed to interpolate field3: " + currentField + - " on class: " + cls.getName(), null, e ); + problems.add( Severity.ERROR, "Failed to interpolate field3: " + currentField + + " on class: " + cls.getName(), null, e ); } catch ( IllegalAccessException e ) { - problems.add( Severity.ERROR, "Failed to interpolate field4: " + currentField + - " on class: " + cls.getName(), null, e ); + problems.add( Severity.ERROR, "Failed to interpolate field4: " + currentField + + " on class: " + cls.getName(), null, e ); } finally { @@ -302,8 +306,9 @@ public class StringSearchModelInterpolator } } - private Field[] getFields(Class cls) { - Field[] fields = fieldsByClass.get(cls); + private Field[] getFields( Class cls ) + { + Field[] fields = fieldsByClass.get( cls ); if ( fields == null ) { fields = cls.getDeclaredFields(); @@ -319,7 +324,7 @@ public class StringSearchModelInterpolator private boolean isQualifiedForInterpolation( Field field, Class fieldType ) { - Boolean primitive = fieldIsPrimitiveByClass.get(fieldType); + Boolean primitive = fieldIsPrimitiveByClass.get( fieldType ); if ( primitive == null ) { primitive = fieldType.isPrimitive(); @@ -331,8 +336,7 @@ public class StringSearchModelInterpolator return false; } - return !"parent".equals(field.getName()); - + return !"parent".equals( field.getName() ); } private void evaluateArray( Object target ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java index 50b7085e6e..65660dd53c 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java @@ -166,31 +166,36 @@ public class MavenModelMerger } @Override - protected void mergeModel_ModelVersion( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_ModelVersion( Model target, Model source, boolean sourceDominant, + Map context ) { // neither inherited nor injected } @Override - protected void mergeModel_ArtifactId( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_ArtifactId( Model target, Model source, boolean sourceDominant, + Map context ) { // neither inherited nor injected } @Override - protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant, + Map context ) { // neither inherited nor injected } @Override - protected void mergeModel_Prerequisites( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Prerequisites( Model target, Model source, boolean sourceDominant, + Map context ) { // neither inherited nor injected } @Override - protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant, + Map context ) { if ( target.getLicenses().isEmpty() ) { @@ -370,7 +375,8 @@ public class MavenModelMerger @Override protected void mergeDistributionManagement_SnapshotRepository( DistributionManagement target, DistributionManagement source, - boolean sourceDominant, Map context ) + boolean sourceDominant, + Map context ) { DeploymentRepository src = source.getSnapshotRepository(); if ( src != null ) @@ -492,7 +498,8 @@ public class MavenModelMerger for ( PluginExecution element : src ) { - if ( sourceDominant || ( element.getInherited() != null ? element.isInherited() : source.isInherited() ) ) + if ( sourceDominant + || ( element.getInherited() != null ? element.isInherited() : source.isInherited() ) ) { Object key = getPluginExecutionKey( element ); merged.put( key, element ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java b/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java index 7734ad55f8..4c7f1240d1 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java @@ -20,14 +20,13 @@ package org.apache.maven.model.resolution; */ import org.apache.maven.model.Repository; -import org.apache.maven.model.building.ModelBuilder; import org.apache.maven.model.building.ModelSource; /** * Resolves a POM from its coordinates. During the build process, the {@link ModelBuilder} will add any relevant * repositories to the model resolver. In other words, the model resolver is stateful and should not be reused across * multiple model building requests. - * + * * @author Benjamin Bentmann */ public interface ModelResolver @@ -35,7 +34,7 @@ public interface ModelResolver /** * Tries to resolve the POM for the specified coordinates. - * + * * @param groupId The group identifier of the POM, must not be {@code null}. * @param artifactId The artifact identifier of the POM, must not be {@code null}. * @param version The version of the POM, must not be {@code null}. @@ -49,7 +48,7 @@ public interface ModelResolver * Adds a repository to use for subsequent resolution requests. The order in which repositories are added matters, * repositories that were added first should also be searched first. When multiple repositories with the same * identifier are added, only the first repository being added will be used. - * + * * @param repository The repository to add to the internal search chain, must not be {@code null}. * @throws InvalidRepositoryException If the repository could not be added (e.g. due to invalid URL or layout). */ @@ -60,7 +59,7 @@ public interface ModelResolver * Clones this resolver for usage in a forked resolution process. In general, implementors need not provide a deep * clone. The only requirement is that invocations of {@link #addRepository(Repository)} on the clone do not affect * the state of the original resolver and vice versa. - * + * * @return The cloned resolver, never {@code null}. */ ModelResolver newCopy(); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java index 676666dd44..777a160329 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java @@ -31,7 +31,7 @@ import org.codehaus.plexus.component.annotations.Requirement; /** * Provides the super POM that all models implicitly inherit from. - * + * * @author Benjamin Bentmann */ @Component( role = SuperPomProvider.class ) @@ -69,7 +69,7 @@ public class DefaultSuperPomProvider try { - Map options = new HashMap(); + Map options = new HashMap(); options.put( "xml:4.0.0", "xml:4.0.0" ); superModel = modelProcessor.read( is, options ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 4f7f72c065..86db9837c1 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -54,7 +54,7 @@ import org.codehaus.plexus.util.StringUtils; * @author Trygve Laugstøl * @version $Id$ */ -@Component(role = ModelValidator.class ) +@Component( role = ModelValidator.class ) public class DefaultModelValidator implements ModelValidator { @@ -99,7 +99,8 @@ public class DefaultModelValidator validateRepositories( problems, model.getRepositories(), "repositories.repository", request ); - validateRepositories( problems, model.getPluginRepositories(), "pluginRepositories.pluginRepository", request ); + validateRepositories( problems, model.getPluginRepositories(), "pluginRepositories.pluginRepository", + request ); Build build = model.getBuild(); if ( build != null ) @@ -109,7 +110,8 @@ public class DefaultModelValidator PluginManagement mngt = build.getPluginManagement(); if ( mngt != null ) { - validateRawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin", request ); + validateRawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin", + request ); } } @@ -134,7 +136,8 @@ public class DefaultModelValidator + ".dependencyManagement.dependencies.dependency", request ); } - validateRepositories( problems, profile.getRepositories(), prefix + ".repositories.repository", request ); + validateRepositories( problems, profile.getRepositories(), prefix + ".repositories.repository", + request ); validateRepositories( problems, profile.getPluginRepositories(), prefix + ".pluginRepositories.pluginRepository", request ); @@ -257,7 +260,8 @@ public class DefaultModelValidator validateStringNotEmpty( "build.plugins.plugin.artifactId", problems, Severity.ERROR, p.getArtifactId(), p ); - validateStringNotEmpty( "build.plugins.plugin.groupId", problems, Severity.ERROR, p.getGroupId(), p ); + validateStringNotEmpty( "build.plugins.plugin.groupId", problems, Severity.ERROR, p.getGroupId(), + p ); validatePluginVersion( "build.plugins.plugin.version", problems, p.getVersion(), p.getKey(), p, request ); @@ -394,8 +398,8 @@ public class DefaultModelValidator validateVersion( prefix + "version", problems, errOn30, d.getVersion(), d.getManagementKey(), d ); /* - * TODO: Extensions like Flex Mojos use custom scopes like "merged", "internal", "external", etc. In - * order to don't break backward-compat with those, only warn but don't error out. + * TODO: Extensions like Flex Mojos use custom scopes like "merged", "internal", "external", etc. + * In order to don't break backward-compat with those, only warn but don't error out. */ validateEnum( prefix + "scope", problems, Severity.WARNING, d.getScope(), d.getManagementKey(), d, "provided", "compile", "runtime", "test", "system" ); @@ -448,7 +452,8 @@ public class DefaultModelValidator if ( StringUtils.isEmpty( systemPath ) ) { - addViolation( problems, Severity.ERROR, prefix + "systemPath", d.getManagementKey(), "is missing.", d ); + addViolation( problems, Severity.ERROR, prefix + "systemPath", d.getManagementKey(), "is missing.", + d ); } else { @@ -529,13 +534,15 @@ public class DefaultModelValidator } } - private void validateResources( ModelProblemCollector problems, List resources, String prefix, ModelBuildingRequest request ) + private void validateResources( ModelProblemCollector problems, List resources, String prefix, + ModelBuildingRequest request ) { Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); for ( Resource resource : resources ) { - validateStringNotEmpty( prefix + ".directory", problems, Severity.ERROR, resource.getDirectory(), resource ); + validateStringNotEmpty( prefix + ".directory", problems, Severity.ERROR, resource.getDirectory(), + resource ); validateBoolean( prefix + ".filtering", problems, errOn30, resource.getFiltering(), resource.getDirectory(), resource ); @@ -546,7 +553,8 @@ public class DefaultModelValidator // Field validation // ---------------------------------------------------------------------- - private boolean validateId( String fieldName, ModelProblemCollector problems, String id, InputLocationTracker tracker ) + private boolean validateId( String fieldName, ModelProblemCollector problems, String id, + InputLocationTracker tracker ) { return validateId( fieldName, problems, id, null, tracker ); } @@ -578,7 +586,8 @@ public class DefaultModelValidator return true; } - addViolation( problems, severity, fieldName, null, "contains an expression but should be a constant.", tracker ); + addViolation( problems, severity, fieldName, null, "contains an expression but should be a constant.", + tracker ); return false; } @@ -640,8 +649,8 @@ public class DefaultModelValidator return false; } - private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity, String string, - String sourceHint, InputLocationTracker tracker ) + private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity, + String string, String sourceHint, InputLocationTracker tracker ) { if ( string == null || string.length() <= 0 ) { @@ -680,8 +689,8 @@ public class DefaultModelValidator return false; } - private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity, String string, - String sourceHint, InputLocationTracker tracker ) + private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity, + String string, String sourceHint, InputLocationTracker tracker ) { if ( string == null || string.length() <= 0 ) { @@ -700,7 +709,8 @@ public class DefaultModelValidator } private boolean validatePluginVersion( String fieldName, ModelProblemCollector problems, String string, - String sourceHint, InputLocationTracker tracker, ModelBuildingRequest request ) + String sourceHint, InputLocationTracker tracker, + ModelBuildingRequest request ) { Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 ); @@ -733,7 +743,7 @@ public class DefaultModelValidator buffer.append( " for " ).append( sourceHint ); } - buffer.append(' ').append( message ); + buffer.append( ' ' ).append( message ); problems.add( severity, buffer.toString(), getLocation( fieldName, tracker ), null ); } diff --git a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java index 9685a4721f..822a1af151 100644 --- a/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java +++ b/maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java @@ -167,7 +167,8 @@ public class ModelMerger } } - protected void mergeModel_GroupId( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_GroupId( Model target, Model source, boolean sourceDominant, + Map context ) { String src = source.getGroupId(); if ( src != null ) @@ -194,7 +195,8 @@ public class ModelMerger } } - protected void mergeModel_Version( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Version( Model target, Model source, boolean sourceDominant, + Map context ) { String src = source.getVersion(); if ( src != null ) @@ -207,7 +209,8 @@ public class ModelMerger } } - protected void mergeModel_Packaging( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Packaging( Model target, Model source, boolean sourceDominant, + Map context ) { String src = source.getPackaging(); if ( src != null ) @@ -290,7 +293,8 @@ public class ModelMerger } } - protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant, + Map context ) { List src = source.getLicenses(); if ( !src.isEmpty() ) @@ -479,7 +483,8 @@ public class ModelMerger } } - protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant, Map context ) + protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant, + Map context ) { List src = source.getProfiles(); if ( !src.isEmpty() ) @@ -713,7 +718,8 @@ public class ModelMerger protected void mergeDistributionManagement_SnapshotRepository( DistributionManagement target, DistributionManagement source, - boolean sourceDominant, Map context ) + boolean sourceDominant, + Map context ) { DeploymentRepository src = source.getSnapshotRepository(); if ( src != null ) @@ -1580,7 +1586,8 @@ public class ModelMerger } } - protected void mergeLicense_Url( License target, License source, boolean sourceDominant, Map context ) + protected void mergeLicense_Url( License target, License source, boolean sourceDominant, + Map context ) { String src = source.getUrl(); if ( src != null ) @@ -2026,7 +2033,8 @@ public class ModelMerger } } - protected void mergeNotifier( Notifier target, Notifier source, boolean sourceDominant, Map context ) + protected void mergeNotifier( Notifier target, Notifier source, boolean sourceDominant, + Map context ) { mergeNotifier_Type( target, source, sourceDominant, context ); mergeNotifier_Address( target, source, sourceDominant, context ); @@ -2699,7 +2707,8 @@ public class ModelMerger } } - protected void mergeResource( Resource target, Resource source, boolean sourceDominant, Map context ) + protected void mergeResource( Resource target, Resource source, boolean sourceDominant, + Map context ) { mergeFileSet( target, source, sourceDominant, context ); mergeResource_TargetPath( target, source, sourceDominant, context ); diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java index 5d40bb8f3c..d33e9bfc3a 100644 --- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/AbstractMojo.java @@ -96,7 +96,8 @@ import org.apache.maven.plugin.logging.SystemStreamLog; * The execution of either will not affect the current project, but instead make available the * ${executedProject} expression if required. An alternate lifecycle can also be provided: * for more information see the documentation on the - * build lifecycle. + * build lifecycle. * * * @@ -158,15 +159,15 @@ public abstract class AbstractMojo } /** - * Returns the logger that has been injected into this mojo. If no logger has been setup yet, a SystemStreamLog - * logger will be created and returned. + * Returns the logger that has been injected into this mojo. If no logger has been setup yet, a + * SystemStreamLog logger will be created and returned. *

    * Note: * The logger returned by this method must not be cached in an instance field during the construction of the mojo. * This would cause the mojo to use a wrongly configured default logger when being run by Maven. The proper logger * gets injected by the Plexus container after the mojo has been constructed. Therefore, simply call this * method directly whenever you need the logger, it is fast enough and needs no caching. - * + * * @see org.apache.maven.plugin.Mojo#getLog() */ public Log getLog() diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java index 4642c09dad..76a2aad7af 100644 --- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/Mojo.java @@ -28,8 +28,8 @@ import org.apache.maven.plugin.logging.Log; * It features an execute() method, which triggers the Mojo's build-process behavior, and can throw * a MojoExecutionException or MojoFailureException if error conditions occur. *
    - * Also included is the setLog(...) method, which simply allows Maven to inject a logging mechanism which will - * allow the Mojo to communicate to the outside world through standard Maven channels. + * Also included is the setLog(...) method, which simply allows Maven to inject a logging mechanism which + * will allow the Mojo to communicate to the outside world through standard Maven channels. * * @author Jason van Zyl */ diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java index 26aeb9533e..b236c8c7bc 100644 --- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/DuplicateMojoDescriptorException.java @@ -23,9 +23,12 @@ public class DuplicateMojoDescriptorException extends InvalidPluginDescriptorException { - public DuplicateMojoDescriptorException( String goalPrefix, String goal, String existingImplementation, String newImplementation ) + public DuplicateMojoDescriptorException( String goalPrefix, String goal, String existingImplementation, + String newImplementation ) { - super( "Goal: " + goal + " already exists in the plugin descriptor for prefix: " + goalPrefix + "\nExisting implementation is: " + existingImplementation + "\nConflicting implementation is: " + newImplementation ); + super( "Goal: " + goal + " already exists in the plugin descriptor for prefix: " + goalPrefix + + "\nExisting implementation is: " + existingImplementation + + "\nConflicting implementation is: " + newImplementation ); } } diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java index 5ecdee4f51..31ff57b276 100644 --- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java +++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java @@ -33,7 +33,8 @@ import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; * The bean containing the Mojo descriptor. *
    * For more information about the usage tag, have a look to: - * http://maven.apache.org/developers/mojo-api-specification.html + * + * http://maven.apache.org/developers/mojo-api-specification.html * * @todo is there a need for the delegation of MavenMojoDescriptor to this? * Why not just extend ComponentDescriptor here? @@ -278,7 +279,8 @@ public class MojoDescriptor // ---------------------------------------------------------------------- /** - * @param requiresProject true if the Mojo needs a Maven project to be executed, false otherwise. + * @param requiresProject true if the Mojo needs a Maven project to be executed, false + * otherwise. */ public void setProjectRequired( boolean requiresProject ) { @@ -577,7 +579,8 @@ public class MojoDescriptor } /** - * @param aggregator true if the Mojo uses the Maven project and its child modules, false otherwise. + * @param aggregator true if the Mojo uses the Maven project and its child modules, + * false otherwise. */ public void setAggregator( boolean aggregator ) { @@ -585,7 +588,8 @@ public class MojoDescriptor } /** - * @return true if the Mojo uses the Maven project and its child modules, false otherwise. + * @return true if the Mojo uses the Maven project and its child modules, + * false otherwise. */ public boolean isAggregator() { @@ -601,7 +605,8 @@ public class MojoDescriptor } /** - * @param directInvocationOnly true if the Mojo could not be invoke directly, false otherwise. + * @param directInvocationOnly true if the Mojo could not be invoke directly, + * false otherwise. */ public void setDirectInvocationOnly( boolean directInvocationOnly ) { diff --git a/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java b/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java index 8e73f3f77c..c0480a60ce 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java @@ -1,7 +1,5 @@ package org.apache.maven.settings; -import java.io.File; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -21,6 +19,7 @@ import java.io.File; * under the License. */ +import java.io.File; /** * To handle runtime informations like local repository or profiles. @@ -35,14 +34,14 @@ public class RuntimeInfo public static final File userMavenConfigurationHome = new File( userHome, ".m2" ); public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" ); - + private File settings; public RuntimeInfo() { this.settings = DEFAULT_USER_SETTINGS_FILE; } - + public RuntimeInfo( File settings ) { this.settings = settings;