You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/11/08 19:29:26 UTC

[maven] 01/01: WIP - [MNG-6012] Missing profile is only notified at the end of a run o Introduced new command line option --fail-on-missing-profiles which will fail the build immediately. o Print WARNING at the beginning and at the end of the output.

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

khmarbaise pushed a commit to branch MNG-6012-Missing-Profile-At-End
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 241f460086b07b59581d9868add70fb93f9546c8
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Jul 16 13:13:54 2016 +0200

    WIP - [MNG-6012] Missing profile is only notified at the end of a run
     o Introduced new command line option --fail-on-missing-profiles
       which will fail the build immediately.
     o Print WARNING at the beginning and at the end of the output.
---
 apache-maven/pom.xml                               | 11 +++++++
 .../execution/DefaultMavenExecutionRequest.java    | 36 ++++++++++++++++++++--
 .../maven/execution/MavenExecutionRequest.java     | 36 ++++++++++++++++++++++
 .../main/java/org/apache/maven/cli/CLIManager.java |  3 ++
 .../apache/maven/monitor/logging/DefaultLog.java   |  3 ++
 5 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index f371d94..94a1f3f 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -123,6 +123,17 @@ under the License.
       </plugins>
     </pluginManagement>
     <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-remote-resources-plugin</artifactId>
+          <version>1.5</version>
+          <executions>
+            <execution>
+              <id>process-resource-bundles</id>
+              <phase>U</phase>
+            </execution>
+          </executions>
+        </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
index 4a039eb..fc36b39 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
@@ -163,8 +163,11 @@ public class DefaultMavenExecutionRequest
 
     private Map<String, Object> data;
 
+    private FailLevel failLevel;
+
     public DefaultMavenExecutionRequest()
     {
+        this.failLevel = FailLevel.ERROR;
     }
 
     public static MavenExecutionRequest copy( MavenExecutionRequest original )
@@ -186,8 +189,8 @@ public class DefaultMavenExecutionRequest
         copy.setGlobalSettingsFile( original.getGlobalSettingsFile() );
         copy.setUserToolchainsFile( original.getUserToolchainsFile() );
         copy.setGlobalToolchainsFile( original.getGlobalToolchainsFile() );
-        copy.setBaseDirectory( ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() )
-                                                                       : null );
+        copy.setBaseDirectory(
+            ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() ) : null );
         copy.setGoals( original.getGoals() );
         copy.setRecursive( original.isRecursive() );
         copy.setPom( original.getPom() );
@@ -670,7 +673,9 @@ public class DefaultMavenExecutionRequest
         return useReactor;
     }
 
-    /** @deprecated use {@link #setPom(File)} */
+    /**
+     * @deprecated use {@link #setPom(File)}
+     */
     @Deprecated
     public MavenExecutionRequest setPomFile( String pomFilename )
     {
@@ -1283,4 +1288,29 @@ public class DefaultMavenExecutionRequest
 
         return data;
     }
+
+    @Override
+    public boolean isFailLevelWARN()
+    {
+        return this.failLevel.equals( FailLevel.WARN );
+    }
+
+    @Override
+    public boolean isFailLevelERROR()
+    {
+        return this.failLevel.equals( FailLevel.ERROR );
+    }
+
+    @Override
+    public FailLevel getFailLevel()
+    {
+        return this.failLevel;
+    }
+
+    @Override
+    public MavenExecutionRequest setFailLevel( FailLevel failLevel )
+    {
+        this.failLevel = failLevel;
+        return this;
+    }
 }
diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
index d006a43..1550c78 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
@@ -92,6 +92,16 @@ public interface MavenExecutionRequest
 
     String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
 
+    public enum FailLevel {
+        /**
+         * The default level on which Maven will fail the build.
+         */
+        ERROR, 
+        /**
+         * In case of warnings fail the build.
+         */
+        WARN
+    }
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -442,4 +452,30 @@ public interface MavenExecutionRequest
      * @since 3.3.0
      */
     Map<String, Object> getData();
+    
+    /**
+     * @return the current {@link FailLevel}
+     * @since 3.4.0
+     */
+    FailLevel getFailLevel();
+
+    /**
+     * Set the fail level to one of {@link FailLevel}.
+     * @param The FailLevel.
+     * @return {@link MavenExecutionRequest}
+     * @since 3.4.0
+     */
+    MavenExecutionRequest setFailLevel( FailLevel failLevel );
+
+    /**
+     * check if FailLevel is {@code WARN}.
+     * @return true if {@link FailLevel} is {@code WARN}. 
+     */
+    boolean isFailLevelWARN();
+    /**
+     * check if FailLevel is {@code ERROR}.
+     * @return true if {@link FailLevel} is {@code ERROR}. 
+     */
+    boolean isFailLevelERROR();
+    
 }
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
index a9038bf..8cdc548 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIManager.java
@@ -80,6 +80,8 @@ public class CLIManager
     public static final String FAIL_AT_END = "fae";
 
     public static final String FAIL_NEVER = "fn";
+    
+    public static final String FAIL_LEVEL = "fl";
 
     public static final String RESUME_FROM = "rf";
 
@@ -140,6 +142,7 @@ public class CLIManager
         options.addOption( OptionBuilder.withLongOpt( "threads" ).hasArg().withDescription( "Thread count, for instance 2.0C where C is core multiplied" ).create( THREADS ) );
         options.addOption( OptionBuilder.withLongOpt( "legacy-local-repository" ).withDescription( "Use Maven 2 Legacy Local Repository behaviour, ie no use of _remote.repositories. Can also be activated by using -Dmaven.legacyLocalRepo=true" ).create( LEGACY_LOCAL_REPOSITORY ) );
         options.addOption( OptionBuilder.withLongOpt( "builder" ).hasArg().withDescription( "The id of the build strategy to use" ).create( BUILDER ) );
+        options.addOption( OptionBuilder.withLongOpt( "fail-level" ).hasArg().withDescription( "Fail the build if XXXX" ).create( FAIL_LEVEL ) );
 
         // Adding this back in for compatibility with the verifier that hard codes this option.
         options.addOption( OptionBuilder.withLongOpt( "no-plugin-registry" ).withDescription( "Ineffective, only kept for backward compatibility" ).create( "npr" ) );
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java b/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java
index 4fee2e2..8820562 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java
@@ -81,16 +81,19 @@ public class DefaultLog
     public void warn( CharSequence content )
     {
         logger.warn( toString( content ) );
+        logger.warn( " **** " );
     }
 
     public void warn( CharSequence content, Throwable error )
     {
         logger.warn( toString( content ), error );
+        logger.warn( " **** " );
     }
 
     public void warn( Throwable error )
     {
         logger.warn( "", error );
+        logger.warn( " **** " );
     }
 
     public void error( CharSequence content )