From a59be5a236cfd92c9653bcce73aae5436704117e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Sun, 9 Oct 2022 20:35:47 +0200 Subject: [PATCH 01/11] Restore compatibility on SettingsBuilder, ToolchainsBuilder and MojoDescriptorCreator --- .../java/org/apache/maven/api/Session.java | 12 ++ ...uilderProblem.java => BuilderProblem.java} | 13 +- ...erity.java => BuilderProblemSeverity.java} | 2 +- .../maven/api/services/ProjectBuilder.java | 4 +- .../api/services/ProjectBuilderRequest.java | 14 +- .../api/services/ProjectBuilderResult.java | 2 +- .../maven/api/services/SettingsBuilder.java | 71 ++++++ .../services/SettingsBuilderException.java | 43 ++++ .../api/services/SettingsBuilderRequest.java | 204 ++++++++++++++++++ .../api/services/SettingsBuilderResult.java | 48 +++++ ...{ProjectBuilderSource.java => Source.java} | 2 +- .../maven/api/services/ToolchainsBuilder.java | 42 ++++ .../services/ToolchainsBuilderException.java | 43 ++++ .../services/ToolchainsBuilderRequest.java | 196 +++++++++++++++++ .../api/services/ToolchainsBuilderResult.java | 47 ++++ .../artifact/manager/DefaultWagonManager.java | 8 +- .../legacy/LegacyRepositorySystem.java | 8 +- ...DefaultRepositorySystemSessionFactory.java | 10 +- .../internal/impl/DefaultProjectBuilder.java | 18 +- .../maven/internal/impl/DefaultSession.java | 18 +- .../internal/impl/DefaultSessionFactory.java | 12 +- .../internal/impl/DefaultSettingsBuilder.java | 189 ++++++++++++++++ .../impl/DefaultToolchainsBuilder.java | 188 ++++++++++++++++ ...faultLifecycleExecutionPlanCalculator.java | 4 +- .../internal/MojoDescriptorCreator.java | 4 +- .../settings/DefaultMavenSettingsBuilder.java | 1 - .../maven/settings/MavenSettingsBuilder.java | 1 - .../AbstractCoreMavenComponentTestCase.java | 2 +- .../apache/maven/internal/impl/TestApi.java | 10 +- .../lifecycle/LifecycleExecutorTest.java | 2 +- .../java/org/apache/maven/cli/MavenCli.java | 3 +- .../SettingsXmlConfigurationProcessor.java | 27 +-- .../building/DefaultSettingsBuilder.java | 5 +- .../DefaultSettingsBuildingResult.java | 2 +- .../building/SettingsBuildingResult.java | 2 +- .../crypto/DefaultSettingsDecrypter.java | 10 +- .../DefaultSettingsDecryptionRequest.java | 6 +- .../DefaultSettingsDecryptionResult.java | 4 +- .../crypto/SettingsDecryptionRequest.java | 4 +- .../crypto/SettingsDecryptionResult.java | 4 +- .../building/DefaultToolchainsBuilder.java | 4 +- .../DefaultToolchainsBuildingResult.java | 2 +- .../building/ToolchainsBuildingResult.java | 2 +- .../DefaultToolchainsBuilderTest.java | 4 +- 44 files changed, 1208 insertions(+), 89 deletions(-) rename api/maven-api-core/src/main/java/org/apache/maven/api/services/{ProjectBuilderProblem.java => BuilderProblem.java} (91%) rename api/maven-api-core/src/main/java/org/apache/maven/api/services/{ProjectBuilderProblemSeverity.java => BuilderProblemSeverity.java} (96%) create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java rename api/maven-api-core/src/main/java/org/apache/maven/api/services/{ProjectBuilderSource.java => Source.java} (96%) create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java create mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java create mode 100644 maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java create mode 100644 maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java index 5e0e3808d108..a8216fa54102 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java @@ -56,9 +56,21 @@ public interface Session @Nonnull SessionData getData(); + /** + * Gets the user properties to use for interpolation. 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}. + */ @Nonnull Map getUserProperties(); + /** + * Gets the system properties to use for interpolation. The system properties are collected from the runtime + * environment like {@link System#getProperties()} and environment variables. + * + * @return The system properties, never {@code null}. + */ @Nonnull Map getSystemProperties(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblem.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java similarity index 91% rename from api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblem.java rename to api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java index fef6ceae0dd4..82f2b53d413b 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblem.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java @@ -20,6 +20,9 @@ */ import org.apache.maven.api.annotations.Experimental; +import org.apache.maven.api.annotations.Immutable; +import org.apache.maven.api.annotations.Nonnull; +import org.apache.maven.api.annotations.Nullable; /** * Describes a problem that was encountered during project building. A problem can either be an exception that was @@ -28,7 +31,8 @@ * @since 4.0 */ @Experimental -public interface ProjectBuilderProblem +@Immutable +public interface BuilderProblem { /** @@ -39,6 +43,7 @@ public interface ProjectBuilderProblem * * @return The hint about the source of the problem or an empty string if unknown, never {@code null}. */ + @Nonnull String getSource(); /** @@ -64,6 +69,7 @@ public interface ProjectBuilderProblem * * @return The location of the problem, never {@code null}. */ + @Nonnull String getLocation(); /** @@ -71,6 +77,7 @@ public interface ProjectBuilderProblem * * @return The exception that caused this problem or {@code null} if not applicable. */ + @Nullable Exception getException(); /** @@ -78,6 +85,7 @@ public interface ProjectBuilderProblem * * @return The message describing this problem, never {@code null}. */ + @Nonnull String getMessage(); /** @@ -85,6 +93,7 @@ public interface ProjectBuilderProblem * * @return The severity level of this problem, never {@code null}. */ - ProjectBuilderProblemSeverity getSeverity(); + @Nonnull + BuilderProblemSeverity getSeverity(); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblemSeverity.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java similarity index 96% rename from api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblemSeverity.java rename to api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java index 6af0257098fc..92197417230f 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblemSeverity.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java @@ -27,7 +27,7 @@ * @since 4.0 */ @Experimental -public enum ProjectBuilderProblemSeverity +public enum BuilderProblemSeverity { FATAL, // diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java index d7829752f958..f5461acdc937 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java @@ -51,13 +51,13 @@ public interface ProjectBuilder extends Service * Creates a {@link org.apache.maven.api.Project} from a POM file. * * @param session The {@link Session}, must not be {@code null}. - * @param source The {@link ProjectBuilderSource}, must not be {@code null}. + * @param source The {@link Source}, must not be {@code null}. * @throws ProjectBuilderException if the project can not be created * @throws IllegalArgumentException if an argument is {@code null} or invalid * @see #build(ProjectBuilderRequest) */ @Nonnull - default ProjectBuilderResult build( @Nonnull Session session, @Nonnull ProjectBuilderSource source ) + default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Source source ) { return build( ProjectBuilderRequest.build( session, source ) ); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java index 4b90e8bfd559..f542011c1f1e 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java @@ -52,7 +52,7 @@ public interface ProjectBuilderRequest Optional getPath(); @Nonnull - Optional getSource(); + Optional getSource(); @Nonnull Optional getArtifact(); @@ -69,7 +69,7 @@ public interface ProjectBuilderRequest boolean isResolveDependencies(); @Nonnull - static ProjectBuilderRequest build( @Nonnull Session session, @Nonnull ProjectBuilderSource source ) + static ProjectBuilderRequest build( @Nonnull Session session, @Nonnull Source source ) { return builder() .session( nonNull( session, "session can not be null" ) ) @@ -115,7 +115,7 @@ class ProjectBuilderRequestBuilder { Session session; Path path; - ProjectBuilderSource source; + Source source; Artifact artifact; ArtifactCoordinate coordinate; boolean allowStubModel; @@ -135,7 +135,7 @@ public ProjectBuilderRequestBuilder path( Path path ) return this; } - public ProjectBuilderRequestBuilder source( ProjectBuilderSource source ) + public ProjectBuilderRequestBuilder source( Source source ) { this.source = source; return this; @@ -175,7 +175,7 @@ private static class DefaultProjectBuilderRequest extends BaseRequest implements ProjectBuilderRequest { private final Path path; - private final ProjectBuilderSource source; + private final Source source; private final Artifact artifact; private final ArtifactCoordinate coordinate; private final boolean allowStubModel; @@ -186,7 +186,7 @@ private static class DefaultProjectBuilderRequest extends BaseRequest @SuppressWarnings( "checkstyle:ParameterNumber" ) DefaultProjectBuilderRequest( @Nonnull Session session, @Nullable Path path, - @Nullable ProjectBuilderSource source, + @Nullable Source source, @Nullable Artifact artifact, @Nullable ArtifactCoordinate coordinate, boolean allowStubModel, @@ -214,7 +214,7 @@ public Optional getPath() @Nonnull @Override - public Optional getSource() + public Optional getSource() { return Optional.ofNullable( source ); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java index a76b6cab2ffb..7b8872991cde 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java @@ -70,7 +70,7 @@ public interface ProjectBuilderResult * @return The problems that were encountered during the project building, can be empty but never {@code null}. */ @Nonnull - Collection getProblems(); + Collection getProblems(); /** * Gets the result of the dependency resolution for the project. diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java new file mode 100644 index 000000000000..553194926a3a --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java @@ -0,0 +1,71 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.nio.file.Path; + +import org.apache.maven.api.Service; +import org.apache.maven.api.Session; +import org.apache.maven.api.annotations.Nonnull; + +/** + * Builds the effective settings from a user settings file and/or a global settings file. + */ +public interface SettingsBuilder extends Service +{ + + /** + * Builds the effective settings of the specified settings files. + * + * @param request The settings building request that holds the parameters, must not be {@code null}. + * @return The result of the settings building, never {@code null}. + * @throws SettingsBuilderException If the effective settings could not be built. + */ + @Nonnull + SettingsBuilderResult build( @Nonnull SettingsBuilderRequest request ); + + /** + * Builds the effective settings of the specified settings sources. + * + * @return The result of the settings building, never {@code null}. + * @throws SettingsBuilderException If the effective settings could not be built. + */ + @Nonnull + default SettingsBuilderResult build( @Nonnull Session session, + @Nonnull Source globalSettingsSource, + @Nonnull Source userSettingsSource ) + { + return build( SettingsBuilderRequest.build( session, globalSettingsSource, userSettingsSource ) ); + } + + /** + * Builds the effective settings of the specified settings paths. + * + * @return The result of the settings building, never {@code null}. + * @throws SettingsBuilderException If the effective settings could not be built. + */ + @Nonnull + default SettingsBuilderResult build( @Nonnull Session session, + @Nonnull Path globalSettingsPath, + @Nonnull Path userSettingsPath ) + { + return build( SettingsBuilderRequest.build( session, globalSettingsPath, userSettingsPath ) ); + } +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java new file mode 100644 index 000000000000..d71312b88a82 --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java @@ -0,0 +1,43 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.api.annotations.Experimental; + +/** + * The Exception class throw by the {@link SettingsBuilder}. + * + * @since 4.0 + */ +@Experimental +public class SettingsBuilderException + extends MavenException +{ + /** + * @param message The message to give. + * @param e The {@link Exception}. + */ + public SettingsBuilderException( String message, Exception e ) + { + super( message, e ); + } + + // TODO: add SettingsBuilderResult +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java new file mode 100644 index 000000000000..432d7bf5d91d --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java @@ -0,0 +1,204 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.nio.file.Path; +import java.util.Optional; + +import org.apache.maven.api.Session; +import org.apache.maven.api.annotations.Experimental; +import org.apache.maven.api.annotations.Immutable; +import org.apache.maven.api.annotations.Nonnull; +import org.apache.maven.api.annotations.NotThreadSafe; +import org.apache.maven.api.annotations.Nullable; + +import static org.apache.maven.api.services.BaseRequest.nonNull; + +/** + * Collects settings that control the building of effective settings. + */ +@Experimental +@Immutable +public interface SettingsBuilderRequest +{ + + @Nonnull + Session getSession(); + + /** + * Gets the global settings path. + * + * @return The global settings path or {@code null} if none. + */ + @Nonnull + Optional getGlobalSettingsPath(); + + /** + * Gets the global settings source. + * + * @return The global settings source or {@code null} if none. + */ + @Nonnull + Optional getGlobalSettingsSource(); + + /** + * Gets the user settings path. + * + * @return The user settings path or {@code null} if none. + */ + @Nonnull + Optional getUserSettingsPath(); + + /** + * Gets the user settings source. + * + * @return The user settings source or {@code null} if none. + */ + @Nonnull + Optional getUserSettingsSource(); + + @Nonnull + static SettingsBuilderRequest build( @Nonnull Session session, + @Nonnull Source globalSettingsSource, + @Nonnull Source userSettingsSource ) + { + return builder() + .session( nonNull( session, "session can not be null" ) ) + .globalSettingsSource( nonNull( globalSettingsSource, "globalSettingsSource can not be null" ) ) + .userSettingsSource( nonNull( userSettingsSource, "userSettingsSource can not be null" ) ) + .build(); + } + + @Nonnull + static SettingsBuilderRequest build( @Nonnull Session session, + @Nonnull Path globalSettingsPath, + @Nonnull Path userSettingsPath ) + { + return builder() + .session( nonNull( session, "session can not be null" ) ) + .globalSettingsPath( nonNull( globalSettingsPath, "globalSettingsPath can not be null" ) ) + .userSettingsPath( nonNull( userSettingsPath, "userSettingsPath can not be null" ) ) + .build(); + } + + @Nonnull + static SettingsBuilderRequestBuilder builder() + { + return new SettingsBuilderRequestBuilder(); + } + + @NotThreadSafe + class SettingsBuilderRequestBuilder + { + Session session; + Path globalSettingsPath; + Source globalSettingsSource; + Path userSettingsPath; + Source userSettingsSource; + + public SettingsBuilderRequestBuilder session( Session session ) + { + this.session = session; + return this; + } + + public SettingsBuilderRequestBuilder globalSettingsPath( Path globalSettingsPath ) + { + this.globalSettingsPath = globalSettingsPath; + return this; + } + + public SettingsBuilderRequestBuilder globalSettingsSource( Source globalSettingsSource ) + { + this.globalSettingsSource = globalSettingsSource; + return this; + } + + public SettingsBuilderRequestBuilder userSettingsPath( Path userSettingsPath ) + { + this.userSettingsPath = userSettingsPath; + return this; + } + + public SettingsBuilderRequestBuilder userSettingsSource( Source userSettingsSource ) + { + this.userSettingsSource = userSettingsSource; + return this; + } + + public SettingsBuilderRequest build() + { + return new DefaultSettingsBuilderRequest( session, + globalSettingsPath, globalSettingsSource, + userSettingsPath, userSettingsSource ); + } + + private static class DefaultSettingsBuilderRequest extends BaseRequest + implements SettingsBuilderRequest + { + private final Path globalSettingsPath; + private final Source globalSettingsSource; + private final Path userSettingsPath; + private final Source userSettingsSource; + + @SuppressWarnings( "checkstyle:ParameterNumber" ) + DefaultSettingsBuilderRequest( @Nonnull Session session, + @Nullable Path globalSettingsPath, + @Nullable Source globalSettingsSource, + @Nullable Path userSettingsPath, + @Nullable Source userSettingsSource ) + { + super( session ); + this.globalSettingsPath = globalSettingsPath; + this.globalSettingsSource = globalSettingsSource; + this.userSettingsPath = userSettingsPath; + this.userSettingsSource = userSettingsSource; + } + + @Nonnull + @Override + public Optional getGlobalSettingsPath() + { + return Optional.ofNullable( globalSettingsPath ); + } + + @Nonnull + @Override + public Optional getGlobalSettingsSource() + { + return Optional.ofNullable( globalSettingsSource ); + } + + @Nonnull + @Override + public Optional getUserSettingsPath() + { + return Optional.ofNullable( userSettingsPath ); + } + + @Nonnull + @Override + public Optional getUserSettingsSource() + { + return Optional.ofNullable( userSettingsSource ); + } + } + } +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java new file mode 100644 index 000000000000..a10df6a9fbff --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java @@ -0,0 +1,48 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.api.annotations.Nonnull; +import org.apache.maven.api.settings.Settings; + +public interface SettingsBuilderResult +{ + + /** + * Gets the assembled settings. + * + * @return The assembled settings, never {@code null}. + */ + @Nonnull + Settings getEffectiveSettings(); + + /** + * Gets the problems that were encountered during the settings building. Note that only problems of severity + * {@link BuilderProblemSeverity#WARNING} and below are reported here. Problems with a higher severity level cause + * the settings builder to fail with a {@link SettingsBuilderException}. + * + * @return The problems that were encountered during the settings building, can be empty but never {@code null}. + */ + @Nonnull + List getProblems(); + +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderSource.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java similarity index 96% rename from api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderSource.java rename to api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java index 1add18cb12fb..08eea48c300d 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderSource.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/Source.java @@ -30,7 +30,7 @@ * @since 4.0 */ @Experimental -public interface ProjectBuilderSource +public interface Source { InputStream getInputStream() throws IOException; diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java new file mode 100644 index 000000000000..168acccb42ca --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java @@ -0,0 +1,42 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.api.Service; +import org.apache.maven.api.annotations.Experimental; + +/** + * Builds the effective toolchains from a user toolchains file and/or a global toolchains file. + */ +@Experimental + +public interface ToolchainsBuilder extends Service +{ + + /** + * Builds the effective toolchains of the specified toolchains files. + * + * @param request The toolchains building request that holds the parameters, must not be {@code null}. + * @return The result of the toolchains building, never {@code null}. + * @throws ToolchainsBuilderException If the effective toolchains could not be built. + */ + ToolchainsBuilderResult build( ToolchainsBuilderRequest request ); + +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java new file mode 100644 index 000000000000..2aa96411ac2a --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java @@ -0,0 +1,43 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.api.annotations.Experimental; + +/** + * The Exception class throw by the {@link ToolchainsBuilder}. + * + * @since 4.0 + */ +@Experimental +public class ToolchainsBuilderException + extends MavenException +{ + /** + * @param message The message to give. + * @param e The {@link Exception}. + */ + public ToolchainsBuilderException( String message, Exception e ) + { + super( message, e ); + } + + // TODO: add ToolchainsBuilderResult +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java new file mode 100644 index 000000000000..cc6f1cb04a13 --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java @@ -0,0 +1,196 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.nio.file.Path; +import java.util.Optional; + +import org.apache.maven.api.Session; +import org.apache.maven.api.annotations.Nonnull; +import org.apache.maven.api.annotations.NotThreadSafe; +import org.apache.maven.api.annotations.Nullable; + +import static org.apache.maven.api.services.BaseRequest.nonNull; + +public interface ToolchainsBuilderRequest +{ + @Nonnull + Session getSession(); + + /** + * Gets the global Toolchains path. + * + * @return The global Toolchains path or {@code null} if none. + */ + @Nonnull + Optional getGlobalToolchainsPath(); + + /** + * Gets the global Toolchains source. + * + * @return The global Toolchains source or {@code null} if none. + */ + @Nonnull + Optional getGlobalToolchainsSource(); + + /** + * Gets the user Toolchains path. + * + * @return The user Toolchains path or {@code null} if none. + */ + @Nonnull + Optional getUserToolchainsPath(); + + /** + * Gets the user Toolchains source. + * + * @return The user Toolchains source or {@code null} if none. + */ + @Nonnull + Optional getUserToolchainsSource(); + + @Nonnull + static ToolchainsBuilderRequest build( @Nonnull Session session, + @Nonnull Source globalToolchainsSource, + @Nonnull Source userToolchainsSource ) + { + return builder() + .session( nonNull( session, "session can not be null" ) ) + .globalToolchainsSource( nonNull( globalToolchainsSource, "globalToolchainsSource can not be null" ) ) + .userToolchainsSource( nonNull( userToolchainsSource, "userToolchainsSource can not be null" ) ) + .build(); + } + + @Nonnull + static ToolchainsBuilderRequest build( @Nonnull Session session, + @Nonnull Path globalToolchainsPath, + @Nonnull Path userToolchainsPath ) + { + return builder() + .session( nonNull( session, "session can not be null" ) ) + .globalToolchainsPath( nonNull( globalToolchainsPath, "globalToolchainsPath can not be null" ) ) + .userToolchainsPath( nonNull( userToolchainsPath, "userToolchainsPath can not be null" ) ) + .build(); + } + + @Nonnull + static ToolchainsBuilderRequestBuilder builder() + { + return new ToolchainsBuilderRequestBuilder(); + } + + @NotThreadSafe + class ToolchainsBuilderRequestBuilder + { + Session session; + Path globalToolchainsPath; + Source globalToolchainsSource; + Path userToolchainsPath; + Source userToolchainsSource; + + public ToolchainsBuilderRequestBuilder session( Session session ) + { + this.session = session; + return this; + } + + public ToolchainsBuilderRequestBuilder globalToolchainsPath( Path globalToolchainsPath ) + { + this.globalToolchainsPath = globalToolchainsPath; + return this; + } + + public ToolchainsBuilderRequestBuilder globalToolchainsSource( Source globalToolchainsSource ) + { + this.globalToolchainsSource = globalToolchainsSource; + return this; + } + + public ToolchainsBuilderRequestBuilder userToolchainsPath( Path userToolchainsPath ) + { + this.userToolchainsPath = userToolchainsPath; + return this; + } + + public ToolchainsBuilderRequestBuilder userToolchainsSource( Source userToolchainsSource ) + { + this.userToolchainsSource = userToolchainsSource; + return this; + } + + public ToolchainsBuilderRequest build() + { + return new ToolchainsBuilderRequestBuilder.DefaultToolchainsBuilderRequest( session, + globalToolchainsPath, globalToolchainsSource, + userToolchainsPath, userToolchainsSource ); + } + + private static class DefaultToolchainsBuilderRequest extends BaseRequest + implements ToolchainsBuilderRequest + { + private final Path globalToolchainsPath; + private final Source globalToolchainsSource; + private final Path userToolchainsPath; + private final Source userToolchainsSource; + + @SuppressWarnings( "checkstyle:ParameterNumber" ) + DefaultToolchainsBuilderRequest( @Nonnull Session session, + @Nullable Path globalToolchainsPath, + @Nullable Source globalToolchainsSource, + @Nullable Path userToolchainsPath, + @Nullable Source userToolchainsSource ) + { + super( session ); + this.globalToolchainsPath = globalToolchainsPath; + this.globalToolchainsSource = globalToolchainsSource; + this.userToolchainsPath = userToolchainsPath; + this.userToolchainsSource = userToolchainsSource; + } + + @Nonnull + @Override + public Optional getGlobalToolchainsPath() + { + return Optional.ofNullable( globalToolchainsPath ); + } + + @Nonnull + @Override + public Optional getGlobalToolchainsSource() + { + return Optional.ofNullable( globalToolchainsSource ); + } + + @Nonnull + @Override + public Optional getUserToolchainsPath() + { + return Optional.ofNullable( userToolchainsPath ); + } + + @Nonnull + @Override + public Optional getUserToolchainsSource() + { + return Optional.ofNullable( userToolchainsSource ); + } + } + } +} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java new file mode 100644 index 000000000000..63e3325de27d --- /dev/null +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java @@ -0,0 +1,47 @@ +package org.apache.maven.api.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.api.annotations.Nonnull; +import org.apache.maven.api.toolchain.PersistedToolchains; + +public interface ToolchainsBuilderResult +{ + /** + * Gets the assembled toolchains. + * + * @return The assembled toolchains, never {@code null}. + */ + @Nonnull + PersistedToolchains getEffectiveToolchains(); + + /** + * Gets the problems that were encountered during the settings building. Note that only problems of severity + * {@link BuilderProblemSeverity#WARNING} and below are reported here. Problems with a higher severity level cause + * the settings builder to fail with a {@link ToolchainsBuilderException}. + * + * @return The problems that were encountered during the settings building, can be empty but never {@code null}. + */ + @Nonnull + List getProblems(); + +} 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 2bfefbec4c0a..2724b1f55c2c 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 @@ -86,8 +86,8 @@ public AuthenticationInfo getAuthenticationInfo( String id ) if ( id.equalsIgnoreCase( server.getId() ) ) { SettingsDecryptionResult result = settingsDecrypter.decrypt( - new DefaultSettingsDecryptionRequest( server.getDelegate() ) ); - server = new Server( result.getServer() ); + new DefaultSettingsDecryptionRequest( server ) ); + server = result.getServer(); AuthenticationInfo authInfo = new AuthenticationInfo(); authInfo.setUserName( server.getUsername() ); @@ -125,8 +125,8 @@ public ProxyInfo getProxy( String protocol ) if ( proxy.isActive() && protocol.equalsIgnoreCase( proxy.getProtocol() ) ) { SettingsDecryptionResult result = settingsDecrypter.decrypt( - new DefaultSettingsDecryptionRequest( proxy.getDelegate() ) ); - proxy = new Proxy( result.getProxy() ); + new DefaultSettingsDecryptionRequest( proxy ) ); + proxy = result.getProxy(); ProxyInfo proxyInfo = new ProxyInfo(); proxyInfo.setHost( proxy.getHost() ); 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 bd97b399284d..0ace040c2372 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 @@ -563,9 +563,9 @@ public void injectAuthentication( List repositories, List repositories, List children = dom.getChildren().stream() .filter( c -> !"wagonProvider".equals( c.getName() ) ) .collect( Collectors.toList() ); diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java index d9911c20148d..77ad86c376ae 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java @@ -38,11 +38,11 @@ import org.apache.maven.api.services.DependencyCollectorResult; import org.apache.maven.api.services.ProjectBuilder; import org.apache.maven.api.services.ProjectBuilderException; -import org.apache.maven.api.services.ProjectBuilderProblem; -import org.apache.maven.api.services.ProjectBuilderProblemSeverity; +import org.apache.maven.api.services.BuilderProblem; +import org.apache.maven.api.services.BuilderProblemSeverity; import org.apache.maven.api.services.ProjectBuilderRequest; import org.apache.maven.api.services.ProjectBuilderResult; -import org.apache.maven.api.services.ProjectBuilderSource; +import org.apache.maven.api.services.Source; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.model.building.ModelProblem; @@ -87,7 +87,7 @@ public ProjectBuilderResult build( ProjectBuilderRequest request ) } else if ( request.getSource().isPresent() ) { - ProjectBuilderSource source = request.getSource().get(); + Source source = request.getSource().get(); ModelSource modelSource = new ModelSource() { @Override @@ -149,14 +149,14 @@ public Optional getProject() @Nonnull @Override - public Collection getProblems() + public Collection getProblems() { return new MappedCollection<>( res.getProblems(), this::toProblem ); } - private ProjectBuilderProblem toProblem( ModelProblem problem ) + private BuilderProblem toProblem( ModelProblem problem ) { - return new ProjectBuilderProblem() + return new BuilderProblem() { @Override public String getSource() @@ -224,9 +224,9 @@ public String getMessage() } @Override - public ProjectBuilderProblemSeverity getSeverity() + public BuilderProblemSeverity getSeverity() { - return ProjectBuilderProblemSeverity.valueOf( problem.getSeverity().name() ); + return BuilderProblemSeverity.valueOf( problem.getSeverity().name() ); } }; } diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSession.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSession.java index 12af08d6e716..a5868bd3f0df 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSession.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSession.java @@ -57,7 +57,9 @@ import org.apache.maven.api.services.ProjectManager; import org.apache.maven.api.services.Prompter; import org.apache.maven.api.services.RepositoryFactory; +import org.apache.maven.api.services.SettingsBuilder; import org.apache.maven.api.services.ToolchainManager; +import org.apache.maven.api.services.ToolchainsBuilder; import org.apache.maven.api.services.TypeRegistry; import org.apache.maven.api.services.VersionParser; import org.apache.maven.api.services.xml.ModelXmlFactory; @@ -96,6 +98,8 @@ public class DefaultSession extends AbstractSession private final MojoExecutionScope mojoExecutionScope; private final RuntimeInformation runtimeInformation; private final ArtifactHandlerManager artifactHandlerManager; + private final org.apache.maven.settings.building.SettingsBuilder settingsBuilder; + private final org.apache.maven.toolchain.building.ToolchainsBuilder toolchainsBuilder; private final Map, Service> services = new HashMap<>(); @SuppressWarnings( "checkstyle:ParameterNumber" ) @@ -108,7 +112,9 @@ public DefaultSession( @Nonnull MavenSession session, @Nonnull PlexusContainer container, @Nonnull MojoExecutionScope mojoExecutionScope, @Nonnull RuntimeInformation runtimeInformation, - @Nonnull ArtifactHandlerManager artifactHandlerManager ) + @Nonnull ArtifactHandlerManager artifactHandlerManager, + @Nonnull org.apache.maven.settings.building.SettingsBuilder settingsBuilder, + @Nonnull org.apache.maven.toolchain.building.ToolchainsBuilder toolchainsBuilder ) { this.mavenSession = nonNull( session ); this.session = mavenSession.getRepositorySession(); @@ -124,6 +130,8 @@ public DefaultSession( @Nonnull MavenSession session, this.mojoExecutionScope = mojoExecutionScope; this.runtimeInformation = runtimeInformation; this.artifactHandlerManager = artifactHandlerManager; + this.settingsBuilder = settingsBuilder; + this.toolchainsBuilder = toolchainsBuilder; ArtifactManager artifactManager = new DefaultArtifactManager( this ); ProjectManager projectManager = new DefaultProjectManager( this, artifactManager, container ); @@ -149,6 +157,8 @@ public DefaultSession( @Nonnull MavenSession session, services.put( ArtifactCoordinateFactory.class, new DefaultArtifactCoordinateFactory() ); services.put( TypeRegistry.class, new DefaultTypeRegistry( artifactHandlerManager ) ); services.put( Lookup.class, new DefaultLookup( container ) ); + services.put( SettingsBuilder.class, new DefaultSettingsBuilder( settingsBuilder ) ); + services.put( ToolchainsBuilder.class, new DefaultToolchainsBuilder( toolchainsBuilder ) ); } public MavenSession getMavenSession() @@ -305,7 +315,8 @@ public Session withLocalRepository( @Nonnull LocalRepository localRepository ) MavenSession newSession = new MavenSession( mavenSession.getContainer(), repoSession, mavenSession.getRequest(), mavenSession.getResult() ); return new DefaultSession( newSession, repositorySystem, repositories, projectBuilder, mavenRepositorySystem, - toolchainManagerPrivate, container, mojoExecutionScope, runtimeInformation, artifactHandlerManager ); + toolchainManagerPrivate, container, mojoExecutionScope, runtimeInformation, artifactHandlerManager, + settingsBuilder, toolchainsBuilder ); } @Nonnull @@ -313,7 +324,8 @@ public Session withLocalRepository( @Nonnull LocalRepository localRepository ) public Session withRemoteRepositories( @Nonnull List repositories ) { return new DefaultSession( mavenSession, repositorySystem, repositories, projectBuilder, mavenRepositorySystem, - toolchainManagerPrivate, container, mojoExecutionScope, runtimeInformation, artifactHandlerManager ); + toolchainManagerPrivate, container, mojoExecutionScope, runtimeInformation, artifactHandlerManager, + settingsBuilder, toolchainsBuilder ); } @Nonnull diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSessionFactory.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSessionFactory.java index 4816006abb71..cd4a084af405 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSessionFactory.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSessionFactory.java @@ -30,7 +30,9 @@ import org.apache.maven.execution.scope.internal.MojoExecutionScope; import org.apache.maven.project.ProjectBuilder; import org.apache.maven.rtinfo.RuntimeInformation; +import org.apache.maven.settings.building.SettingsBuilder; import org.apache.maven.toolchain.DefaultToolchainManagerPrivate; +import org.apache.maven.toolchain.building.ToolchainsBuilder; import org.codehaus.plexus.PlexusContainer; import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.SessionData; @@ -47,6 +49,8 @@ public class DefaultSessionFactory private final MojoExecutionScope mojoExecutionScope; private final RuntimeInformation runtimeInformation; private final ArtifactHandlerManager artifactHandlerManager; + private final SettingsBuilder settingsBuilder; + private final ToolchainsBuilder toolchainsBuilder; @Inject @SuppressWarnings( "checkstyle:ParameterNumber" ) @@ -57,7 +61,9 @@ public DefaultSessionFactory( RepositorySystem repositorySystem, PlexusContainer plexusContainer, MojoExecutionScope mojoExecutionScope, RuntimeInformation runtimeInformation, - ArtifactHandlerManager artifactHandlerManager ) + ArtifactHandlerManager artifactHandlerManager, + SettingsBuilder settingsBuilder, + ToolchainsBuilder toolchainsBuilder ) { this.repositorySystem = repositorySystem; this.projectBuilder = projectBuilder; @@ -67,6 +73,8 @@ public DefaultSessionFactory( RepositorySystem repositorySystem, this.mojoExecutionScope = mojoExecutionScope; this.runtimeInformation = runtimeInformation; this.artifactHandlerManager = artifactHandlerManager; + this.settingsBuilder = settingsBuilder; + this.toolchainsBuilder = toolchainsBuilder; } public Session getSession( MavenSession mavenSession ) @@ -80,6 +88,6 @@ private Session newSession( MavenSession mavenSession ) return new DefaultSession( mavenSession, repositorySystem, null, projectBuilder, mavenRepositorySystem, toolchainManagerPrivate, plexusContainer, mojoExecutionScope, runtimeInformation, - artifactHandlerManager ); + artifactHandlerManager, settingsBuilder, toolchainsBuilder ); } } diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java new file mode 100644 index 000000000000..1ea54aa23989 --- /dev/null +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java @@ -0,0 +1,189 @@ +package org.apache.maven.internal.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.maven.api.annotations.Nonnull; +import org.apache.maven.api.services.BuilderProblem; +import org.apache.maven.api.services.BuilderProblemSeverity; +import org.apache.maven.api.services.SettingsBuilder; +import org.apache.maven.api.services.SettingsBuilderException; +import org.apache.maven.api.services.SettingsBuilderRequest; +import org.apache.maven.api.services.SettingsBuilderResult; +import org.apache.maven.api.services.Source; +import org.apache.maven.api.settings.Settings; +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; +import org.apache.maven.settings.building.SettingsBuildingException; +import org.apache.maven.settings.building.SettingsBuildingResult; +import org.apache.maven.settings.building.SettingsProblem; +import org.apache.maven.settings.building.SettingsSource; + +@Named +@Singleton +public class DefaultSettingsBuilder implements SettingsBuilder +{ + + private final org.apache.maven.settings.building.SettingsBuilder builder; + + @Inject + public DefaultSettingsBuilder( org.apache.maven.settings.building.SettingsBuilder builder ) + { + this.builder = builder; + } + + @Nonnull + @Override + public SettingsBuilderResult build( SettingsBuilderRequest request ) + throws SettingsBuilderException, IllegalArgumentException + { + DefaultSession session = ( DefaultSession ) request.getSession(); + try + { + DefaultSettingsBuildingRequest req = new DefaultSettingsBuildingRequest(); + req.setUserProperties( toProperties( session.getUserProperties() ) ); + req.setSystemProperties( toProperties( session.getSystemProperties() ) ); + if ( request.getGlobalSettingsSource().isPresent() ) + { + req.setGlobalSettingsSource( new MappedSettingsSource( request.getGlobalSettingsSource().get() ) ); + } + if ( request.getGlobalSettingsPath().isPresent() ) + { + req.setGlobalSettingsFile( request.getGlobalSettingsPath().get().toFile() ); + } + if ( request.getUserSettingsSource().isPresent() ) + { + req.setUserSettingsSource( new MappedSettingsSource( request.getUserSettingsSource().get() ) ); + } + if ( request.getUserSettingsPath().isPresent() ) + { + req.setUserSettingsFile( request.getUserSettingsPath().get().toFile() ); + } + SettingsBuildingResult result = builder.build( req ); + return new SettingsBuilderResult() + { + @Override + public Settings getEffectiveSettings() + { + return result.getEffectiveSettings().getDelegate(); + } + + @Override + public List getProblems() + { + return new MappedList<>( result.getProblems(), MappedBuilderProblem::new ); + } + }; + } + catch ( SettingsBuildingException e ) + { + throw new SettingsBuilderException( "Unable to build settings", e ); + } + } + + private Properties toProperties( Map map ) + { + Properties properties = new Properties(); + properties.putAll( map ); + return properties; + } + + private static class MappedSettingsSource implements SettingsSource + { + private final Source source; + + MappedSettingsSource( Source source ) + { + this.source = source; + } + + @Override + public InputStream getInputStream() throws IOException + { + return source.getInputStream(); + } + + @Override + public String getLocation() + { + return source.getLocation(); + } + } + + private static class MappedBuilderProblem implements BuilderProblem + { + private final SettingsProblem problem; + + MappedBuilderProblem( SettingsProblem problem ) + { + this.problem = problem; + } + + @Override + public String getSource() + { + return problem.getSource(); + } + + @Override + public int getLineNumber() + { + return problem.getLineNumber(); + } + + @Override + public int getColumnNumber() + { + return problem.getColumnNumber(); + } + + @Override + public String getLocation() + { + return problem.getLocation(); + } + + @Override + public Exception getException() + { + return problem.getException(); + } + + @Override + public String getMessage() + { + return problem.getMessage(); + } + + @Override + public BuilderProblemSeverity getSeverity() + { + return BuilderProblemSeverity.valueOf( problem.getSeverity().name() ); + } + } +} diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java new file mode 100644 index 000000000000..76bc9b972be7 --- /dev/null +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java @@ -0,0 +1,188 @@ +package org.apache.maven.internal.impl; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.maven.api.annotations.Nonnull; +import org.apache.maven.api.services.BuilderProblem; +import org.apache.maven.api.services.BuilderProblemSeverity; +import org.apache.maven.api.services.ToolchainsBuilder; +import org.apache.maven.api.services.ToolchainsBuilderException; +import org.apache.maven.api.services.ToolchainsBuilderRequest; +import org.apache.maven.api.services.ToolchainsBuilderResult; +import org.apache.maven.api.services.Source; +import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest; +import org.apache.maven.toolchain.building.ToolchainsBuildingException; +import org.apache.maven.toolchain.building.ToolchainsBuildingResult; +import org.apache.maven.api.toolchain.PersistedToolchains; + +@Named +@Singleton +public class DefaultToolchainsBuilder implements ToolchainsBuilder +{ + + private final org.apache.maven.toolchain.building.ToolchainsBuilder builder; + + @Inject + public DefaultToolchainsBuilder( org.apache.maven.toolchain.building.ToolchainsBuilder builder ) + { + this.builder = builder; + } + + @Nonnull + @Override + public ToolchainsBuilderResult build( ToolchainsBuilderRequest request ) + throws ToolchainsBuilderException, IllegalArgumentException + { + DefaultSession session = ( DefaultSession ) request.getSession(); + try + { + DefaultToolchainsBuildingRequest req = new DefaultToolchainsBuildingRequest(); + if ( request.getGlobalToolchainsSource().isPresent() ) + { + req.setGlobalToolchainsSource( + new MappedToolchainsSource( request.getGlobalToolchainsSource().get() ) ); + } + else if ( request.getGlobalToolchainsPath().isPresent() ) + { + req.setGlobalToolchainsSource( new org.apache.maven.building.FileSource( + request.getGlobalToolchainsPath().get().toFile() ) ); + } + if ( request.getUserToolchainsSource().isPresent() ) + { + req.setUserToolchainsSource( new MappedToolchainsSource( request.getUserToolchainsSource().get() ) ); + } + else if ( request.getUserToolchainsPath().isPresent() ) + { + req.setUserToolchainsSource( new org.apache.maven.building.FileSource( + request.getUserToolchainsPath().get().toFile() ) ); + } + ToolchainsBuildingResult result = builder.build( req ); + return new ToolchainsBuilderResult() + { + @Override + public PersistedToolchains getEffectiveToolchains() + { + return result.getEffectiveToolchains().getDelegate(); + } + + @Override + public List getProblems() + { + return new MappedList<>( result.getProblems(), MappedBuilderProblem::new ); + } + }; + } + catch ( ToolchainsBuildingException e ) + { + throw new ToolchainsBuilderException( "Unable to build Toolchains", e ); + } + } + + private Properties toProperties( Map map ) + { + Properties properties = new Properties(); + properties.putAll( map ); + return properties; + } + + private static class MappedToolchainsSource implements org.apache.maven.building.Source + { + private final Source source; + + MappedToolchainsSource( Source source ) + { + this.source = source; + } + + @Override + public InputStream getInputStream() throws IOException + { + return source.getInputStream(); + } + + @Override + public String getLocation() + { + return source.getLocation(); + } + } + + private static class MappedBuilderProblem implements BuilderProblem + { + private final org.apache.maven.building.Problem problem; + + MappedBuilderProblem( org.apache.maven.building.Problem problem ) + { + this.problem = problem; + } + + @Override + public String getSource() + { + return problem.getSource(); + } + + @Override + public int getLineNumber() + { + return problem.getLineNumber(); + } + + @Override + public int getColumnNumber() + { + return problem.getColumnNumber(); + } + + @Override + public String getLocation() + { + return problem.getLocation(); + } + + @Override + public Exception getException() + { + return problem.getException(); + } + + @Override + public String getMessage() + { + return problem.getMessage(); + } + + @Override + public BuilderProblemSeverity getSeverity() + { + return BuilderProblemSeverity.valueOf( problem.getSeverity().name() ); + } + } +} diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java index 68491936347d..cb560462e4b0 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java @@ -371,9 +371,9 @@ private void finalizeMojoConfiguration( MojoExecution mojoExecution ) mojoExecution.setConfiguration( finalConfiguration ); } - private Xpp3Dom getMojoConfiguration( MojoDescriptor mojoDescriptor ) + private Dom getMojoConfiguration( MojoDescriptor mojoDescriptor ) { - return MojoDescriptorCreator.convert( mojoDescriptor ); + return MojoDescriptorCreator.convert( mojoDescriptor ).getDom(); } @Override 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 04a247ae03fc..65b1cb8b6fcd 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 @@ -102,7 +102,7 @@ private Plugin findPlugin( String groupId, String artifactId, Collection return null; } - public static Xpp3Dom convert( MojoDescriptor mojoDescriptor ) + public static org.codehaus.plexus.util.xml.Xpp3Dom convert( MojoDescriptor mojoDescriptor ) { PlexusConfiguration c = mojoDescriptor.getMojoConfiguration(); @@ -125,7 +125,7 @@ public static Xpp3Dom convert( MojoDescriptor mojoDescriptor ) } Xpp3Dom dom = new Xpp3Dom( "configuration", null, null, children, null ); - return dom; + return new org.codehaus.plexus.util.xml.Xpp3Dom( dom ); } // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId 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 151b2e5fd6bf..2f2c4075e70c 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 @@ -26,7 +26,6 @@ import javax.inject.Named; import javax.inject.Singleton; -import org.apache.maven.api.settings.Settings; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.properties.internal.SystemProperties; import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; diff --git a/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java b/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java index 45bcbc368261..c79a843d91a6 100644 --- a/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; -import org.apache.maven.api.settings.Settings; import org.apache.maven.execution.MavenExecutionRequest; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java index e8327783df46..f33f208f81fa 100644 --- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java +++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java @@ -172,7 +172,7 @@ protected MavenSession createMavenSession( File pom, Properties executionPropert session.setAllProjects( session.getProjects() ); session.setSession( new DefaultSession( session, new DefaultRepositorySystem(), null, null, null, null, null, null, - null, new DefaultArtifactHandlerManager( Collections.emptyMap() ) ) ); + null, new DefaultArtifactHandlerManager( Collections.emptyMap() ), null, null ) ); return session; } diff --git a/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java b/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java index f707b543943e..6eb6235582a3 100644 --- a/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java +++ b/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java @@ -39,7 +39,9 @@ import org.apache.maven.execution.scope.internal.MojoExecutionScope; import org.apache.maven.repository.internal.MavenRepositorySystemUtils; import org.apache.maven.rtinfo.RuntimeInformation; +import org.apache.maven.settings.building.SettingsBuilder; import org.apache.maven.toolchain.DefaultToolchainManagerPrivate; +import org.apache.maven.toolchain.building.ToolchainsBuilder; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.testing.PlexusTest; import org.eclipse.aether.RepositorySystem; @@ -84,6 +86,12 @@ public class TestApi @Inject ArtifactHandlerManager artifactHandlerManager; + @Inject + SettingsBuilder settingsBuilder; + + @Inject + ToolchainsBuilder toolchainsBuilder; + @BeforeEach void setup() { @@ -94,7 +102,7 @@ void setup() Collections.emptyList(), projectBuilder, mavenRepositorySystem, toolchainManagerPrivate, plexusContainer, mojoExecutionScope, runtimeInformation, - artifactHandlerManager ); + artifactHandlerManager, settingsBuilder, toolchainsBuilder ); DefaultLocalRepository localRepository = new DefaultLocalRepository( new LocalRepository( "target/test-classes/apiv4-repo" ) ); org.apache.maven.api.RemoteRepository remoteRepository = session.getRemoteRepository( diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java index 2841887f90f5..b9720370ca4a 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java @@ -291,7 +291,7 @@ public void testPluginConfigurationCreation() MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( "org.apache.maven.its.plugins:maven-it-plugin:0.1:java", session, session.getCurrentProject() ); - Dom dom = MojoDescriptorCreator.convert( mojoDescriptor ); + Dom dom = MojoDescriptorCreator.convert( mojoDescriptor ).getDom(); System.out.println( dom ); } 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 10cca57da712..6c17028be6a6 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 @@ -73,7 +73,6 @@ import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest; import org.apache.maven.toolchain.building.ToolchainsBuilder; import org.apache.maven.toolchain.building.ToolchainsBuildingResult; -import org.apache.maven.toolchain.model.PersistedToolchains; import org.codehaus.plexus.ContainerConfiguration; import org.codehaus.plexus.DefaultContainerConfiguration; import org.codehaus.plexus.DefaultPlexusContainer; @@ -1335,7 +1334,7 @@ void toolchains( CliRequest cliRequest ) eventSpyDispatcher.onEvent( toolchainsResult ); executionRequestPopulator.populateFromToolchains( cliRequest.request, - new PersistedToolchains( toolchainsResult.getEffectiveToolchains() ) ); + toolchainsResult.getEffectiveToolchains() ); if ( !toolchainsResult.getProblems().isEmpty() && slf4jLogger.isWarnEnabled() ) { diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java b/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java index 5bdc8895b41a..eeb152751c63 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java @@ -35,11 +35,12 @@ import org.apache.maven.cli.CliRequest; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequestPopulationException; -import org.apache.maven.api.settings.Mirror; -import org.apache.maven.api.settings.Proxy; -import org.apache.maven.api.settings.Repository; -import org.apache.maven.api.settings.Server; -import org.apache.maven.api.settings.Settings; +import org.apache.maven.settings.Mirror; +import org.apache.maven.settings.Profile; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Repository; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; import org.apache.maven.settings.SettingsUtils; import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; import org.apache.maven.settings.building.SettingsBuilder; @@ -188,7 +189,7 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques for ( Server server : settings.getServers() ) { - request.addServer( new org.apache.maven.settings.Server( server ) ); + request.addServer( server ); } // @@ -210,7 +211,7 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques continue; } - request.addProxy( new org.apache.maven.settings.Proxy( proxy ) ); + request.addProxy( proxy ); } // @@ -223,14 +224,14 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques for ( Mirror mirror : settings.getMirrors() ) { - request.addMirror( new org.apache.maven.settings.Mirror( mirror ) ); + request.addMirror( mirror ); } request.setActiveProfiles( settings.getActiveProfiles() ); - for ( org.apache.maven.api.settings.Profile rawProfile : settings.getProfiles() ) + for ( Profile rawProfile : settings.getProfiles() ) { - request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) ); + request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile.getDelegate() ) ); if ( settings.getActiveProfiles().contains( rawProfile.getId() ) ) { @@ -239,8 +240,8 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques { try { - request.addRemoteRepository( MavenRepositorySystem.buildArtifactRepository( - new org.apache.maven.settings.Repository( remoteRepository ) ) ); + request.addRemoteRepository( + MavenRepositorySystem.buildArtifactRepository( remoteRepository ) ); } catch ( InvalidRepositoryException e ) { @@ -254,7 +255,7 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques try { request.addPluginArtifactRepository( MavenRepositorySystem.buildArtifactRepository( - new org.apache.maven.settings.Repository( pluginRepository ) ) ); + pluginRepository ) ); } catch ( InvalidRepositoryException e ) { diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java index 183d4f77b878..6a45b3c4e4bc 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java @@ -34,7 +34,7 @@ import org.apache.maven.building.FileSource; import org.apache.maven.building.Source; import org.apache.maven.api.settings.Settings; -import org.apache.maven.api.settings.TrackableBase; +import org.apache.maven.settings.TrackableBase; import org.apache.maven.settings.io.SettingsParseException; import org.apache.maven.settings.io.SettingsReader; import org.apache.maven.settings.io.SettingsWriter; @@ -128,7 +128,8 @@ public SettingsBuildingResult build( SettingsBuildingRequest request ) throw new SettingsBuildingException( problems.getProblems() ); } - return new DefaultSettingsBuildingResult( userSettings, problems.getProblems() ); + return new DefaultSettingsBuildingResult( new org.apache.maven.settings.Settings( userSettings ), + problems.getProblems() ); } private boolean hasErrors( List problems ) diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java index 4dc59d7e275f..48456e5d6527 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; -import org.apache.maven.api.settings.Settings; +import org.apache.maven.settings.Settings; /** * Collects the output of the settings builder. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java index d2c2c11ebcb2..43b2359fac08 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java @@ -21,7 +21,7 @@ import java.util.List; -import org.apache.maven.api.settings.Settings; +import org.apache.maven.settings.Settings; /** * Collects the output of the settings builder. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java index bd0e21b80f7b..80c8e87fb084 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java @@ -26,8 +26,8 @@ import javax.inject.Named; import javax.inject.Singleton; -import org.apache.maven.api.settings.Proxy; -import org.apache.maven.api.settings.Server; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; import org.apache.maven.settings.building.DefaultSettingsProblem; import org.apache.maven.settings.building.SettingsProblem; import org.apache.maven.settings.building.SettingsProblem.Severity; @@ -63,7 +63,7 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) { try { - server = server.withPassword( decrypt( server.getPassword() ) ); + server.setPassword( decrypt( server.getPassword() ) ); } catch ( SecDispatcherException e ) { @@ -73,7 +73,7 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) try { - server = server.withPassphrase( decrypt( server.getPassphrase() ) ); + server.setPassphrase( decrypt( server.getPassphrase() ) ); } catch ( SecDispatcherException e ) { @@ -90,7 +90,7 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) { try { - proxy = proxy.withPassword( decrypt( proxy.getPassword() ) ); + proxy.setPassword( decrypt( proxy.getPassword() ) ); } catch ( SecDispatcherException e ) { diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java index 4281a6c8c8e4..9cb49ac40da2 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java @@ -23,9 +23,9 @@ import java.util.Arrays; import java.util.List; -import org.apache.maven.api.settings.Proxy; -import org.apache.maven.api.settings.Server; -import org.apache.maven.api.settings.Settings; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; /** * Collects parameters that control the decryption of settings. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java index d52f126960cc..ccdad196db25 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.maven.api.settings.Proxy; -import org.apache.maven.api.settings.Server; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; import org.apache.maven.settings.building.SettingsProblem; /** diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java index 33c61a6aef87..b344a99ed928 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.maven.api.settings.Proxy; -import org.apache.maven.api.settings.Server; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; /** * Collects parameters that control the decryption of settings. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java index a8d88b65b980..5b7b1f4b5a31 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.maven.api.settings.Proxy; -import org.apache.maven.api.settings.Server; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; import org.apache.maven.settings.building.SettingsProblem; /** diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java index 78d76f6afe83..ad82e753db1d 100644 --- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java +++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java @@ -88,8 +88,8 @@ public ToolchainsBuildingResult build( ToolchainsBuildingRequest request ) throw new ToolchainsBuildingException( problems.getProblems() ); } - - return new DefaultToolchainsBuildingResult( merged, problems.getProblems() ); + return new DefaultToolchainsBuildingResult( + new org.apache.maven.toolchain.model.PersistedToolchains( merged ), problems.getProblems() ); } private PersistedToolchains interpolate( PersistedToolchains toolchains, ProblemCollector problems ) diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java index c13ee8b65779..2d07a4a03c29 100644 --- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java +++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.maven.building.Problem; -import org.apache.maven.api.toolchain.PersistedToolchains; +import org.apache.maven.toolchain.model.PersistedToolchains; /** * Holds the result of the merged toolchains and holds the problems during this build, if any. diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java index 0d91812148db..f7c5f71554a8 100644 --- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java +++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java @@ -22,7 +22,7 @@ import java.util.List; import org.apache.maven.building.Problem; -import org.apache.maven.api.toolchain.PersistedToolchains; +import org.apache.maven.toolchain.model.PersistedToolchains; /** * Collects the output of the toolchains builder. diff --git a/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java b/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java index 48a1bb579948..ef70b3420eca 100644 --- a/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java +++ b/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java @@ -39,7 +39,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import java.util.Properties; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -240,7 +239,8 @@ public void testEnvironmentVariablesAreInterpolated() ToolchainsBuildingResult result = toolchainBuilder.build( request ); String interpolatedValue = "testValue"; assertEquals(interpolatedValue, result.getEffectiveToolchains().getToolchains().get(0).getProvides().get( "key" ) ); - Xpp3Dom toolchainConfiguration = (Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration(); + org.codehaus.plexus.util.xml.Xpp3Dom toolchainConfiguration = + (org.codehaus.plexus.util.xml.Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration(); assertEquals(interpolatedValue, toolchainConfiguration.getChild("jdkHome").getValue()); assertNotNull( result.getProblems() ); assertEquals( 0, result.getProblems().size() ); From b463ccbb416c9732b28919d0575de595eec50b16 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Sun, 9 Oct 2022 23:07:04 +0200 Subject: [PATCH 02/11] Fix IT --- .../apache/maven/settings/crypto/DefaultSettingsDecrypter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java index 80c8e87fb084..bd4c5fa1536c 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java @@ -61,6 +61,8 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) for ( Server server : request.getServers() ) { + server = server.clone(); + try { server.setPassword( decrypt( server.getPassword() ) ); From 714a9dba3997eeef46ec0587aa12a3501438ebf7 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 08:52:04 +0200 Subject: [PATCH 03/11] Revert changes not related to the api modifications --- .../artifact/manager/DefaultWagonManager.java | 8 +++--- .../legacy/LegacyRepositorySystem.java | 8 +++--- ...DefaultRepositorySystemSessionFactory.java | 8 +++--- .../internal/impl/DefaultSettingsBuilder.java | 2 +- .../impl/DefaultToolchainsBuilder.java | 2 +- ...faultLifecycleExecutionPlanCalculator.java | 4 +-- .../internal/MojoDescriptorCreator.java | 4 +-- .../settings/DefaultMavenSettingsBuilder.java | 1 + .../maven/settings/MavenSettingsBuilder.java | 1 + .../apache/maven/internal/impl/TestApi.java | 1 - .../lifecycle/LifecycleExecutorTest.java | 2 +- .../java/org/apache/maven/cli/MavenCli.java | 3 ++- .../SettingsXmlConfigurationProcessor.java | 27 +++++++++---------- .../building/DefaultSettingsBuilder.java | 5 ++-- .../DefaultSettingsBuildingResult.java | 2 +- .../building/SettingsBuildingResult.java | 2 +- .../crypto/DefaultSettingsDecrypter.java | 12 ++++----- .../DefaultSettingsDecryptionRequest.java | 6 ++--- .../DefaultSettingsDecryptionResult.java | 4 +-- .../crypto/SettingsDecryptionRequest.java | 4 +-- .../crypto/SettingsDecryptionResult.java | 4 +-- .../building/DefaultToolchainsBuilder.java | 4 +-- .../DefaultToolchainsBuildingResult.java | 2 +- .../building/ToolchainsBuildingResult.java | 2 +- .../DefaultToolchainsBuilderTest.java | 4 +-- 25 files changed, 60 insertions(+), 62 deletions(-) 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 2724b1f55c2c..2bfefbec4c0a 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 @@ -86,8 +86,8 @@ public AuthenticationInfo getAuthenticationInfo( String id ) if ( id.equalsIgnoreCase( server.getId() ) ) { SettingsDecryptionResult result = settingsDecrypter.decrypt( - new DefaultSettingsDecryptionRequest( server ) ); - server = result.getServer(); + new DefaultSettingsDecryptionRequest( server.getDelegate() ) ); + server = new Server( result.getServer() ); AuthenticationInfo authInfo = new AuthenticationInfo(); authInfo.setUserName( server.getUsername() ); @@ -125,8 +125,8 @@ public ProxyInfo getProxy( String protocol ) if ( proxy.isActive() && protocol.equalsIgnoreCase( proxy.getProtocol() ) ) { SettingsDecryptionResult result = settingsDecrypter.decrypt( - new DefaultSettingsDecryptionRequest( proxy ) ); - proxy = result.getProxy(); + new DefaultSettingsDecryptionRequest( proxy.getDelegate() ) ); + proxy = new Proxy( result.getProxy() ); ProxyInfo proxyInfo = new ProxyInfo(); proxyInfo.setHost( proxy.getHost() ); 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 0ace040c2372..bd97b399284d 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 @@ -563,9 +563,9 @@ public void injectAuthentication( List repositories, List repositories, List return null; } - public static org.codehaus.plexus.util.xml.Xpp3Dom convert( MojoDescriptor mojoDescriptor ) + public static Xpp3Dom convert( MojoDescriptor mojoDescriptor ) { PlexusConfiguration c = mojoDescriptor.getMojoConfiguration(); @@ -125,7 +125,7 @@ public static org.codehaus.plexus.util.xml.Xpp3Dom convert( MojoDescriptor mojoD } Xpp3Dom dom = new Xpp3Dom( "configuration", null, null, children, null ); - return new org.codehaus.plexus.util.xml.Xpp3Dom( dom ); + return dom; } // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId 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 2f2c4075e70c..151b2e5fd6bf 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 @@ -26,6 +26,7 @@ import javax.inject.Named; import javax.inject.Singleton; +import org.apache.maven.api.settings.Settings; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.properties.internal.SystemProperties; import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; diff --git a/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java b/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java index c79a843d91a6..45bcbc368261 100644 --- a/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; +import org.apache.maven.api.settings.Settings; import org.apache.maven.execution.MavenExecutionRequest; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; diff --git a/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java b/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java index 3809ac3b1862..b39cc21a8436 100644 --- a/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java +++ b/maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java @@ -41,7 +41,6 @@ import org.apache.maven.rtinfo.RuntimeInformation; import org.apache.maven.session.scope.internal.SessionScope; import org.apache.maven.toolchain.DefaultToolchainManagerPrivate; -import org.apache.maven.toolchain.building.ToolchainsBuilder; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.testing.PlexusTest; import org.eclipse.aether.RepositorySystem; diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java index b9720370ca4a..2841887f90f5 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java @@ -291,7 +291,7 @@ public void testPluginConfigurationCreation() MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( "org.apache.maven.its.plugins:maven-it-plugin:0.1:java", session, session.getCurrentProject() ); - Dom dom = MojoDescriptorCreator.convert( mojoDescriptor ).getDom(); + Dom dom = MojoDescriptorCreator.convert( mojoDescriptor ); System.out.println( dom ); } 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 6c17028be6a6..10cca57da712 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 @@ -73,6 +73,7 @@ import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest; import org.apache.maven.toolchain.building.ToolchainsBuilder; import org.apache.maven.toolchain.building.ToolchainsBuildingResult; +import org.apache.maven.toolchain.model.PersistedToolchains; import org.codehaus.plexus.ContainerConfiguration; import org.codehaus.plexus.DefaultContainerConfiguration; import org.codehaus.plexus.DefaultPlexusContainer; @@ -1334,7 +1335,7 @@ void toolchains( CliRequest cliRequest ) eventSpyDispatcher.onEvent( toolchainsResult ); executionRequestPopulator.populateFromToolchains( cliRequest.request, - toolchainsResult.getEffectiveToolchains() ); + new PersistedToolchains( toolchainsResult.getEffectiveToolchains() ) ); if ( !toolchainsResult.getProblems().isEmpty() && slf4jLogger.isWarnEnabled() ) { diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java b/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java index eeb152751c63..5bdc8895b41a 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java @@ -35,12 +35,11 @@ import org.apache.maven.cli.CliRequest; import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequestPopulationException; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Profile; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Repository; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.Settings; +import org.apache.maven.api.settings.Mirror; +import org.apache.maven.api.settings.Proxy; +import org.apache.maven.api.settings.Repository; +import org.apache.maven.api.settings.Server; +import org.apache.maven.api.settings.Settings; import org.apache.maven.settings.SettingsUtils; import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; import org.apache.maven.settings.building.SettingsBuilder; @@ -189,7 +188,7 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques for ( Server server : settings.getServers() ) { - request.addServer( server ); + request.addServer( new org.apache.maven.settings.Server( server ) ); } // @@ -211,7 +210,7 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques continue; } - request.addProxy( proxy ); + request.addProxy( new org.apache.maven.settings.Proxy( proxy ) ); } // @@ -224,14 +223,14 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques for ( Mirror mirror : settings.getMirrors() ) { - request.addMirror( mirror ); + request.addMirror( new org.apache.maven.settings.Mirror( mirror ) ); } request.setActiveProfiles( settings.getActiveProfiles() ); - for ( Profile rawProfile : settings.getProfiles() ) + for ( org.apache.maven.api.settings.Profile rawProfile : settings.getProfiles() ) { - request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile.getDelegate() ) ); + request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) ); if ( settings.getActiveProfiles().contains( rawProfile.getId() ) ) { @@ -240,8 +239,8 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques { try { - request.addRemoteRepository( - MavenRepositorySystem.buildArtifactRepository( remoteRepository ) ); + request.addRemoteRepository( MavenRepositorySystem.buildArtifactRepository( + new org.apache.maven.settings.Repository( remoteRepository ) ) ); } catch ( InvalidRepositoryException e ) { @@ -255,7 +254,7 @@ private MavenExecutionRequest populateFromSettings( MavenExecutionRequest reques try { request.addPluginArtifactRepository( MavenRepositorySystem.buildArtifactRepository( - pluginRepository ) ); + new org.apache.maven.settings.Repository( pluginRepository ) ) ); } catch ( InvalidRepositoryException e ) { diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java index 6a45b3c4e4bc..183d4f77b878 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java @@ -34,7 +34,7 @@ import org.apache.maven.building.FileSource; import org.apache.maven.building.Source; import org.apache.maven.api.settings.Settings; -import org.apache.maven.settings.TrackableBase; +import org.apache.maven.api.settings.TrackableBase; import org.apache.maven.settings.io.SettingsParseException; import org.apache.maven.settings.io.SettingsReader; import org.apache.maven.settings.io.SettingsWriter; @@ -128,8 +128,7 @@ public SettingsBuildingResult build( SettingsBuildingRequest request ) throw new SettingsBuildingException( problems.getProblems() ); } - return new DefaultSettingsBuildingResult( new org.apache.maven.settings.Settings( userSettings ), - problems.getProblems() ); + return new DefaultSettingsBuildingResult( userSettings, problems.getProblems() ); } private boolean hasErrors( List problems ) diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java index 48456e5d6527..4dc59d7e275f 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; -import org.apache.maven.settings.Settings; +import org.apache.maven.api.settings.Settings; /** * Collects the output of the settings builder. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java index 43b2359fac08..d2c2c11ebcb2 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java @@ -21,7 +21,7 @@ import java.util.List; -import org.apache.maven.settings.Settings; +import org.apache.maven.api.settings.Settings; /** * Collects the output of the settings builder. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java index bd4c5fa1536c..bd0e21b80f7b 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java @@ -26,8 +26,8 @@ import javax.inject.Named; import javax.inject.Singleton; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; +import org.apache.maven.api.settings.Proxy; +import org.apache.maven.api.settings.Server; import org.apache.maven.settings.building.DefaultSettingsProblem; import org.apache.maven.settings.building.SettingsProblem; import org.apache.maven.settings.building.SettingsProblem.Severity; @@ -61,11 +61,9 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) for ( Server server : request.getServers() ) { - server = server.clone(); - try { - server.setPassword( decrypt( server.getPassword() ) ); + server = server.withPassword( decrypt( server.getPassword() ) ); } catch ( SecDispatcherException e ) { @@ -75,7 +73,7 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) try { - server.setPassphrase( decrypt( server.getPassphrase() ) ); + server = server.withPassphrase( decrypt( server.getPassphrase() ) ); } catch ( SecDispatcherException e ) { @@ -92,7 +90,7 @@ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request ) { try { - proxy.setPassword( decrypt( proxy.getPassword() ) ); + proxy = proxy.withPassword( decrypt( proxy.getPassword() ) ); } catch ( SecDispatcherException e ) { diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java index 9cb49ac40da2..4281a6c8c8e4 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java @@ -23,9 +23,9 @@ import java.util.Arrays; import java.util.List; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.Settings; +import org.apache.maven.api.settings.Proxy; +import org.apache.maven.api.settings.Server; +import org.apache.maven.api.settings.Settings; /** * Collects parameters that control the decryption of settings. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java index ccdad196db25..d52f126960cc 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; +import org.apache.maven.api.settings.Proxy; +import org.apache.maven.api.settings.Server; import org.apache.maven.settings.building.SettingsProblem; /** diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java index b344a99ed928..33c61a6aef87 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; +import org.apache.maven.api.settings.Proxy; +import org.apache.maven.api.settings.Server; /** * Collects parameters that control the decryption of settings. diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java index 5b7b1f4b5a31..a8d88b65b980 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java @@ -21,8 +21,8 @@ import java.util.List; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; +import org.apache.maven.api.settings.Proxy; +import org.apache.maven.api.settings.Server; import org.apache.maven.settings.building.SettingsProblem; /** diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java index ad82e753db1d..78d76f6afe83 100644 --- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java +++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java @@ -88,8 +88,8 @@ public ToolchainsBuildingResult build( ToolchainsBuildingRequest request ) throw new ToolchainsBuildingException( problems.getProblems() ); } - return new DefaultToolchainsBuildingResult( - new org.apache.maven.toolchain.model.PersistedToolchains( merged ), problems.getProblems() ); + + return new DefaultToolchainsBuildingResult( merged, problems.getProblems() ); } private PersistedToolchains interpolate( PersistedToolchains toolchains, ProblemCollector problems ) diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java index 2d07a4a03c29..c13ee8b65779 100644 --- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java +++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.maven.building.Problem; -import org.apache.maven.toolchain.model.PersistedToolchains; +import org.apache.maven.api.toolchain.PersistedToolchains; /** * Holds the result of the merged toolchains and holds the problems during this build, if any. diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java index f7c5f71554a8..0d91812148db 100644 --- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java +++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java @@ -22,7 +22,7 @@ import java.util.List; import org.apache.maven.building.Problem; -import org.apache.maven.toolchain.model.PersistedToolchains; +import org.apache.maven.api.toolchain.PersistedToolchains; /** * Collects the output of the toolchains builder. diff --git a/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java b/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java index ef70b3420eca..48a1bb579948 100644 --- a/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java +++ b/maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java @@ -39,6 +39,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -239,8 +240,7 @@ public void testEnvironmentVariablesAreInterpolated() ToolchainsBuildingResult result = toolchainBuilder.build( request ); String interpolatedValue = "testValue"; assertEquals(interpolatedValue, result.getEffectiveToolchains().getToolchains().get(0).getProvides().get( "key" ) ); - org.codehaus.plexus.util.xml.Xpp3Dom toolchainConfiguration = - (org.codehaus.plexus.util.xml.Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration(); + Xpp3Dom toolchainConfiguration = (Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration(); assertEquals(interpolatedValue, toolchainConfiguration.getChild("jdkHome").getValue()); assertNotNull( result.getProblems() ); assertEquals( 0, result.getProblems().size() ); From 2f71b4707b43819b470ea60d4fb851e741b17296 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 10:45:47 +0200 Subject: [PATCH 04/11] Fix typo "can not" -> "cannot" --- .../apache/maven/api/services/ProjectBuilder.java | 2 +- .../maven/api/services/SettingsBuilderRequest.java | 12 ++++++------ .../maven/api/services/ToolchainsBuilderRequest.java | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java index 016bb311956f..396d8c226c1c 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java @@ -52,7 +52,7 @@ public interface ProjectBuilder extends Service * * @param session The {@link Session}, must not be {@code null}. * @param source The {@link Source}, must not be {@code null}. - * @throws ProjectBuilderException if the project can not be created + * @throws ProjectBuilderException if the project cannot be created * @throws IllegalArgumentException if an argument is {@code null} or invalid * @see #build(ProjectBuilderRequest) */ diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java index 432d7bf5d91d..25d43b66c7fa 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java @@ -80,9 +80,9 @@ static SettingsBuilderRequest build( @Nonnull Session session, @Nonnull Source userSettingsSource ) { return builder() - .session( nonNull( session, "session can not be null" ) ) - .globalSettingsSource( nonNull( globalSettingsSource, "globalSettingsSource can not be null" ) ) - .userSettingsSource( nonNull( userSettingsSource, "userSettingsSource can not be null" ) ) + .session( nonNull( session, "session cannot be null" ) ) + .globalSettingsSource( nonNull( globalSettingsSource, "globalSettingsSource cannot be null" ) ) + .userSettingsSource( nonNull( userSettingsSource, "userSettingsSource cannot be null" ) ) .build(); } @@ -92,9 +92,9 @@ static SettingsBuilderRequest build( @Nonnull Session session, @Nonnull Path userSettingsPath ) { return builder() - .session( nonNull( session, "session can not be null" ) ) - .globalSettingsPath( nonNull( globalSettingsPath, "globalSettingsPath can not be null" ) ) - .userSettingsPath( nonNull( userSettingsPath, "userSettingsPath can not be null" ) ) + .session( nonNull( session, "session cannot be null" ) ) + .globalSettingsPath( nonNull( globalSettingsPath, "globalSettingsPath cannot be null" ) ) + .userSettingsPath( nonNull( userSettingsPath, "userSettingsPath cannot be null" ) ) .build(); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java index cc6f1cb04a13..b6097a82c445 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java @@ -72,9 +72,9 @@ static ToolchainsBuilderRequest build( @Nonnull Session session, @Nonnull Source userToolchainsSource ) { return builder() - .session( nonNull( session, "session can not be null" ) ) - .globalToolchainsSource( nonNull( globalToolchainsSource, "globalToolchainsSource can not be null" ) ) - .userToolchainsSource( nonNull( userToolchainsSource, "userToolchainsSource can not be null" ) ) + .session( nonNull( session, "session cannot be null" ) ) + .globalToolchainsSource( nonNull( globalToolchainsSource, "globalToolchainsSource cannot be null" ) ) + .userToolchainsSource( nonNull( userToolchainsSource, "userToolchainsSource cannot be null" ) ) .build(); } @@ -84,9 +84,9 @@ static ToolchainsBuilderRequest build( @Nonnull Session session, @Nonnull Path userToolchainsPath ) { return builder() - .session( nonNull( session, "session can not be null" ) ) - .globalToolchainsPath( nonNull( globalToolchainsPath, "globalToolchainsPath can not be null" ) ) - .userToolchainsPath( nonNull( userToolchainsPath, "userToolchainsPath can not be null" ) ) + .session( nonNull( session, "session cannot be null" ) ) + .globalToolchainsPath( nonNull( globalToolchainsPath, "globalToolchainsPath cannot be null" ) ) + .userToolchainsPath( nonNull( userToolchainsPath, "userToolchainsPath cannot be null" ) ) .build(); } From d51613c024f2e9936c61f274b31dbbdc3dba2cfb Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 11:13:25 +0200 Subject: [PATCH 05/11] Fix javadoc comments (first letter in lowercase and no dot at the end) --- .../java/org/apache/maven/api/Artifact.java | 15 +++++----- .../apache/maven/api/ArtifactCoordinate.java | 10 +++---- .../java/org/apache/maven/api/Dependency.java | 2 +- .../maven/api/DependencyCoordinate.java | 2 +- .../main/java/org/apache/maven/api/Event.java | 10 +++---- .../main/java/org/apache/maven/api/Node.java | 4 +-- .../java/org/apache/maven/api/Repository.java | 4 +-- .../java/org/apache/maven/api/Session.java | 6 ++-- .../org/apache/maven/api/SessionData.java | 20 ++++++------- .../java/org/apache/maven/api/Toolchain.java | 2 +- .../org/apache/maven/api/VersionRange.java | 4 +-- .../org/apache/maven/api/plugin/Mojo.java | 2 +- .../services/ArtifactDeployerException.java | 2 +- .../maven/api/services/ArtifactInstaller.java | 4 +-- .../services/ArtifactInstallerException.java | 2 +- .../maven/api/services/ArtifactResolver.java | 6 ++-- .../services/ArtifactResolverException.java | 4 +-- .../maven/api/services/BuilderProblem.java | 14 ++++----- .../api/services/DependencyCollector.java | 30 +++++++++---------- .../DependencyCollectorException.java | 4 +-- .../services/DependencyCollectorRequest.java | 24 +++++++-------- .../services/DependencyCollectorResult.java | 4 +-- .../services/DependencyCoordinateFactory.java | 2 +- .../maven/api/services/LookupException.java | 6 ++-- .../maven/api/services/MessageBuilder.java | 2 +- .../maven/api/services/ProjectBuilder.java | 16 +++++----- .../api/services/ProjectBuilderException.java | 4 +-- .../api/services/ProjectBuilderResult.java | 8 ++--- .../maven/api/services/PrompterException.java | 4 +-- .../maven/api/services/SettingsBuilder.java | 14 ++++----- .../services/SettingsBuilderException.java | 4 +-- .../api/services/SettingsBuilderRequest.java | 8 ++--- .../api/services/SettingsBuilderResult.java | 4 +-- .../services/ToolchainManagerException.java | 4 +-- .../maven/api/services/ToolchainsBuilder.java | 6 ++-- .../services/ToolchainsBuilderException.java | 4 +-- .../services/ToolchainsBuilderRequest.java | 8 ++--- .../api/services/ToolchainsBuilderResult.java | 4 +-- .../maven/api/services/VersionParser.java | 12 ++++---- .../api/services/VersionParserException.java | 4 +-- .../api/services/xml/XmlReaderException.java | 4 +-- .../api/services/xml/XmlReaderRequest.java | 2 +- .../api/services/xml/XmlWriterException.java | 4 +-- api/maven-api-model/src/main/mdo/maven.mdo | 2 +- 44 files changed, 151 insertions(+), 150 deletions(-) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java index 5ebbc9783d0e..d222789f7ad3 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java @@ -35,7 +35,8 @@ public interface Artifact /** * Returns a unique identifier for this artifact. - * The identifier is composed of groupId, artifactId, version, classifier, extension + * The identifier is composed of groupId, artifactId, version, classifier, extension. + * * @return the unique identifier */ default String key() @@ -50,7 +51,7 @@ default String key() /** * The groupId of the artifact. * - * @return The groupId. + * @return the groupId */ @Nonnull String getGroupId(); @@ -58,7 +59,7 @@ default String key() /** * The artifactId of the artifact. * - * @return The artifactId. + * @return the artifactId */ @Nonnull String getArtifactId(); @@ -66,7 +67,7 @@ default String key() /** * The version of the artifact. * - * @return The version. + * @return the version */ @Nonnull Version getVersion(); @@ -74,7 +75,7 @@ default String key() /** * The classifier of the artifact. * - * @return The classifier or an empty string if none, never {@code null}. + * @return the classifier or an empty string if none, never {@code null} */ @Nonnull String getClassifier(); @@ -82,7 +83,7 @@ default String key() /** * The file extension of the artifact. * - * @return The extension. + * @return the extension */ @Nonnull String getExtension(); @@ -90,7 +91,7 @@ default String key() /** * Determines whether this artifact uses a snapshot version. * - * @return {@code true} if the artifact is a snapshot, {@code false} otherwise. + * @return {@code true} if the artifact is a snapshot, {@code false} otherwise * @see org.apache.maven.api.Session#isVersionSnapshot(String) */ boolean isSnapshot(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java index 1f11e321986f..3e66594dfad5 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java @@ -37,7 +37,7 @@ public interface ArtifactCoordinate /** * The groupId of the artifact. * - * @return The groupId. + * @return the groupId */ @Nonnull String getGroupId(); @@ -45,7 +45,7 @@ public interface ArtifactCoordinate /** * The artifactId of the artifact. * - * @return The artifactId. + * @return the artifactId */ @Nonnull String getArtifactId(); @@ -53,7 +53,7 @@ public interface ArtifactCoordinate /** * The classifier of the artifact. * - * @return The classifier or an empty string if none, never {@code null}. + * @return the classifier or an empty string if none, never {@code null} */ @Nonnull String getClassifier(); @@ -61,7 +61,7 @@ public interface ArtifactCoordinate /** * The version of the artifact. * - * @return The version. + * @return the version */ @Nonnull VersionRange getVersion(); @@ -69,7 +69,7 @@ public interface ArtifactCoordinate /** * The extension of the artifact. * - * @return The extension or an empty string if none, never {@code null}. + * @return the extension or an empty string if none, never {@code null} */ @Nonnull String getExtension(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java index 51fa632efcc8..ada37ed5315d 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java @@ -27,7 +27,7 @@ public interface Dependency extends Artifact /** * The artifact type. * - * @return The artifact type, never {@code null}. + * @return the artifact type, never {@code null} */ @Nonnull Type getType(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java index e5ea7a4cb6c2..675a00f0d374 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java @@ -37,7 +37,7 @@ public interface DependencyCoordinate extends ArtifactCoordinate /** * The type of the artifact. * - * @return The type. + * @return the type */ @Nonnull Type getType(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java index 0a30dba8fd51..4d23939a7c6b 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java @@ -38,7 +38,7 @@ public interface Event /** * Gets the type of the event. * - * @return The type of the event, never {@code null}. + * @return the type of the event, never {@code null} */ @Nonnull EventType getType(); @@ -46,7 +46,7 @@ public interface Event /** * Gets the session from which this event originates. * - * @return The current session, never {@code null}. + * @return the current session, never {@code null} */ @Nonnull Session getSession(); @@ -54,7 +54,7 @@ public interface Event /** * Gets the current project (if any). * - * @return The current project or {@code empty()} if not applicable. + * @return the current project or {@code empty()} if not applicable */ @Nonnull Optional getProject(); @@ -62,7 +62,7 @@ public interface Event /** * Gets the current mojo execution (if any). * - * @return The current mojo execution or {@code empty()} if not applicable. + * @return the current mojo execution or {@code empty()} if not applicable */ @Nonnull Optional getMojoExecution(); @@ -70,7 +70,7 @@ public interface Event /** * Gets the exception that caused the event (if any). * - * @return The exception or {@code empty()} if none. + * @return the exception or {@code empty()} if none */ Optional getException(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java index f0bb78b17353..2dbdd13b7c97 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java @@ -67,8 +67,8 @@ public interface Node /** * Traverses this node and potentially its children using the specified visitor. * - * @param visitor The visitor to call back, must not be {@code null}. - * @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings. + * @param visitor the visitor to call back, must not be {@code null} + * @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings */ boolean accept( @Nonnull NodeVisitor visitor ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java index 10551d737c5d..896943d197a1 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java @@ -38,7 +38,7 @@ public interface Repository /** * Gets the identifier of this repository. * - * @return The (case-sensitive) identifier, never {@code null}. + * @return the (case-sensitive) identifier, never {@code null} */ @Nonnull String getId(); @@ -46,7 +46,7 @@ public interface Repository /** * Gets the type of the repository, for example "default". * - * @return The (case-sensitive) type of the repository, never {@code null}. + * @return the (case-sensitive) type of the repository, never {@code null} */ @Nonnull String getType(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java index a8216fa54102..ae9553925981 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java @@ -60,7 +60,7 @@ public interface Session * Gets the user properties to use for interpolation. 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}. + * @return the user properties, never {@code null} */ @Nonnull Map getUserProperties(); @@ -69,14 +69,14 @@ public interface Session * Gets the system properties to use for interpolation. The system properties are collected from the runtime * environment like {@link System#getProperties()} and environment variables. * - * @return The system properties, never {@code null}. + * @return the system properties, never {@code null} */ @Nonnull Map getSystemProperties(); /** * Returns the current maven version - * @return the maven version, never {@code null}. + * @return the maven version, never {@code null} */ @Nonnull String getMavenVersion(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java index 8a8ef19401f0..ad3761376faf 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java @@ -47,8 +47,8 @@ public interface SessionData /** * Associates the specified session data with the given key. * - * @param key The key under which to store the session data, must not be {@code null}. - * @param value The data to associate with the key, may be {@code null} to remove the mapping. + * @param key the key under which to store the session data, must not be {@code null} + * @param value the data to associate with the key, may be {@code null} to remove the mapping */ void set( @Nonnull Object key, @Nullable Object value ); @@ -56,9 +56,9 @@ public interface SessionData * Associates the specified session data with the given key if the key is currently mapped to the given value. This * method provides an atomic compare-and-update of some key's value. * - * @param key The key under which to store the session data, must not be {@code null}. - * @param oldValue The expected data currently associated with the key, may be {@code null}. - * @param newValue The data to associate with the key, may be {@code null} to remove the mapping. + * @param key the key under which to store the session data, must not be {@code null} + * @param oldValue the expected data currently associated with the key, may be {@code null} + * @param newValue the data to associate with the key, may be {@code null} to remove the mapping * @return {@code true} if the key mapping was successfully updated from the old value to the new value, * {@code false} if the current key mapping didn't match the expected value and was not updated. */ @@ -67,8 +67,8 @@ public interface SessionData /** * Gets the session data associated with the specified key. * - * @param key The key for which to retrieve the session data, must not be {@code null}. - * @return The session data associated with the key or {@code null} if none. + * @param key the key for which to retrieve the session data, must not be {@code null} + * @return the session data associated with the key or {@code null} if none */ @Nullable Object get( @Nonnull Object key ); @@ -76,9 +76,9 @@ public interface SessionData /** * Retrieve of compute the data associated with the specified key. * - * @param key The key for which to retrieve the session data, must not be {@code null}. - * @param supplier The supplier will compute the new value. - * @return The session data associated with the key. + * @param key the key for which to retrieve the session data, must not be {@code null} + * @param supplier the supplier will compute the new value + * @return the session data associated with the key */ @Nullable Object computeIfAbsent( @Nonnull Object key, @Nonnull Supplier supplier ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java index 1d013ff19354..3bc15e48f650 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java @@ -41,7 +41,7 @@ public interface Toolchain /** * Gets the platform tool executable. * - * @param toolName the tool platform independent tool name. + * @param toolName the tool platform independent tool name * @return file representing the tool executable, or null if the tool cannot be found */ String findTool( String toolName ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java index fb3e39b2f630..83117b6813b3 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java @@ -36,8 +36,8 @@ public interface VersionRange /** * Determines whether the specified version is contained within this range. * - * @param version The version to test, must not be {@code null}. - * @return {@code true} if this range contains the specified version, {@code false} otherwise. + * @param version the version to test, must not be {@code null} + * @return {@code true} if this range contains the specified version, {@code false} otherwise */ boolean contains( @Nonnull Version version ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java index a6217bff2a96..384616d2ab53 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java @@ -39,7 +39,7 @@ public interface Mojo * This is the main trigger for the Mojo inside the Maven system, and allows * the Mojo to communicate errors. * - * @throws MojoException if a problem occurs. + * @throws MojoException if a problem occurs */ void execute(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java index fbb206a53489..9fba9f02628b 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java @@ -37,7 +37,7 @@ public class ArtifactDeployerException private static final long serialVersionUID = 7421964724059077698L; /** - * @param message The message of the error. + * @param message the message of the error * @param e {@link Exception} */ public ArtifactDeployerException( String message, Exception e ) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java index 937af56607f2..35046c6d3f5a 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java @@ -38,8 +38,8 @@ public interface ArtifactInstaller extends Service { /** * @param request {@link ArtifactInstallerRequest} - * @throws ArtifactInstallerException in case of an error. - * @throws IllegalArgumentException in case {@code request} is {@code null}. + * @throws ArtifactInstallerException in case of an error + * @throws IllegalArgumentException in case {@code request} is {@code null} */ void install( ArtifactInstallerRequest request ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java index e6c6dc6abd81..d045a5f82a73 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java @@ -35,7 +35,7 @@ public class ArtifactInstallerException private static final long serialVersionUID = 3652561971360586373L; /** - * @param message The message of the error. + * @param message the message of the error * @param e {@link Exception} */ public ArtifactInstallerException( String message, Exception e ) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java index 99f49d241d2b..b695bb24e8e7 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java @@ -38,9 +38,9 @@ public interface ArtifactResolver extends Service /** * @param request {@link ArtifactResolverRequest} * @return {@link ArtifactResolverResult} - * @throws ArtifactResolverException in case of an error. + * @throws ArtifactResolverException in case of an error * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or - * parameter {@code mavenArtifact} is {@code null} or invalid. + * parameter {@code mavenArtifact} is {@code null} or invalid */ ArtifactResolverResult resolve( ArtifactResolverRequest request ); @@ -50,7 +50,7 @@ public interface ArtifactResolver extends Service * @return {@link ArtifactResolverResult} * @throws ArtifactResolverException in case of an error. * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or - * parameter {@code coordinate} is {@code null} or invalid. + * parameter {@code coordinate} is {@code null} or invalid */ default ArtifactResolverResult resolve( Session session, Collection coordinates ) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java index ba6e5482cf34..2928c984d90d 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java @@ -34,8 +34,8 @@ public class ArtifactResolverException private static final long serialVersionUID = 7252294837746943917L; /** - * @param message The message for the exception. - * @param e The exception itself. + * @param message the message for the exception + * @param e the exception itself */ public ArtifactResolverException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java index 82f2b53d413b..53f100804b42 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java @@ -41,7 +41,7 @@ public interface BuilderProblem * track the problem back to its origin. A concrete example for such a source hint can be the file path or URL from * which the settings were read. * - * @return The hint about the source of the problem or an empty string if unknown, never {@code null}. + * @return the hint about the source of the problem or an empty string if unknown, never {@code null} */ @Nonnull String getSource(); @@ -50,7 +50,7 @@ public interface BuilderProblem * Gets the one-based index of the line containing the problem. The line number should refer to some text file that * is given by {@link #getSource()}. * - * @return The one-based index of the line containing the problem or a non-positive value if unknown. + * @return the one-based index of the line containing the problem or a non-positive value if unknown */ int getLineNumber(); @@ -58,7 +58,7 @@ public interface BuilderProblem * Gets the one-based index of the column containing the problem. The column number should refer to some text file * that is given by {@link #getSource()}. * - * @return The one-based index of the column containing the problem or non-positive value if unknown. + * @return the one-based index of the column containing the problem or non-positive value if unknown */ int getColumnNumber(); @@ -67,7 +67,7 @@ public interface BuilderProblem * {@link #getSource()}, {@link #getLineNumber()} and {@link #getColumnNumber()}. The exact syntax of the returned * value is undefined. * - * @return The location of the problem, never {@code null}. + * @return the location of the problem, never {@code null} */ @Nonnull String getLocation(); @@ -75,7 +75,7 @@ public interface BuilderProblem /** * Gets the exception that caused this problem (if any). * - * @return The exception that caused this problem or {@code null} if not applicable. + * @return the exception that caused this problem or {@code null} if not applicable */ @Nullable Exception getException(); @@ -83,7 +83,7 @@ public interface BuilderProblem /** * Gets the message that describes this problem. * - * @return The message describing this problem, never {@code null}. + * @return the message describing this problem, never {@code null} */ @Nonnull String getMessage(); @@ -91,7 +91,7 @@ public interface BuilderProblem /** * Gets the severity level of this problem. * - * @return The severity level of this problem, never {@code null}. + * @return the severity level of this problem, never {@code null} */ @Nonnull BuilderProblemSeverity getSeverity(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java index e21b2c46925d..a8a651c38911 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java @@ -45,9 +45,9 @@ public interface DependencyCollector extends Service * Note that this operation is only concerned about determining the coordinates of the * transitive dependencies and does not actually resolve the artifact files. * - * @param request The dependency collection request, must not be {@code null}. - * @return The collection result, never {@code null}. - * @throws DependencyCollectorException If the dependency tree could not be built. + * @param request the dependency collection request, must not be {@code null} + * @return the collection result, never {@code null} + * @throws DependencyCollectorException if the dependency tree could not be built * @throws IllegalArgumentException if an argument is null or invalid * * @see DependencyCollector#collect(Session, Project) @@ -62,10 +62,10 @@ public interface DependencyCollector extends Service * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the * artifact files. * - * @param session The {@link Session}, must not be {@code null}. - * @param root The Maven Dependency, must not be {@code null}. - * @return The collection result, never {@code null}. - * @throws DependencyCollectorException If the dependency tree could not be built. + * @param session the {@link Session}, must not be {@code null} + * @param root the Maven Dependency, must not be {@code null} + * @return the collection result, never {@code null} + * @throws DependencyCollectorException if the dependency tree could not be built * @throws IllegalArgumentException if an argument is null or invalid * @see #collect(DependencyCollectorRequest) */ @@ -81,10 +81,10 @@ default DependencyCollectorResult collect( @Nonnull Session session, * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the * artifact files. * - * @param session The {@link Session}, must not be {@code null}. - * @param project The {@link Project}, must not be {@code null}. - * @return The collection result, never {@code null}. - * @throws DependencyCollectorException If the dependency tree could not be built. + * @param session the {@link Session}, must not be {@code null} + * @param project the {@link Project}, must not be {@code null} + * @return the collection result, never {@code null} + * @throws DependencyCollectorException if the dependency tree could not be built * @throws IllegalArgumentException if an argument is null or invalid * @see #collect(DependencyCollectorRequest) */ @@ -100,10 +100,10 @@ default DependencyCollectorResult collect( @Nonnull Session session, * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the * artifact files. * - * @param session The {@link Session}, must not be {@code null}. - * @param artifact The {@link Artifact}, must not be {@code null}. - * @return The collection result, never {@code null}. - * @throws DependencyCollectorException If the dependency tree could not be built. + * @param session the {@link Session}, must not be {@code null} + * @param artifact the {@link Artifact}, must not be {@code null} + * @return the collection result, never {@code null} + * @throws DependencyCollectorException if the dependency tree could not be built * @throws IllegalArgumentException if an argument is null or invalid * @see #collect(DependencyCollectorRequest) */ diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java index 019fedb6b31b..d173c0f789f3 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java @@ -37,8 +37,8 @@ public class DependencyCollectorException private static final long serialVersionUID = -3134726259840210686L; /** - * @param message The message you would give for the exception. - * @param cause The cause which is related to the message. + * @param message the message you would give for the exception + * @param cause the cause which is related to the message */ public DependencyCollectorException( String message, Throwable cause ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java index 345db90bac5f..f94b1e9a1a13 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java @@ -134,8 +134,8 @@ public DependencyCollectorRequestBuilder session( @Nonnull Session session ) * as a label for the root node of the graph in case no root dependency was specified. As such, the configured * root artifact is ignored if {@link #root(DependencyCoordinate)} has been set. * - * @param rootArtifact The root artifact for the dependency graph, may be {@code null}. - * @return This request for chaining, never {@code null}. + * @param rootArtifact the root artifact for the dependency graph, may be {@code null} + * @return this request for chaining, never {@code null} */ @Nonnull public DependencyCollectorRequestBuilder rootArtifact( @Nullable Artifact rootArtifact ) @@ -146,7 +146,7 @@ public DependencyCollectorRequestBuilder rootArtifact( @Nullable Artifact rootAr /** * @param root The root dependency - * @return This request for chaining, never {@code null}. + * @return this request for chaining, never {@code null} */ @Nonnull public DependencyCollectorRequestBuilder root( @Nonnull DependencyCoordinate root ) @@ -160,8 +160,8 @@ public DependencyCollectorRequestBuilder root( @Nonnull DependencyCoordinate roo * direct dependencies from the request will be merged with the direct dependencies from the root dependency's * artifact descriptor, giving higher priority to the dependencies from the request. * - * @param dependencies The direct dependencies, may be {@code null}. - * @return This request for chaining, never {@code null}. + * @param dependencies the direct dependencies, may be {@code null} + * @return this request for chaining, never {@code null} */ @Nonnull public DependencyCollectorRequestBuilder dependencies( @Nullable List dependencies ) @@ -173,8 +173,8 @@ public DependencyCollectorRequestBuilder dependencies( @Nullable List getExceptions(); /** * Gets the root node of the dependency graph. * - * @return The root node of the dependency graph or {@code null} if none. + * @return the root node of the dependency graph or {@code null} if none */ Node getRoot(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java index d3c7a6ffd7c3..809a418a136d 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java @@ -41,7 +41,7 @@ public interface DependencyCoordinateFactory extends Service * Creates a new {@link DependencyCoordinate} object from the request. * * @param request the request containing the various data - * @return a new {@link DependencyCoordinate} object. + * @return a new {@link DependencyCoordinate} object * * @throws IllegalArgumentException if {@code request} is null or * if {@code request.getSession()} is null or invalid diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java index d88549112e87..abfa15da1716 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java @@ -31,8 +31,8 @@ public class LookupException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public LookupException( String message, Exception e ) { @@ -40,7 +40,7 @@ public LookupException( String message, Exception e ) } /** - * @param e The {@link Exception}. + * @param e the {@link Exception} */ public LookupException( Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java index 1d86911995b6..446d0bc692c1 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java @@ -141,7 +141,7 @@ public interface MessageBuilder * Append formatted content to the buffer. * @see String#format(String, Object...) * @param pattern a format string - * @param args arguments referenced by the format specifiers in the format string. + * @param args arguments referenced by the format specifiers in the format string * @return the current builder */ @Nonnull diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java index 396d8c226c1c..6a453075d8db 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java @@ -50,8 +50,8 @@ public interface ProjectBuilder extends Service /** * Creates a {@link org.apache.maven.api.Project} from a POM file. * - * @param session The {@link Session}, must not be {@code null}. - * @param source The {@link Source}, must not be {@code null}. + * @param session the {@link Session}, must not be {@code null} + * @param source the {@link Source}, must not be {@code null} * @throws ProjectBuilderException if the project cannot be created * @throws IllegalArgumentException if an argument is {@code null} or invalid * @see #build(ProjectBuilderRequest) @@ -65,8 +65,8 @@ default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Source so /** * Creates a {@link org.apache.maven.api.Project} from a POM file. * - * @param session The {@link Session}, must not be {@code null}. - * @param path The {@link Path}, must not be {@code null}. + * @param session the {@link Session}, must not be {@code null} + * @param path the {@link Path}, must not be {@code null} * @throws ProjectBuilderException if the project cannot be created * @throws IllegalArgumentException if an argument is {@code null} or invalid * @see #build(ProjectBuilderRequest) @@ -80,8 +80,8 @@ default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Path path /** * Creates a {@link org.apache.maven.api.Project} from an artifact. * - * @param session The {@link Session}, must not be {@code null}. - * @param artifact The {@link Artifact}, must not be {@code null}. + * @param session the {@link Session}, must not be {@code null} + * @param artifact the {@link Artifact}, must not be {@code null} * @throws ProjectBuilderException if the project cannot be created * @throws IllegalArgumentException if an argument is {@code null} or invalid * @see #build(ProjectBuilderRequest) @@ -95,8 +95,8 @@ default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Artifact /** * Creates a {@link org.apache.maven.api.Project} from a coordinate. * - * @param session The {@link Session}, must not be {@code null}. - * @param coordinate The {@link ArtifactCoordinate}, must not be {@code null}. + * @param session the {@link Session}, must not be {@code null} + * @param coordinate the {@link ArtifactCoordinate}, must not be {@code null} * @throws ProjectBuilderException if the project cannot be created * @throws IllegalArgumentException if an argument is {@code null} or invalid * @see #build(ProjectBuilderRequest) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java index 2256bd144611..918913c0a22e 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java @@ -31,8 +31,8 @@ public class ProjectBuilderException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public ProjectBuilderException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java index 7b8872991cde..0019b66aacda 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java @@ -42,7 +42,7 @@ public interface ProjectBuilderResult * ::} but some of these coordinates may still be unknown at the point the exception * is thrown so this information is merely meant to assist the user. * - * @return The identifier of the project or an empty string if not known, never {@code null}. + * @return the identifier of the project or an empty string if not known, never {@code null} */ @Nonnull String getProjectId(); @@ -50,7 +50,7 @@ public interface ProjectBuilderResult /** * Gets the POM file from which the project was built. * - * @return The optional POM file. + * @return the optional POM file */ @Nonnull Optional getPomFile(); @@ -67,7 +67,7 @@ public interface ProjectBuilderResult /** * Gets the problems that were encountered during the project building. * - * @return The problems that were encountered during the project building, can be empty but never {@code null}. + * @return the problems that were encountered during the project building, can be empty but never {@code null} */ @Nonnull Collection getProblems(); @@ -75,7 +75,7 @@ public interface ProjectBuilderResult /** * Gets the result of the dependency resolution for the project. * - * @return The result of the dependency resolution for the project. + * @return the result of the dependency resolution for the project */ @Nonnull Optional getDependencyResolverResult(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/PrompterException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/PrompterException.java index 4f892c749412..9a0de36c2953 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/PrompterException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/PrompterException.java @@ -31,8 +31,8 @@ public class PrompterException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public PrompterException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java index 553194926a3a..624a74f91125 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilder.java @@ -34,9 +34,9 @@ public interface SettingsBuilder extends Service /** * Builds the effective settings of the specified settings files. * - * @param request The settings building request that holds the parameters, must not be {@code null}. - * @return The result of the settings building, never {@code null}. - * @throws SettingsBuilderException If the effective settings could not be built. + * @param request the settings building request that holds the parameters, must not be {@code null} + * @return the result of the settings building, never {@code null} + * @throws SettingsBuilderException if the effective settings could not be built */ @Nonnull SettingsBuilderResult build( @Nonnull SettingsBuilderRequest request ); @@ -44,8 +44,8 @@ public interface SettingsBuilder extends Service /** * Builds the effective settings of the specified settings sources. * - * @return The result of the settings building, never {@code null}. - * @throws SettingsBuilderException If the effective settings could not be built. + * @return the result of the settings building, never {@code null} + * @throws SettingsBuilderException if the effective settings could not be built */ @Nonnull default SettingsBuilderResult build( @Nonnull Session session, @@ -58,8 +58,8 @@ default SettingsBuilderResult build( @Nonnull Session session, /** * Builds the effective settings of the specified settings paths. * - * @return The result of the settings building, never {@code null}. - * @throws SettingsBuilderException If the effective settings could not be built. + * @return the result of the settings building, never {@code null} + * @throws SettingsBuilderException if the effective settings could not be built */ @Nonnull default SettingsBuilderResult build( @Nonnull Session session, diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java index d71312b88a82..665b9086eb59 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderException.java @@ -31,8 +31,8 @@ public class SettingsBuilderException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public SettingsBuilderException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java index 25d43b66c7fa..0523f4d2320c 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderRequest.java @@ -45,7 +45,7 @@ public interface SettingsBuilderRequest /** * Gets the global settings path. * - * @return The global settings path or {@code null} if none. + * @return the global settings path or {@code null} if none */ @Nonnull Optional getGlobalSettingsPath(); @@ -53,7 +53,7 @@ public interface SettingsBuilderRequest /** * Gets the global settings source. * - * @return The global settings source or {@code null} if none. + * @return the global settings source or {@code null} if none */ @Nonnull Optional getGlobalSettingsSource(); @@ -61,7 +61,7 @@ public interface SettingsBuilderRequest /** * Gets the user settings path. * - * @return The user settings path or {@code null} if none. + * @return the user settings path or {@code null} if none */ @Nonnull Optional getUserSettingsPath(); @@ -69,7 +69,7 @@ public interface SettingsBuilderRequest /** * Gets the user settings source. * - * @return The user settings source or {@code null} if none. + * @return the user settings source or {@code null} if none */ @Nonnull Optional getUserSettingsSource(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java index a10df6a9fbff..a272b75ce9f8 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java @@ -30,7 +30,7 @@ public interface SettingsBuilderResult /** * Gets the assembled settings. * - * @return The assembled settings, never {@code null}. + * @return the assembled settings, never {@code null} */ @Nonnull Settings getEffectiveSettings(); @@ -40,7 +40,7 @@ public interface SettingsBuilderResult * {@link BuilderProblemSeverity#WARNING} and below are reported here. Problems with a higher severity level cause * the settings builder to fail with a {@link SettingsBuilderException}. * - * @return The problems that were encountered during the settings building, can be empty but never {@code null}. + * @return the problems that were encountered during the settings building, can be empty but never {@code null} */ @Nonnull List getProblems(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainManagerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainManagerException.java index 2c8a2bd8fe59..eb543818041c 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainManagerException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainManagerException.java @@ -31,8 +31,8 @@ public class ToolchainManagerException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public ToolchainManagerException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java index 168acccb42ca..5e57291cf26e 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilder.java @@ -33,9 +33,9 @@ public interface ToolchainsBuilder extends Service /** * Builds the effective toolchains of the specified toolchains files. * - * @param request The toolchains building request that holds the parameters, must not be {@code null}. - * @return The result of the toolchains building, never {@code null}. - * @throws ToolchainsBuilderException If the effective toolchains could not be built. + * @param request the toolchains building request that holds the parameters, must not be {@code null} + * @return the result of the toolchains building, never {@code null} + * @throws ToolchainsBuilderException if the effective toolchains could not be built */ ToolchainsBuilderResult build( ToolchainsBuilderRequest request ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java index 2aa96411ac2a..19bd724ed86f 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderException.java @@ -31,8 +31,8 @@ public class ToolchainsBuilderException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public ToolchainsBuilderException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java index b6097a82c445..085950b2ffa9 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderRequest.java @@ -37,7 +37,7 @@ public interface ToolchainsBuilderRequest /** * Gets the global Toolchains path. * - * @return The global Toolchains path or {@code null} if none. + * @return the global Toolchains path or {@code null} if none */ @Nonnull Optional getGlobalToolchainsPath(); @@ -45,7 +45,7 @@ public interface ToolchainsBuilderRequest /** * Gets the global Toolchains source. * - * @return The global Toolchains source or {@code null} if none. + * @return the global Toolchains source or {@code null} if none */ @Nonnull Optional getGlobalToolchainsSource(); @@ -53,7 +53,7 @@ public interface ToolchainsBuilderRequest /** * Gets the user Toolchains path. * - * @return The user Toolchains path or {@code null} if none. + * @return the user Toolchains path or {@code null} if none */ @Nonnull Optional getUserToolchainsPath(); @@ -61,7 +61,7 @@ public interface ToolchainsBuilderRequest /** * Gets the user Toolchains source. * - * @return The user Toolchains source or {@code null} if none. + * @return the user Toolchains source or {@code null} if none */ @Nonnull Optional getUserToolchainsSource(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java index 63e3325de27d..cbdc81f16b28 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java @@ -29,7 +29,7 @@ public interface ToolchainsBuilderResult /** * Gets the assembled toolchains. * - * @return The assembled toolchains, never {@code null}. + * @return the assembled toolchains, never {@code null} */ @Nonnull PersistedToolchains getEffectiveToolchains(); @@ -39,7 +39,7 @@ public interface ToolchainsBuilderResult * {@link BuilderProblemSeverity#WARNING} and below are reported here. Problems with a higher severity level cause * the settings builder to fail with a {@link ToolchainsBuilderException}. * - * @return The problems that were encountered during the settings building, can be empty but never {@code null}. + * @return the problems that were encountered during the settings building, can be empty but never {@code null} */ @Nonnull List getProblems(); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParser.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParser.java index ed5e69ba75c7..700019d715b7 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParser.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParser.java @@ -36,9 +36,9 @@ public interface VersionParser extends Service /** * Parses the specified version string, for example "1.0". * - * @param version The version string to parse, must not be {@code null}. - * @return The parsed version, never {@code null}. - * @throws VersionParserException If the string violates the syntax rules of this scheme. + * @param version the version string to parse, must not be {@code null} + * @return the parsed version, never {@code null} + * @throws VersionParserException if the string violates the syntax rules of this scheme * @see org.apache.maven.api.Session#parseVersion(String) */ @Nonnull @@ -47,9 +47,9 @@ public interface VersionParser extends Service /** * Parses the specified version range specification, for example "[1.0,2.0)". * - * @param range The range specification to parse, must not be {@code null}. - * @return The parsed version range, never {@code null}. - * @throws VersionParserException If the range specification violates the syntax rules of this scheme. + * @param range the range specification to parse, must not be {@code null} + * @return the parsed version range, never {@code null} + * @throws VersionParserException if the range specification violates the syntax rules of this scheme */ @Nonnull VersionRange parseVersionRange( @Nonnull String range ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParserException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParserException.java index f0c4481132e2..ba016dc0f0e1 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParserException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParserException.java @@ -31,8 +31,8 @@ public class VersionParserException extends MavenException { /** - * @param message The message to give. - * @param e The {@link Exception}. + * @param message the message to give + * @param e the {@link Exception} */ public VersionParserException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderException.java index 2cc30c0c26cf..23141db4cc9a 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderException.java @@ -33,8 +33,8 @@ public class XmlReaderException { /** - * @param message The message for the exception. - * @param e The exception itself. + * @param message the message for the exception + * @param e the exception itself */ public XmlReaderException( String message, Exception e ) { diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java index 05e4423039bf..086594d62534 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java @@ -65,7 +65,7 @@ interface Transformer * @param source The source value * @param fieldName A description of the field being interpolated. The implementation may use this to * log stuff. - * @return The interpolated value. + * @return the interpolated value */ String transform( String source, String fieldName ); } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java index 099b6ea12b19..69b7b11486c4 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java @@ -33,8 +33,8 @@ public class XmlWriterException { /** - * @param message The message for the exception. - * @param e The exception itself. + * @param message the message for the exception + * @param e the exception itself */ public XmlWriterException( String message, Exception e ) { diff --git a/api/maven-api-model/src/main/mdo/maven.mdo b/api/maven-api-model/src/main/mdo/maven.mdo index 7bd835d0987b..b6ef13a14125 100644 --- a/api/maven-api-model/src/main/mdo/maven.mdo +++ b/api/maven-api-model/src/main/mdo/maven.mdo @@ -2304,7 +2304,7 @@ /** * Gets the identifier of the plugin. * - * @return The plugin id in the form {@code ::}, never {@code null}. + * @return the plugin id in the form {@code ::}, never {@code null} */ public String getId() { From 537c5f3df1dbb91617dae0d12e446e72959bc394 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 11:13:40 +0200 Subject: [PATCH 06/11] Fix MojoException --- .../org/apache/maven/api/plugin/MojoException.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java index 5e5b0c7eee1c..bd93e606733d 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java @@ -37,7 +37,7 @@ public class MojoException protected String longMessage; /** - * Construct a new MojoExecutionException exception providing the source and a short and long message: + * Construct a new MojoException exception providing the source and a short and long message: * these messages are used to improve the message written at the end of Maven build. */ public MojoException( Object source, String shortMessage, String longMessage ) @@ -47,15 +47,6 @@ public MojoException( Object source, String shortMessage, String longMessage ) this.longMessage = longMessage; } - /** - * Construct a new MojoExecutionException exception wrapping an underlying Exception - * and providing a message. - */ - public MojoException( String message, Exception cause ) - { - super( message, cause ); - } - /** * Construct a new MojoExecutionException exception wrapping an underlying Throwable * and providing a message. @@ -78,7 +69,6 @@ public MojoException( String message ) * * @param cause the cause which is saved for later retrieval by the {@link #getCause()} method. * A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown. - * @since 3.8.3 */ public MojoException( Throwable cause ) { From 505e5e71184314b1fd3b7b9904944c78e4af2e6c Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 11:56:04 +0200 Subject: [PATCH 07/11] Move Severity as in inner enum to BuilderProblem --- .../maven/api/services/BuilderProblem.java | 16 +++++++- .../api/services/BuilderProblemSeverity.java | 37 ------------------- .../api/services/SettingsBuilderResult.java | 2 +- .../api/services/ToolchainsBuilderResult.java | 2 +- .../internal/impl/DefaultProjectBuilder.java | 5 +-- .../internal/impl/DefaultSettingsBuilder.java | 5 +-- .../impl/DefaultToolchainsBuilder.java | 5 +-- 7 files changed, 23 insertions(+), 49 deletions(-) delete mode 100644 api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java index 53f100804b42..d1bcf501b50f 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblem.java @@ -94,6 +94,20 @@ public interface BuilderProblem * @return the severity level of this problem, never {@code null} */ @Nonnull - BuilderProblemSeverity getSeverity(); + Severity getSeverity(); + /** + * The different severity levels for a problem, in decreasing order. + * + * @since 4.0 + */ + @Experimental + enum Severity + { + + FATAL, // + ERROR, // + WARNING // + + } } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java deleted file mode 100644 index 92197417230f..000000000000 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BuilderProblemSeverity.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.maven.api.services; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT 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.api.annotations.Experimental; - -/** - * The different severity levels for a problem, in decreasing order. - * - * @since 4.0 - */ -@Experimental -public enum BuilderProblemSeverity -{ - - FATAL, // - ERROR, // - WARNING // - -} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java index a272b75ce9f8..8cd1fc5757ad 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/SettingsBuilderResult.java @@ -37,7 +37,7 @@ public interface SettingsBuilderResult /** * Gets the problems that were encountered during the settings building. Note that only problems of severity - * {@link BuilderProblemSeverity#WARNING} and below are reported here. Problems with a higher severity level cause + * {@link BuilderProblem.Severity#WARNING} and below are reported here. Problems with a higher severity level cause * the settings builder to fail with a {@link SettingsBuilderException}. * * @return the problems that were encountered during the settings building, can be empty but never {@code null} diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java index cbdc81f16b28..5be2cea19b05 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainsBuilderResult.java @@ -36,7 +36,7 @@ public interface ToolchainsBuilderResult /** * Gets the problems that were encountered during the settings building. Note that only problems of severity - * {@link BuilderProblemSeverity#WARNING} and below are reported here. Problems with a higher severity level cause + * {@link BuilderProblem.Severity#WARNING} and below are reported here. Problems with a higher severity level cause * the settings builder to fail with a {@link ToolchainsBuilderException}. * * @return the problems that were encountered during the settings building, can be empty but never {@code null} diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java index db5fcbd11147..4944df1354b6 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java @@ -41,7 +41,6 @@ import org.apache.maven.api.services.ProjectBuilder; import org.apache.maven.api.services.ProjectBuilderException; import org.apache.maven.api.services.BuilderProblem; -import org.apache.maven.api.services.BuilderProblemSeverity; import org.apache.maven.api.services.ProjectBuilderRequest; import org.apache.maven.api.services.ProjectBuilderResult; import org.apache.maven.api.services.Source; @@ -228,9 +227,9 @@ public String getMessage() } @Override - public BuilderProblemSeverity getSeverity() + public Severity getSeverity() { - return BuilderProblemSeverity.valueOf( problem.getSeverity().name() ); + return Severity.valueOf( problem.getSeverity().name() ); } }; } diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java index 0d781fa6d394..f3f4d14a9023 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java @@ -31,7 +31,6 @@ import org.apache.maven.api.annotations.Nonnull; import org.apache.maven.api.services.BuilderProblem; -import org.apache.maven.api.services.BuilderProblemSeverity; import org.apache.maven.api.services.SettingsBuilder; import org.apache.maven.api.services.SettingsBuilderException; import org.apache.maven.api.services.SettingsBuilderRequest; @@ -181,9 +180,9 @@ public String getMessage() } @Override - public BuilderProblemSeverity getSeverity() + public Severity getSeverity() { - return BuilderProblemSeverity.valueOf( problem.getSeverity().name() ); + return Severity.valueOf( problem.getSeverity().name() ); } } } diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java index 68dd7f1504d6..41b7fdf69d15 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java @@ -31,7 +31,6 @@ import org.apache.maven.api.annotations.Nonnull; import org.apache.maven.api.services.BuilderProblem; -import org.apache.maven.api.services.BuilderProblemSeverity; import org.apache.maven.api.services.ToolchainsBuilder; import org.apache.maven.api.services.ToolchainsBuilderException; import org.apache.maven.api.services.ToolchainsBuilderRequest; @@ -180,9 +179,9 @@ public String getMessage() } @Override - public BuilderProblemSeverity getSeverity() + public Severity getSeverity() { - return BuilderProblemSeverity.valueOf( problem.getSeverity().name() ); + return Severity.valueOf( problem.getSeverity().name() ); } } } From 1127fe4c928b2d2b65467e52c3a32a79d309cd62 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 11:59:36 +0200 Subject: [PATCH 08/11] Fix IT --- .../internal/aether/DefaultRepositorySystemSessionFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java b/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java index 6df309ea995a..d8e187646b49 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java +++ b/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java @@ -235,7 +235,7 @@ public DefaultRepositorySystemSession newRepositorySession( MavenExecutionReques if ( server.getConfiguration() != null ) { - Dom dom = ( ( org.codehaus.plexus.util.xml.Xpp3Dom ) server.getConfiguration() ).getDom(); + Dom dom = server.getConfiguration(); List children = dom.getChildren().stream() .filter( c -> !"wagonProvider".equals( c.getName() ) ) .collect( Collectors.toList() ); From 41a3947527b0832ce330c877e7fc3d47d682e99b Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 12:01:50 +0200 Subject: [PATCH 09/11] Improve javadoc --- .../src/main/java/org/apache/maven/api/Session.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java index ae9553925981..38168906cda5 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java @@ -57,8 +57,8 @@ public interface Session SessionData getData(); /** - * Gets the user properties to use for interpolation. 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. + * Gets the user properties to use for interpolation. The user properties have been configured directly by the user, + * e.g. via the {@code -Dkey=value} parameter on the command line. * * @return the user properties, never {@code null} */ @@ -67,7 +67,7 @@ public interface Session /** * Gets the system properties to use for interpolation. The system properties are collected from the runtime - * environment like {@link System#getProperties()} and environment variables. + * environment such as {@link System#getProperties()} and environment variables. * * @return the system properties, never {@code null} */ From 43d24f3e2907f493854e7065463626571f75fffa Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 12:04:31 +0200 Subject: [PATCH 10/11] Remove double spaces that have been introduced --- api/maven-api-core/src/main/java/org/apache/maven/api/Node.java | 2 +- .../src/main/java/org/apache/maven/api/SessionData.java | 2 +- .../org/apache/maven/api/services/xml/XmlWriterException.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java index 2dbdd13b7c97..d23c8f60e74b 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java @@ -67,7 +67,7 @@ public interface Node /** * Traverses this node and potentially its children using the specified visitor. * - * @param visitor the visitor to call back, must not be {@code null} + * @param visitor the visitor to call back, must not be {@code null} * @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings */ boolean accept( @Nonnull NodeVisitor visitor ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java index ad3761376faf..2df695ec3fba 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java @@ -47,7 +47,7 @@ public interface SessionData /** * Associates the specified session data with the given key. * - * @param key the key under which to store the session data, must not be {@code null} + * @param key the key under which to store the session data, must not be {@code null} * @param value the data to associate with the key, may be {@code null} to remove the mapping */ void set( @Nonnull Object key, @Nullable Object value ); diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java index 69b7b11486c4..4202ab2ef385 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java @@ -33,7 +33,7 @@ public class XmlWriterException { /** - * @param message the message for the exception + * @param message the message for the exception * @param e the exception itself */ public XmlWriterException( String message, Exception e ) From 83a1cdef24e34fa5b594890c0f4b7a252b645a4e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 11 Oct 2022 12:10:20 +0200 Subject: [PATCH 11/11] Add a missing @NonNull annotation --- .../src/main/java/org/apache/maven/api/Dependency.java | 1 + 1 file changed, 1 insertion(+) diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java index ada37ed5315d..0283f41c5d07 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java @@ -32,6 +32,7 @@ public interface Dependency extends Artifact @Nonnull Type getType(); + @Nonnull Scope getScope(); boolean isOptional();