[MNG-4204] Remove support for legacy style repositories

o Made validator output a deprecation warning

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@814342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-09-13 16:49:16 +00:00
parent 7fee6483b3
commit 8f12f77873
1 changed files with 29 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import java.util.Map;
import org.apache.maven.model.Build; import org.apache.maven.model.Build;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.Parent; import org.apache.maven.model.Parent;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
@ -278,6 +279,25 @@ public class DefaultModelValidator
} }
forcePluginExecutionIdCollision( model, problems ); forcePluginExecutionIdCollision( model, problems );
for ( Repository repository : model.getRepositories() )
{
validateRepositoryLayout( problems, repository, "repositories.repository", request );
}
for ( Repository repository : model.getPluginRepositories() )
{
validateRepositoryLayout( problems, repository, "pluginRepositories.pluginRepository", request );
}
DistributionManagement distMgmt = model.getDistributionManagement();
if ( distMgmt != null )
{
validateRepositoryLayout( problems, distMgmt.getRepository(), "distributionManagement.repository",
request );
validateRepositoryLayout( problems, distMgmt.getSnapshotRepository(),
"distributionManagement.snapshotRepository", request );
}
} }
} }
@ -358,6 +378,15 @@ public class DefaultModelValidator
} }
} }
private void validateRepositoryLayout( ModelProblemCollector problems, Repository repository, String prefix,
ModelBuildingRequest request )
{
if ( repository != null && "legacy".equals( repository.getLayout() ) )
{
addViolation( problems, true, "'" + prefix + ".layout = legacy' is deprecated: " + repository.getId() );
}
}
private void validateResources( ModelProblemCollector problems, List<Resource> resources, String prefix, ModelBuildingRequest request ) private void validateResources( ModelProblemCollector problems, List<Resource> resources, String prefix, ModelBuildingRequest request )
{ {
boolean warnOnBadBoolean = request.getValidationLevel() < ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0; boolean warnOnBadBoolean = request.getValidationLevel() < ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0;