Author: gboue Date: Sat Nov 19 15:21:30 2016 New Revision: 1770497 URL: http://svn.apache.org/viewvc?rev=1770497&view=rev Log: Migration to Maven 3: because of an API change in ModelProblemCollector between 3.0.x and 3.1.x, that interface cannot be used as-is for compatibility for both in order to determine if the coordinate information passed by the user is valid. The plugins are compiled with 3.0 core and are currently linked to a specific ModelProblemCollector, but starting with 3.1.0-alpha-1, Maven core calls a different method than the one the plugins were compiled with. This results in AbstractMethodError at run-time. (this was not detected by the ITs because, although they tested that the build failed with missing parameters, it didn't test the cause of the failure.)
Since the plugins are now using a new MavenProject instance, and attaching things to it in order to deploy or install them, it is possible to rely on the validation performed during the building of that project to catch model errors. Added: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-invalid.properties - copied unchanged from r1768278, maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test.properties maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties (with props) maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.groovy - copied, changed from r1768278, maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.bsh maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-invalid.properties - copied unchanged from r1768278, maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test.properties maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties (with props) maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.groovy - copied, changed from r1768278, maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.bsh Removed: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test.properties maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.bsh maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test.properties maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.bsh Modified: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/invoker.properties maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/invoker.properties maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Modified: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/invoker.properties?rev=1770497&r1=1770496&r2=1770497&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/invoker.properties (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/invoker.properties Sat Nov 19 15:21:30 2016 @@ -17,3 +17,6 @@ invoker.goals = org.apache.maven.plugins:maven-deploy-plugin:${project.version}:deploy-file invoker.buildResult = failure + +invoker.systemPropertiesFile.1 = test-invalid.properties +invoker.systemPropertiesFile.2 = test-missing.properties Added: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties?rev=1770497&view=auto ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties (added) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties Sat Nov 19 15:21:30 2016 @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +file = test.jar +url = file:///${basedir}/target/repo +packaging = jar + +# missing coordinates should have deploy-file bail out +groupId = groupId Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/test-missing.properties ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Copied: maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.groovy (from r1768278, maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.bsh) URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.groovy?p2=maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.groovy&p1=maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.bsh&r1=1768278&r2=1770497&rev=1770497&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.bsh (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/it/gav-validation/verify.groovy Sat Nov 19 15:21:30 2016 @@ -17,22 +17,19 @@ * under the License. */ -import java.io.*; -import java.util.*; - String[] paths = -{ +[ "org/apache/maven/its/deploy/gv", -}; +]; for ( String path : paths ) { - File file = new File( new File( basedir, "target/repo" ), path ); - System.out.println( "Checking for absence of " + file ); - if ( file.exists() ) - { - throw new Exception( "Existing: " + file.getAbsolutePath() ); - } + assert !new File( new File( basedir, "target/repo" ), path ).exists() } +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() +assert buildLog.text.contains( "The artifact information is incomplete" ) +assert buildLog.text.contains( "The artifact information is not valid" ) + return true; Modified: maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java?rev=1770497&r1=1770496&r2=1770497&view=diff ============================================================================== --- maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java (original) +++ maven/plugins/trunk/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java Sat Nov 19 15:21:30 2016 @@ -37,13 +37,9 @@ import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.model.InputLocation; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; -import org.apache.maven.model.building.DefaultModelBuildingRequest; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelProblem.Severity; -import org.apache.maven.model.building.ModelProblemCollector; +import org.apache.maven.model.building.ModelBuildingException; import org.apache.maven.model.building.ModelSource; import org.apache.maven.model.building.StringModelSource; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; @@ -64,6 +60,7 @@ import org.apache.maven.shared.artifact. import org.apache.maven.shared.artifact.deploy.ArtifactDeployer; import org.apache.maven.shared.artifact.deploy.ArtifactDeployerException; import org.apache.maven.shared.repository.RepositoryManager; +import org.apache.maven.shared.utils.Os; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; @@ -192,8 +189,8 @@ public class DeployFileMojo /** * Whether to deploy snapshots with a unique version or not. * - * @deprecated As of Maven 3, this isn't supported anymore and this parameter is only present to break the build - * if you use it! + * @deprecated As of Maven 3, this isn't supported anymore and this parameter is only present to break the build if + * you use it! */ @Parameter( property = "uniqueVersion" ) @Deprecated @@ -344,12 +341,9 @@ public class DeployFileMojo initProperties(); - validateArtifactInformation(); - ArtifactRepositoryLayout layout = getLayout( repositoryLayout ); - ArtifactRepository deploymentRepository = - createDeploymentArtifactRepository( repositoryId, url, layout ); + ArtifactRepository deploymentRepository = createDeploymentArtifactRepository( repositoryId, url, layout ); String protocol = deploymentRepository.getProtocol(); @@ -358,14 +352,14 @@ public class DeployFileMojo throw new MojoExecutionException( "No transfer protocol found." ); } + MavenProject project = createMavenProject(); + Artifact artifact = project.getArtifact(); + if ( file.equals( getLocalRepoFile() ) ) { throw new MojoFailureException( "Cannot deploy artifact from the local repository: " + file ); } - MavenProject project = createMavenProject(); - Artifact artifact = project.getArtifact(); - List<Artifact> deployableArtifacts = new ArrayList<Artifact>(); if ( classifier == null ) @@ -523,11 +517,17 @@ public class DeployFileMojo * to attach the artifacts to deploy to. * * @return The created Maven project, never <code>null</code>. + * @throws MojoExecutionException When the model of the project could not be built. * @throws MojoFailureException When building the project failed. */ private MavenProject createMavenProject() - throws MojoFailureException + throws MojoExecutionException, MojoFailureException { + if ( groupId == null || artifactId == null || version == null || packaging == null ) + { + throw new MojoExecutionException( "The artifact information is incomplete: 'groupId', 'artifactId', " + + "'version' and 'packaging' are required." ); + } ModelSource modelSource = new StringModelSource( "<project>" + "<modelVersion>4.0.0</modelVersion>" + "<groupId>" + groupId + "</groupId>" + "<artifactId>" + artifactId + "</artifactId>" + "<version>" + version + "</version>" @@ -541,7 +541,12 @@ public class DeployFileMojo } catch ( ProjectBuildingException e ) { - throw new MojoFailureException( e.getMessage(), e ); + if ( e.getCause() instanceof ModelBuildingException ) + { + throw new MojoExecutionException( "The artifact information is not valid:" + Os.LINE_SEP + + e.getCause().getMessage() ); + } + throw new MojoFailureException( "Unable to create the project.", e ); } } @@ -672,29 +677,6 @@ public class DeployFileMojo } /** - * Validates the user-supplied artifact information. - * - * @throws MojoExecutionException If any artifact coordinate is invalid. - */ - private void validateArtifactInformation() - throws MojoExecutionException - { - Model model = generateModel(); - - ModelBuildingRequest buildingRequest = new DefaultModelBuildingRequest(); - - DeployModelProblemCollector problemCollector = new DeployModelProblemCollector(); - - modelValidator.validateEffectiveModel( model, buildingRequest, problemCollector ); - - if ( problemCollector.getMessageCount() > 0 ) - { - throw new MojoExecutionException( "The artifact information is incomplete or not valid:\n" - + problemCollector.render( " " ) ); - } - } - - /** * Generates a minimal model from the user-supplied artifact information. * * @return The generated model, never <code>null</code>. @@ -775,42 +757,4 @@ public class DeployFileMojo this.classifier = classifier; } - private static class DeployModelProblemCollector - implements ModelProblemCollector - { - /** */ - private static final String NEWLINE = System.getProperty( "line.separator" ); - - /** */ - private List<String> messages = new ArrayList<String>(); - - @Override - public void add( Severity severity, String message, InputLocation location, Exception cause ) - { - messages.add( message ); - } - - public int getMessageCount() - { - return messages.size(); - } - - public String render( String indentation ) - { - if ( messages.size() == 0 ) - { - return indentation + "There were no validation errors."; - } - - StringBuilder message = new StringBuilder(); - - for ( int i = 0; i < messages.size(); i++ ) - { - message.append( indentation + "[" + i + "] " + messages.get( i ).toString() + NEWLINE ); - } - - return message.toString(); - } - }; - } Modified: maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/invoker.properties?rev=1770497&r1=1770496&r2=1770497&view=diff ============================================================================== --- maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/invoker.properties (original) +++ maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/invoker.properties Sat Nov 19 15:21:30 2016 @@ -17,3 +17,6 @@ invoker.goals = org.apache.maven.plugins:maven-install-plugin:${project.version}:install-file invoker.buildResult = failure + +invoker.systemPropertiesFile.1 = test-invalid.properties +invoker.systemPropertiesFile.2 = test-missing.properties Added: maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties?rev=1770497&view=auto ============================================================================== --- maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties (added) +++ maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties Sat Nov 19 15:21:30 2016 @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +file = test.jar +packaging = jar + +# missing coordinates should have install-file bail out +groupId = groupId Propchange: maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/test-missing.properties ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Copied: maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.groovy (from r1768278, maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.bsh) URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.groovy?p2=maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.groovy&p1=maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.bsh&r1=1768278&r2=1770497&rev=1770497&view=diff ============================================================================== --- maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.bsh (original) +++ maven/plugins/trunk/maven-install-plugin/src/it/gav-validation/verify.groovy Sat Nov 19 15:21:30 2016 @@ -17,22 +17,19 @@ * under the License. */ -import java.io.*; -import java.util.*; - String[] paths = -{ +[ "org/apache/maven/its/install/gv", -}; +]; for ( String path : paths ) { - File file = new File( localRepositoryPath, path ); - System.out.println( "Checking for absence of " + file ); - if ( file.exists() ) - { - throw new FileNotFoundException( "Existing: " + file.getAbsolutePath() ); - } + assert !new File( localRepositoryPath, path ).exists(); } +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() +assert buildLog.text.contains( "The artifact information is incomplete" ) +assert buildLog.text.contains( "The artifact information is not valid" ) + return true; Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=1770497&r1=1770496&r2=1770497&view=diff ============================================================================== --- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java (original) +++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Sat Nov 19 15:21:30 2016 @@ -27,26 +27,19 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; -import java.util.ArrayList; import java.util.Enumeration; -import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.regex.Pattern; import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.InputLocation; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; -import org.apache.maven.model.building.DefaultModelBuildingRequest; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelProblem.Severity; -import org.apache.maven.model.building.ModelProblemCollector; +import org.apache.maven.model.building.ModelBuildingException; import org.apache.maven.model.building.ModelSource; import org.apache.maven.model.building.StringModelSource; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; -import org.apache.maven.model.validation.ModelValidator; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; @@ -61,6 +54,7 @@ import org.apache.maven.project.ProjectB import org.apache.maven.project.artifact.ProjectArtifactMetadata; import org.apache.maven.shared.project.install.ProjectInstaller; import org.apache.maven.shared.project.install.ProjectInstallerRequest; +import org.apache.maven.shared.utils.Os; import org.apache.maven.shared.utils.ReaderFactory; import org.apache.maven.shared.utils.WriterFactory; import org.apache.maven.shared.utils.io.IOUtil; @@ -164,12 +158,6 @@ public class InstallFileMojo private File localRepositoryPath; /** - * The component used to validate the user-supplied artifact coordinates. - */ - @Component - private ModelValidator modelValidator; - - /** * Used for attaching the artifacts to install to the project. */ @Component @@ -180,13 +168,13 @@ public class InstallFileMojo */ @Component private ProjectBuilder projectBuilder; - + /** * Used to install the project created. */ @Component private ProjectInstaller installer; - + /** * @see org.apache.maven.plugin.Mojo#execute() */ @@ -202,14 +190,14 @@ public class InstallFileMojo } ProjectBuildingRequest buildingRequest = session.getProjectBuildingRequest(); - + // ---------------------------------------------------------------------- // Override the default localRepository variable // ---------------------------------------------------------------------- if ( localRepositoryPath != null ) { buildingRequest = repositoryManager.setLocalRepositoryBasedir( buildingRequest, localRepositoryPath ); - + getLog().debug( "localRepoPath: " + repositoryManager.getLocalRepositoryBasedir( buildingRequest ) ); } @@ -225,17 +213,15 @@ public class InstallFileMojo pomFile = temporaryPom; } - validateArtifactInformation(); - MavenProject project = createMavenProject(); Artifact artifact = project.getArtifact(); - + if ( file.equals( getLocalRepoFile( buildingRequest, artifact ) ) ) { throw new MojoFailureException( "Cannot install artifact. " + "Artifact is already in the local repository.\n\nFile in question is: " + file + "\n" ); } - + if ( classifier == null ) { artifact.setFile( file ); @@ -295,7 +281,7 @@ public class InstallFileMojo { projectHelper.attachArtifact( project, "jar", "javadoc", javadoc ); } - + try { // CHECKSTYLE_OFF: LineLength @@ -318,32 +304,41 @@ public class InstallFileMojo } } } - + /** * Creates a Maven project in-memory from the user-supplied groupId, artifactId and version. When a classifier is * supplied, the packaging must be POM because the project with only have attachments. This project serves as basis * to attach the artifacts to install to. * * @return The created Maven project, never <code>null</code>. + * @throws MojoExecutionException When the model of the project could not be built. * @throws MojoFailureException When building the project failed. */ private MavenProject createMavenProject() - throws MojoFailureException + throws MojoExecutionException, MojoFailureException { - ModelSource modelSource = - new StringModelSource( "<project>" + "<modelVersion>4.0.0</modelVersion>" + "<groupId>" + groupId - + "</groupId>" + "<artifactId>" + artifactId + "</artifactId>" + "<version>" + version + "</version>" - + "<packaging>" + ( classifier == null ? packaging : "pom" ) + "</packaging>" + "</project>" ); - DefaultProjectBuildingRequest buildingRequest = - new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() ); - buildingRequest.setProcessPlugins( false ); + if ( groupId == null || artifactId == null || version == null || packaging == null ) + { + throw new MojoExecutionException( "The artifact information is incomplete: 'groupId', 'artifactId', " + + "'version' and 'packaging' are required." ); + } + ModelSource modelSource = new StringModelSource( "<project><modelVersion>4.0.0</modelVersion><groupId>" + + groupId + "</groupId><artifactId>" + artifactId + "</artifactId><version>" + version + + "</version><packaging>" + ( classifier == null ? packaging : "pom" ) + "</packaging></project>" ); + ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() ); + pbr.setProcessPlugins( false ); try { - return projectBuilder.build( modelSource, buildingRequest ).getProject(); + return projectBuilder.build( modelSource, pbr ).getProject(); } catch ( ProjectBuildingException e ) { - throw new MojoFailureException( e.getMessage(), e ); + if ( e.getCause() instanceof ModelBuildingException ) + { + throw new MojoExecutionException( "The artifact information is not valid:" + Os.LINE_SEP + + e.getCause().getMessage() ); + } + throw new MojoFailureException( "Unable to create the project.", e ); } } @@ -375,16 +370,16 @@ public class InstallFileMojo try { pomInputStream = jarFile.getInputStream( entry ); - + String base = file.getName(); if ( base.indexOf( '.' ) > 0 ) { base = base.substring( 0, base.lastIndexOf( '.' ) ); } pomFile = File.createTempFile( base, ".pom" ); - + pomOutputStream = new FileOutputStream( pomFile ); - + IOUtil.copy( pomInputStream, pomOutputStream ); pomOutputStream.close(); @@ -504,29 +499,6 @@ public class InstallFileMojo } /** - * Validates the user-supplied artifact information. - * - * @throws MojoExecutionException If any artifact coordinate is invalid. - */ - private void validateArtifactInformation() - throws MojoExecutionException - { - Model model = generateModel(); - - ModelBuildingRequest buildingRequest = new DefaultModelBuildingRequest(); - - InstallModelProblemCollector problemCollector = new InstallModelProblemCollector(); - - modelValidator.validateEffectiveModel( model, buildingRequest , problemCollector ); - - if ( problemCollector.getMessageCount() > 0 ) - { - throw new MojoExecutionException( "The artifact information is incomplete or not valid:\n" - + problemCollector.render( " " ) ); - } - } - - /** * Generates a minimal model from the user-supplied artifact information. * * @return The generated model, never <code>null</code>. @@ -581,40 +553,4 @@ public class InstallFileMojo } } - private static class InstallModelProblemCollector implements ModelProblemCollector - { - /** */ - private static final String NEWLINE = System.getProperty( "line.separator" ); - - /** */ - private List<String> messages = new ArrayList<String>(); - - @Override - public void add( Severity severity, String message, InputLocation location, Exception cause ) - { - messages.add( message ); - } - - public int getMessageCount() - { - return messages.size(); - } - - public String render( String indentation ) - { - if ( messages.size() == 0 ) - { - return indentation + "There were no validation errors."; - } - - StringBuilder message = new StringBuilder(); - - for ( int i = 0; i < messages.size(); i++ ) - { - message.append( indentation + "[" + i + "] " + messages.get( i ).toString() + NEWLINE ); - } - - return message.toString(); - } - }; }