maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r572180 - in /maven/components/trunk: maven-embedder/src/main/java/org/apache/maven/cli/ maven-embedder/src/main/java/org/apache/maven/embedder/ maven-embedder/src/test/java/org/apache/maven/embedder/ maven-project/src/main/java/org/apache/...
Date Sun, 02 Sep 2007 22:48:44 GMT
Author: jvanzyl
Date: Sun Sep  2 15:48:43 2007
New Revision: 572180

URL: http://svn.apache.org/viewvc?rev=572180&view=rev
Log:
MNG-2935: make sure build tanks if the settings are bad (user and global)

Modified:
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/ConfigurationValidationResult.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfigurationValidationResult.java
    maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=572180&r1=572179&r2=572180&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
(original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Sun Sep  2 15:48:43 2007
@@ -26,6 +26,7 @@
 import org.apache.maven.embedder.DefaultConfiguration;
 import org.apache.maven.embedder.MavenEmbedder;
 import org.apache.maven.embedder.MavenEmbedderException;
+import org.apache.maven.embedder.ConfigurationValidationResult;
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
@@ -342,6 +343,22 @@
             .setUserSettingsFile( userSettingsFile )
             .setGlobalSettingsFile( MavenEmbedder.DEFAULT_GLOBAL_SETTINGS_FILE )
             .setClassWorld( classWorld );
+
+        ConfigurationValidationResult cvr = MavenEmbedder.validateConfiguration( configuration
);
+
+        if ( cvr.isUserSettingsFilePresent() && !cvr.isUserSettingsFileParses() )
+        {
+            showFatalError( "Error reading user settings: " + cvr.getUserSettingsException().getMessage(),
cvr.getUserSettingsException(), showErrors );
+
+            return 1;
+        }
+
+        if ( cvr.isGlobalSettingsFilePresent() && !cvr.isGlobalSettingsFileParses()
)
+        {
+            showFatalError( "Error reading global settings: " + cvr.getGlobalSettingsException().getMessage(),
cvr.getGlobalSettingsException(), showErrors );
+
+            return 1;
+        }
 
         String localRepoProperty = executionProperties.getProperty( LOCAL_REPO_PROPERTY );
 

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/ConfigurationValidationResult.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/ConfigurationValidationResult.java?rev=572180&r1=572179&r2=572180&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/ConfigurationValidationResult.java
(original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/ConfigurationValidationResult.java
Sun Sep  2 15:48:43 2007
@@ -47,12 +47,12 @@
     /**
      * Any exception that happened during parsing user settings, or null if there were no
errors.
      */
-    Throwable getUserSettingsException();
+    Exception getUserSettingsException();
 
     /**
      * Any exception that happened during parsing global settings, or null if there were
no errors.
      */
-    Throwable getGlobalSettingsException();
+    Exception getGlobalSettingsException();
 
     /**
      * @deprecated

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfigurationValidationResult.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfigurationValidationResult.java?rev=572180&r1=572179&r2=572180&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfigurationValidationResult.java
(original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfigurationValidationResult.java
Sun Sep  2 15:48:43 2007
@@ -29,9 +29,9 @@
 public class DefaultConfigurationValidationResult
     implements ConfigurationValidationResult
 {
-    private Throwable userSettingsException;
+    private Exception userSettingsException;
 
-    private Throwable globalSettingsException;
+    private Exception globalSettingsException;
 
     private Settings userSettings, globalSettings;
 
@@ -40,22 +40,22 @@
         return ( getUserSettingsException() == null ) && ( getGlobalSettingsException()
== null );
     }
 
-    public Throwable getUserSettingsException()
+    public Exception getUserSettingsException()
     {
         return userSettingsException;
     }
 
-    public void setUserSettingsException( Throwable e )
+    public void setUserSettingsException( Exception e )
     {
         this.userSettingsException = e;
     }
 
-    public Throwable getGlobalSettingsException()
+    public Exception getGlobalSettingsException()
     {
         return globalSettingsException;
     }
 
-    public void setGlobalSettingsException( Throwable e )
+    public void setGlobalSettingsException( Exception e )
     {
         this.globalSettingsException = e;
     }

Modified: maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java?rev=572180&r1=572179&r2=572180&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
(original)
+++ maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
Sun Sep  2 15:48:43 2007
@@ -346,6 +346,7 @@
         assertEquals( 3, result.getProject().getTestClasspathElements().size() );
     }
 
+    /*
     public void testProjectReadingWithDistributionStatus()
         throws Exception
     {
@@ -365,6 +366,7 @@
 
         assertEquals( "deployed", result.getProject().getDistributionManagement().getStatus()
);
     }
+    */
 
     // ----------------------------------------------------------------------------
     // Model Writing

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=572180&r1=572179&r2=572180&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Sun Sep  2 15:48:43 2007
@@ -464,6 +464,10 @@
             profileManager,
             STRICT_MODEL_PARSING );
 
+        /*
+
+        MNG-3178: What is this actually for as we're not deploying this anymore.
+
         if ( checkDistributionManagementStatus )
         {
             if ( ( project.getDistributionManagement() != null ) && ( project.getDistributionManagement().getStatus()
!= null ) )
@@ -474,6 +478,7 @@
                     "Invalid project file: distribution status must not be specified for
a project outside of the repository" );
             }
         }
+        */
 
         return project;
     }



Mime
View raw message