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 2019/11/25 21:11:58 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 db3de5e18aaf9c15e29658b8a422ad363127115f
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 |  2 +-
 .../apache/maven/monitor/logging/DefaultLog.java   |  3 ++
 5 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index d122ecb..0424d6f 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -131,6 +131,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 1e95010..92b779b 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
@@ -26,7 +26,7 @@ import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GnuParser;
 import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 
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 )