maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r790344 - in /maven/components/trunk/maven-core/src: main/java/org/apache/maven/project/ main/java/org/apache/maven/project/artifact/ test/java/org/apache/maven/project/
Date Wed, 01 Jul 2009 19:52:38 GMT
Author: bentmann
Date: Wed Jul  1 19:52:37 2009
New Revision: 790344

URL: http://svn.apache.org/viewvc?rev=790344&view=rev
Log:
o Propagated new validator API up to project builder

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Wed Jul  1 19:52:37 2009
@@ -23,6 +23,7 @@
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.ModelBuildingRequest;
 import org.apache.maven.model.Repository;
 import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.repository.RepositorySystem;
@@ -128,7 +129,7 @@
             .setLocalRepository( localRepository )
             .setRemoteRepositories( remoteRepositories );
         configuration.setProcessPlugins( false );
-        configuration.setLenientValidation( true );
+        configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
         
         return buildFromRepository( artifact, configuration );
     }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Wed Jul  1 19:52:37 2009
@@ -182,8 +182,7 @@
                                          configuration.getRemoteRepositories() );
 
         ModelBuildingRequest request = new DefaultModelBuildingRequest();
-        request.setValidationLevel( configuration.istLenientValidation() ? ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL
-                        : ModelBuildingRequest.VALIDATION_LEVEL_STRICT );
+        request.setValidationLevel( configuration.getValidationLevel() );
         request.setProcessPlugins( configuration.isProcessPlugins() );
         request.setProfiles( configuration.getProfiles() );
         request.setActiveProfileIds( configuration.getActiveProfileIds() );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java
Wed Jul  1 19:52:37 2009
@@ -23,6 +23,7 @@
 import java.util.Properties;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.ModelBuildingRequest;
 import org.apache.maven.model.ModelEventListener;
 
 @Deprecated
@@ -34,6 +35,7 @@
     public DefaultProjectBuilderConfiguration()
     {
         setProcessPlugins( false );
+        setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 );
     }
 
     public ProjectBuilderConfiguration setLocalRepository( ArtifactRepository localRepository
)
@@ -66,9 +68,9 @@
         return this;
     }
 
-    public ProjectBuilderConfiguration setLenientValidation( boolean lenientValidation )
+    public ProjectBuilderConfiguration setValidationLevel( int validationLevel )
     {
-        super.setLenientValidation( lenientValidation );
+        super.setValidationLevel( validationLevel );
         return this;
     }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
Wed Jul  1 19:52:37 2009
@@ -25,6 +25,7 @@
 import java.util.Properties;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.ModelBuildingRequest;
 import org.apache.maven.model.ModelEventListener;
 import org.apache.maven.model.Profile;
 
@@ -41,7 +42,7 @@
 
     private MavenProject topProject;
 
-    private boolean lenientValidation;
+    private int validationLevel = ModelBuildingRequest.VALIDATION_LEVEL_STRICT;
 
     private boolean processPlugins;
 
@@ -167,15 +168,15 @@
         return this;
     }
 
-    public ProjectBuildingRequest setLenientValidation( boolean lenientValidation )
+    public ProjectBuildingRequest setValidationLevel( int validationLevel )
     {
-        this.lenientValidation = lenientValidation;
+        this.validationLevel = validationLevel;
         return this;
     }
 
-    public boolean istLenientValidation()
+    public int getValidationLevel()
     {
-        return lenientValidation;
+        return validationLevel;
     }
 
     public List<String> getActiveProfileIds()

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
Wed Jul  1 19:52:37 2009
@@ -5,6 +5,7 @@
 import java.util.Properties;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.ModelBuildingRequest;
 import org.apache.maven.model.Profile;
 
 public interface ProjectBuildingRequest
@@ -36,20 +37,18 @@
     /**
      * Controls the level of validation to perform on processed models. By default, models
are validated in strict mode.
      * 
-     * @param lenientValidation A flag whether validation should be lenient instead of strict.
For building of projects,
-     *            strict validation should be used to ensure proper building. For the mere
retrievel of dependencies
-     *            during artifact resolution, lenient validation should be used to account
for models of poor quality.
+     * @param validationLevel The level of validation to perform on processed models, e.g.
+     *            {@link ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
      * @return This configuration, never {@code null}.
      */
-    ProjectBuildingRequest setLenientValidation( boolean lenientValidation );
+    ProjectBuildingRequest setValidationLevel( int validationLevel );
 
     /**
      * Gets the level of validation to perform on processed models.
      * 
-     * @return {@code true} if lenient validation is enabled and only the dependency information
is to be validated,
-     *         {@code false} if strict validation is enabled and the entire model is validated.
+     * @return The level of validation to perform on processed models.
      */
-    boolean istLenientValidation();
+    int getValidationLevel();
 
     // Profiles
     

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
Wed Jul  1 19:52:37 2009
@@ -43,6 +43,7 @@
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.model.Dependency;
 import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.ModelBuildingRequest;
 import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuilder;
@@ -114,7 +115,7 @@
             ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
             configuration.setLocalRepository( localRepository );
             configuration.setRemoteRepositories( remoteRepositories );
-            configuration.setLenientValidation( true );
+            configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL
);
             // We don't care about processing plugins here, all we're interested in is the
dependencies.
             configuration.setProcessPlugins( false );
             // FIXME: We actually need the execution properties here...

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=790344&r1=790343&r2=790344&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
(original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
Wed Jul  1 19:52:37 2009
@@ -25,8 +25,8 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.model.ModelBuildingRequest;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.project.harness.PomTestWrapper;
 import org.apache.maven.repository.RepositorySystem;
@@ -1678,7 +1678,8 @@
         config.setLocalRepository( repositorySystem.createArtifactRepository( "local", localRepoUrl,
new DefaultRepositoryLayout(), null, null ) );
         config.setActiveProfileIds( Arrays.asList( profileIds ) );
         config.setExecutionProperties( executionProperties );
-        config.setLenientValidation( lenientValidation );
+        config.setValidationLevel( lenientValidation ? ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0
+                        : ModelBuildingRequest.VALIDATION_LEVEL_STRICT );
 
         return new PomTestWrapper( pomFile, projectBuilder.build( pomFile, config ) );
     }



Mime
View raw message