You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2019/01/22 22:44:43 UTC

[maven] branch MNG-5577 updated (b0a0311 -> 39ca59d)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MNG-5577
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard b0a0311  [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder
 discard f603896  [MNG-5577] Migrate to JSR 300 Annotations - maven-settings-builder
 discard 0cbd7d0  [MNG-5577] Migrate to JSR 300 Annotations - maven-artifact
     add 8e5ecf0  fixed link (that goes to implementation in maven-core)
     add 375cd7b  [MNG-6559] Fix mailing list URL (#230)
     add fdf5d92  renamed variables for better understanding
     add 396291b  [MNG-6069] Migrate to non deprecated parts of Commons CLI (#153)
     add 2928dc6  refactoring: extracted initParent() method
     add 049b7a7  refactoring: reduced try/catch scope
     add ae1c32a  [MNG-6533] Test: ProjectBuildingException miss reference to MavenProject
     add 8b7055f  [MNG-6533] Prefer passing the interim project in ProjectBuildingResult
     add 27332cf  [MNG-6533] ProjectBuilder report ModelProblem instead of Exception
     add 24c762d  [MNG-6533] catch InvalidArtifactRTException runtime exception
     new ec4f225  [MNG-5577] Migrate to JSR 300 Annotations - maven-artifact
     new 03c44ef  [MNG-5577] Migrate to JSR 300 Annotations - maven-settings-builder
     new cc19ae7  [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder
     new 39ca59d  [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder - log

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b0a0311)
            \
             N -- N -- N   refs/heads/MNG-5577 (39ca59d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CONTRIBUTING.md                                    |   4 +-
 apache-maven/README.txt                            |   2 +-
 .../plugin/DefaultLifecycleBindingsInjector.java   |  14 +-
 .../maven/project/DefaultProjectBuilder.java       | 344 ++++++++++++---------
 .../apache/maven/project/ProjectBuilderTest.java   |  78 +++++
 .../resources/projects/artifactMissingVersion.xml  |  34 ++
 .../pom.xml => resources/projects/badPom.xml}      |  10 +-
 .../main/java/org/apache/maven/cli/CLIManager.java | 124 +++++---
 .../org/apache/maven/cli/CLIReportingUtils.java    |   2 +-
 .../main/java/org/apache/maven/cli/MavenCli.java   |  85 ++---
 .../SettingsXmlConfigurationProcessor.java         |  20 +-
 .../maven/cli/event/ExecutionEventLogger.java      |  11 +-
 .../impl/UnsupportedSlf4jBindingConfiguration.java |   2 +-
 .../cli/transfer/Slf4jMavenTransferListener.java   |   4 +-
 .../java/org/apache/maven/cli/MavenCliTest.java    |   4 +-
 maven-model-builder/src/site/apt/index.apt         |   4 +-
 pom.xml                                            |  10 -
 17 files changed, 454 insertions(+), 298 deletions(-)
 create mode 100644 maven-core/src/test/resources/projects/artifactMissingVersion.xml
 copy maven-core/src/test/{projects/default-maven/cyclic-reference/pom.xml => resources/projects/badPom.xml} (53%)


[maven] 04/04: [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder - log

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-5577
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 39ca59d8bcce6b1d42ff61b7ab6b8442cd31bfc8
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Mon Jan 21 01:51:18 2019 +0100

    [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder - log
    
    use placeholders for logging
---
 .../org/apache/maven/cli/CLIReportingUtils.java    |  2 +-
 .../main/java/org/apache/maven/cli/MavenCli.java   | 35 +++++++++++-----------
 .../SettingsXmlConfigurationProcessor.java         | 10 +++----
 .../maven/cli/event/ExecutionEventLogger.java      | 11 ++++---
 .../impl/UnsupportedSlf4jBindingConfiguration.java |  2 +-
 .../cli/transfer/Slf4jMavenTransferListener.java   |  4 +--
 6 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
index e1a4c2f..fb78239 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
@@ -146,7 +146,7 @@ public final class CLIReportingUtils
 
                 for ( Throwable cause = e.getCause(); cause != null; cause = cause.getCause() )
                 {
-                    logger.error( "Caused by: " + cause.getMessage() );
+                    logger.error( "Caused by: {}", cause.getMessage() );
                 }
             }
         }
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 4d142ee..68afc60 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
@@ -569,7 +569,7 @@ public class MavenCli
 
         if ( slf4jLogger.isDebugEnabled() )
         {
-            slf4jLogger.debug( "Message scheme: " + ( MessageUtils.isColorEnabled() ? "color" : "plain" ) );
+            slf4jLogger.debug( "Message scheme: {}", ( MessageUtils.isColorEnabled() ? "color" : "plain" ) );
             if ( MessageUtils.isColorEnabled() )
             {
                 MessageBuilder buff = MessageUtils.buffer();
@@ -767,7 +767,7 @@ public class MavenCli
         }
         catch ( Exception e )
         {
-            slf4jLogger.warn( "Failed to read extensions descriptor " + extensionsFile + ": " + e.getMessage() );
+            slf4jLogger.warn( "Failed to read extensions descriptor {}: {}", extensionsFile, e.getMessage() );
         }
         return Collections.emptyList();
     }
@@ -795,11 +795,11 @@ public class MavenCli
 
             extRealm.setParentRealm( coreRealm );
 
-            slf4jLogger.debug( "Populating class realm " + extRealm.getId() );
+            slf4jLogger.debug( "Populating class realm {}", extRealm.getId() );
 
             for ( File file : extClassPath )
             {
-                slf4jLogger.debug( "  Included " + file );
+                slf4jLogger.debug( "  Included {}", file );
 
                 extRealm.addURL( file.toURI().toURL() );
             }
@@ -848,7 +848,7 @@ public class MavenCli
             {
                 File file = resolveFile( new File( jar ), cliRequest.workingDirectory );
 
-                slf4jLogger.debug( "  Included " + file );
+                slf4jLogger.debug( "  Included {}", file );
 
                 jars.add( file );
             }
@@ -983,13 +983,13 @@ public class MavenCli
 
             if ( !cliRequest.showErrors )
             {
-                slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven with the "
-                    + buffer().strong( "-e" ) + " switch." );
+                slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven with the {} switch.",
+                        buffer().strong( "-e" ) );
             }
             if ( !slf4jLogger.isDebugEnabled() )
             {
-                slf4jLogger.error( "Re-run Maven using the " + buffer().strong( "-X" )
-                    + " switch to enable full debug logging." );
+                slf4jLogger.error( "Re-run Maven using the {} switch to enable full debug logging.",
+                        buffer().strong( "-X" ) );
             }
 
             if ( !references.isEmpty() )
@@ -1000,7 +1000,7 @@ public class MavenCli
 
                 for ( Map.Entry<String, String> entry : references.entrySet() )
                 {
-                    slf4jLogger.error( buffer().strong( entry.getValue() ) + " " + entry.getKey() );
+                    slf4jLogger.error( "{} {}", buffer().strong( entry.getValue() ), entry.getKey() );
                 }
             }
 
@@ -1257,11 +1257,10 @@ public class MavenCli
 
         eventSpyDispatcher.onEvent( toolchainsRequest );
 
-        slf4jLogger.debug(
-            "Reading global toolchains from " + getLocation( toolchainsRequest.getGlobalToolchainsSource(),
-                                                             globalToolchainsFile ) );
-        slf4jLogger.debug( "Reading user toolchains from " + getLocation( toolchainsRequest.getUserToolchainsSource(),
-                                                                          userToolchainsFile ) );
+        slf4jLogger.debug("Reading global toolchains from {}",
+                getLocation( toolchainsRequest.getGlobalToolchainsSource(), globalToolchainsFile ) );
+        slf4jLogger.debug( "Reading user toolchains from {}",
+                getLocation( toolchainsRequest.getUserToolchainsSource(), userToolchainsFile ) );
 
         ToolchainsBuildingResult toolchainsResult = toolchainsBuilder.build( toolchainsRequest );
 
@@ -1277,7 +1276,7 @@ public class MavenCli
 
             for ( Problem problem : toolchainsResult.getProblems() )
             {
-                slf4jLogger.warn( problem.getMessage() + " @ " + problem.getLocation() );
+                slf4jLogger.warn( "{} @ {}", problem.getMessage(), problem.getLocation() );
             }
 
             slf4jLogger.warn( "" );
@@ -1311,8 +1310,8 @@ public class MavenCli
         {
             if ( commandLine.hasOption( deprecatedOption ) )
             {
-                slf4jLogger.warn( "Command line option -" + deprecatedOption
-                                      + " is deprecated and will be removed in future Maven versions." );
+                slf4jLogger.warn( "Command line option -{} is deprecated and will be removed in future Maven versions.",
+                        deprecatedOption );
             }
         }
 
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 507be75..765e80e 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
@@ -135,10 +135,10 @@ public class SettingsXmlConfigurationProcessor
             request.getEventSpyDispatcher().onEvent( settingsRequest );
         }
 
-        LOGGER.debug( "Reading global settings from "
-            + getLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) );
-        LOGGER.debug( "Reading user settings from "
-            + getLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) );
+        LOGGER.debug( "Reading global settings from {}",
+            getLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) );
+        LOGGER.debug( "Reading user settings from {}",
+            getLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) );
 
         SettingsBuildingResult settingsResult = settingsBuilder.build( settingsRequest );
 
@@ -156,7 +156,7 @@ public class SettingsXmlConfigurationProcessor
 
             for ( SettingsProblem problem : settingsResult.getProblems() )
             {
-                LOGGER.warn( problem.getMessage() + " @ " + problem.getLocation() );
+                LOGGER.warn( "{} @ {}", problem.getMessage(), problem.getLocation() );
             }
             LOGGER.warn( "" );
         }
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index cb34d8e..1b50399 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -115,8 +115,7 @@ public class ExecutionEventLogger
             for ( MavenProject project : projects )
             {
                 int len = LINE_LENGTH - project.getName().length() - project.getPackaging().length() - 2;
-                logger.info( project.getName() + chars( ' ', ( len > 0 ) ? len : 1 ) + '[' + project.getPackaging()
-                    + ']' );
+                logger.info( "{}{}[{}]", project.getName(), chars( ' ', ( len > 0 ) ? len : 1 ), project.getPackaging());
             }
 
             totalProjects = projects.size();
@@ -267,9 +266,9 @@ public class ExecutionEventLogger
 
         String wallClock = session.getRequest().getDegreeOfConcurrency() > 1 ? " (Wall Clock)" : "";
 
-        logger.info( "Total time:  " + formatDuration( time ) + wallClock );
+        logger.info( "Total time:  {}{}", formatDuration( time ), wallClock );
 
-        logger.info( "Finished at: " + formatTimestamp( finish ) );
+        logger.info( "Finished at: {}", formatTimestamp( finish ) );
     }
 
     @Override
@@ -345,8 +344,8 @@ public class ExecutionEventLogger
     {
         if ( logger.isWarnEnabled() )
         {
-            logger.warn( "Goal " + event.getMojoExecution().getGoal()
-                + " requires online mode for execution but Maven is currently offline, skipping" );
+            logger.warn( "Goal {} requires online mode for execution but Maven is currently offline, skipping",
+                    event.getMojoExecution().getGoal() );
         }
     }
 
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java
index d269770..4757cff 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/UnsupportedSlf4jBindingConfiguration.java
@@ -51,7 +51,7 @@ public class UnsupportedSlf4jBindingConfiguration
     @Override
     public void activate()
     {
-        logger.warn( "The SLF4J binding actually used is not supported by Maven: " + slf4jBinding );
+        logger.warn( "The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding );
         logger.warn( "Maven supported bindings are:" );
 
         String ls = System.getProperty( "line.separator" );
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
index 086e406..57e69ba 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java
@@ -69,8 +69,8 @@ public class Slf4jMavenTransferListener
         throws TransferCancelledException
     {
         TransferResource resource = event.getResource();
-        out.warn( event.getException().getMessage() + " from " + resource.getRepositoryId() + " for "
-            + resource.getRepositoryUrl() + resource.getResourceName() );
+        out.warn( "{} from {} for {}{}", event.getException().getMessage(), resource.getRepositoryId(),
+            resource.getRepositoryUrl(), resource.getResourceName() );
     }
 
     @Override


[maven] 02/04: [MNG-5577] Migrate to JSR 300 Annotations - maven-settings-builder

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-5577
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 03c44ef96b990e46944f8686ea1623666d68ed29
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri Jan 11 03:09:45 2019 +0100

    [MNG-5577] Migrate to JSR 300 Annotations - maven-settings-builder
---
 maven-settings-builder/pom.xml                           | 12 ++++++------
 .../maven/settings/building/DefaultSettingsBuilder.java  | 15 +++++++++------
 .../maven/settings/crypto/DefaultSettingsDecrypter.java  | 16 ++++++++++++----
 .../apache/maven/settings/io/DefaultSettingsReader.java  |  7 +++++--
 .../apache/maven/settings/io/DefaultSettingsWriter.java  |  7 +++++--
 .../settings/validation/DefaultSettingsValidator.java    |  7 +++++--
 6 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/maven-settings-builder/pom.xml b/maven-settings-builder/pom.xml
index 9e3cd8d..9a2eefe 100644
--- a/maven-settings-builder/pom.xml
+++ b/maven-settings-builder/pom.xml
@@ -54,10 +54,6 @@ under the License.
       <artifactId>plexus-interpolation</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-component-annotations</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-settings</artifactId>
     </dependency>
@@ -65,13 +61,17 @@ under the License.
       <groupId>org.sonatype.plexus</groupId>
       <artifactId>plexus-sec-dispatcher</artifactId>
     </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
     <plugins>
       <plugin>
-        <groupId>org.codehaus.plexus</groupId>
-        <artifactId>plexus-component-metadata</artifactId>
+        <groupId>org.eclipse.sisu</groupId>
+        <artifactId>sisu-maven-plugin</artifactId>
       </plugin>
     </plugins>
   </build>
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 3cdae7d..7692510 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
@@ -36,31 +36,34 @@ import org.apache.maven.settings.io.SettingsReader;
 import org.apache.maven.settings.io.SettingsWriter;
 import org.apache.maven.settings.merge.MavenSettingsMerger;
 import org.apache.maven.settings.validation.SettingsValidator;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
 import org.codehaus.plexus.interpolation.InterpolationException;
 import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
 import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 /**
  * Builds the effective settings from a user settings file and/or a global settings file.
  *
  * @author Benjamin Bentmann
  */
-@Component( role = SettingsBuilder.class )
+@Named
+@Singleton
 public class DefaultSettingsBuilder
     implements SettingsBuilder
 {
 
-    @Requirement
+    @Inject
     private SettingsReader settingsReader;
 
-    @Requirement
+    @Inject
     private SettingsWriter settingsWriter;
 
-    @Requirement
+    @Inject
     private SettingsValidator settingsValidator;
 
     private MavenSettingsMerger settingsMerger = new MavenSettingsMerger();
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 671a20d..eb974b9 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
@@ -27,24 +27,32 @@ 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;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
 import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
 import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException;
 
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 /**
  * Decrypts passwords in the settings.
  *
  * @author Benjamin Bentmann
  */
-@Component( role = SettingsDecrypter.class )
+@Named
+@Singleton
 public class DefaultSettingsDecrypter
     implements SettingsDecrypter
 {
 
-    @Requirement( hint = "maven" )
     private SecDispatcher securityDispatcher;
 
+    @Inject
+    public DefaultSettingsDecrypter( final @Named( "maven" ) SecDispatcher securityDispatcher )
+    {
+        this.securityDispatcher = securityDispatcher;
+    }
+
     @Override
     public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request )
     {
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
index fa95613..d5daf16 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
@@ -28,16 +28,19 @@ import java.util.Objects;
 
 import org.apache.maven.settings.Settings;
 import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
-import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.util.ReaderFactory;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 /**
  * Handles deserialization of settings from the default textual format.
  *
  * @author Benjamin Bentmann
  */
-@Component( role = SettingsReader.class )
+@Named
+@Singleton
 public class DefaultSettingsReader
     implements SettingsReader
 {
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
index 96af1a3..2467bb6 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
@@ -29,15 +29,18 @@ import java.util.Objects;
 
 import org.apache.maven.settings.Settings;
 import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
-import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.util.WriterFactory;
 
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 /**
  * Handles serialization of settings into the default textual format.
  *
  * @author Benjamin Bentmann
  */
-@Component( role = SettingsWriter.class )
+@Named
+@Singleton
 public class DefaultSettingsWriter
     implements SettingsWriter
 {
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java
index 1e31f50..ff00b84 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java
@@ -31,13 +31,16 @@ import org.apache.maven.settings.Server;
 import org.apache.maven.settings.Settings;
 import org.apache.maven.settings.building.SettingsProblem.Severity;
 import org.apache.maven.settings.building.SettingsProblemCollector;
-import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.util.StringUtils;
 
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 /**
  * @author Milos Kleint
  */
-@Component( role = SettingsValidator.class )
+@Named
+@Singleton
 public class DefaultSettingsValidator
     implements SettingsValidator
 {


[maven] 03/04: [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-5577
in repository https://gitbox.apache.org/repos/asf/maven.git

commit cc19ae794fccbe0ebf160d26663ea28cf7606c19
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri Jan 11 03:19:11 2019 +0100

    [MNG-5577] Migrate to JSR 300 Annotations - maven-embedder
---
 maven-embedder/pom.xml                             |  8 ------
 .../SettingsXmlConfigurationProcessor.java         | 31 ++++++++++++----------
 maven-embedder/src/site/apt/logging.apt            | 15 ++++++-----
 3 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index 33cbabc..7ec7de9 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -100,10 +100,6 @@ under the License.
       <artifactId>org.eclipse.sisu.plexus</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-component-annotations</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.sonatype.plexus</groupId>
       <artifactId>plexus-sec-dispatcher</artifactId>
     </dependency>
@@ -175,10 +171,6 @@ under the License.
         <artifactId>sisu-maven-plugin</artifactId>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.plexus</groupId>
-        <artifactId>plexus-component-metadata</artifactId>
-      </plugin>
-      <plugin>
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-maven-plugin</artifactId>
         <configuration>
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 2536a22..507be75 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
@@ -43,14 +43,18 @@ import org.apache.maven.settings.building.SettingsBuildingRequest;
 import org.apache.maven.settings.building.SettingsBuildingResult;
 import org.apache.maven.settings.building.SettingsProblem;
 import org.apache.maven.settings.crypto.SettingsDecrypter;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
 
 /**
  * SettingsXmlConfigurationProcessor
  */
-@Component( role = ConfigurationProcessor.class, hint = SettingsXmlConfigurationProcessor.HINT )
+@Named ( SettingsXmlConfigurationProcessor.HINT )
+@Singleton
 public class SettingsXmlConfigurationProcessor
     implements ConfigurationProcessor
 {
@@ -65,13 +69,12 @@ public class SettingsXmlConfigurationProcessor
     public static final File DEFAULT_GLOBAL_SETTINGS_FILE =
         new File( System.getProperty( "maven.conf" ), "settings.xml" );
 
-    @Requirement
-    private Logger logger;
+    private static final Logger LOGGER = LoggerFactory.getLogger( SettingsXmlConfigurationProcessor.class );
 
-    @Requirement
+    @Inject
     private SettingsBuilder settingsBuilder;
 
-    @Requirement
+    @Inject
     private SettingsDecrypter settingsDecrypter;
 
     @Override
@@ -132,9 +135,9 @@ public class SettingsXmlConfigurationProcessor
             request.getEventSpyDispatcher().onEvent( settingsRequest );
         }
 
-        logger.debug( "Reading global settings from "
+        LOGGER.debug( "Reading global settings from "
             + getLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) );
-        logger.debug( "Reading user settings from "
+        LOGGER.debug( "Reading user settings from "
             + getLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) );
 
         SettingsBuildingResult settingsResult = settingsBuilder.build( settingsRequest );
@@ -146,16 +149,16 @@ public class SettingsXmlConfigurationProcessor
 
         populateFromSettings( request, settingsResult.getEffectiveSettings() );
 
-        if ( !settingsResult.getProblems().isEmpty() && logger.isWarnEnabled() )
+        if ( !settingsResult.getProblems().isEmpty() && LOGGER.isWarnEnabled() )
         {
-            logger.warn( "" );
-            logger.warn( "Some problems were encountered while building the effective settings" );
+            LOGGER.warn( "" );
+            LOGGER.warn( "Some problems were encountered while building the effective settings" );
 
             for ( SettingsProblem problem : settingsResult.getProblems() )
             {
-                logger.warn( problem.getMessage() + " @ " + problem.getLocation() );
+                LOGGER.warn( problem.getMessage() + " @ " + problem.getLocation() );
             }
-            logger.warn( "" );
+            LOGGER.warn( "" );
         }
     }
 
diff --git a/maven-embedder/src/site/apt/logging.apt b/maven-embedder/src/site/apt/logging.apt
index 800857c..9bf8e3c 100644
--- a/maven-embedder/src/site/apt/logging.apt
+++ b/maven-embedder/src/site/apt/logging.apt
@@ -64,21 +64,24 @@ Maven Logging
 
 * Getting Logger Instance
 
- Plexus Logger and LoggerManager can be injected in Plexus component using Plexus annotations
+ Plexus Logger and LoggerManager can be injected into component using JSR 300 annotations
 
 +------+
 import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
 
-@Component( role = MyComponent.class )
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+@Named
+@Singleton
 public class DefaultMyComponent
     implements MyComponent
 {
-    @Requirement
+    @Inject
     private Logger logger;
 
-    @Requirement
+    @Inject
     private LoggerManager loggerManager;
 }
 +------+


[maven] 01/04: [MNG-5577] Migrate to JSR 300 Annotations - maven-artifact

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MNG-5577
in repository https://gitbox.apache.org/repos/asf/maven.git

commit ec4f22503678b9a727e44a1bb41f767c1cafba53
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Jan 8 01:43:31 2019 +0100

    [MNG-5577] Migrate to JSR 300 Annotations - maven-artifact
---
 maven-artifact/pom.xml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/maven-artifact/pom.xml b/maven-artifact/pom.xml
index c03162e..8857e80 100644
--- a/maven-artifact/pom.xml
+++ b/maven-artifact/pom.xml
@@ -46,10 +46,6 @@ under the License.
   <build>
     <plugins>
       <plugin>
-        <groupId>org.codehaus.plexus</groupId>
-        <artifactId>plexus-component-metadata</artifactId>
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <configuration>