mirror of https://github.com/apache/maven.git
[MNG-4658] Relax validation of repository ids and only warn upon conflict with "local"
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@940790 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
630c059142
commit
90027ef75a
|
@ -90,7 +90,9 @@ public class DefaultSettingsValidator
|
|||
|
||||
if ( "local".equals( mirror.getId() ) )
|
||||
{
|
||||
addError( problems, "'mirrors.mirror.id' must not be 'local', this identifier is reserved." );
|
||||
addWarn( problems, "'mirrors.mirror.id' must not be 'local'"
|
||||
+ ", this identifier is reserved for the local repository"
|
||||
+ ", using it for other repositories will corrupt your repository metadata." );
|
||||
}
|
||||
|
||||
validateStringNotEmpty( problems, "mirrors.mirror.url", mirror.getUrl(), mirror.getId() );
|
||||
|
@ -119,7 +121,9 @@ public class DefaultSettingsValidator
|
|||
|
||||
if ( "local".equals( repository.getId() ) )
|
||||
{
|
||||
addError( problems, "'" + prefix + ".id' must not be 'local', this identifier is reserved." );
|
||||
addWarn( problems, "'" + prefix + ".id' must not be 'local'"
|
||||
+ ", this identifier is reserved for the local repository"
|
||||
+ ", using it for other repositories will corrupt your repository metadata." );
|
||||
}
|
||||
|
||||
validateStringNotEmpty( problems, prefix + ".url", repository.getUrl(), repository.getId() );
|
||||
|
|
|
@ -500,8 +500,10 @@ public class DefaultModelValidator
|
|||
{
|
||||
if ( "local".equals( repository.getId() ) )
|
||||
{
|
||||
addViolation( problems, Severity.ERROR, prefix + ".id", null,
|
||||
"must not be 'local', this identifier is reserved." );
|
||||
Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
|
||||
addViolation( problems, errOn31, prefix + ".id", null, "must not be 'local'"
|
||||
+ ", this identifier is reserved for the local repository"
|
||||
+ ", using it for other repositories will corrupt your repository metadata." );
|
||||
}
|
||||
if ( "legacy".equals( repository.getLayout() ) )
|
||||
{
|
||||
|
|
|
@ -84,6 +84,11 @@ public class DefaultModelValidatorTest
|
|||
return problems;
|
||||
}
|
||||
|
||||
private void assertContains( String msg, String substring )
|
||||
{
|
||||
assertTrue( "\"" + substring + "\" was not found in: " + msg, msg.contains( substring ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
|
@ -439,14 +444,13 @@ public class DefaultModelValidatorTest
|
|||
{
|
||||
SimpleProblemCollector result = validate( "reserved-repository-id.xml" );
|
||||
|
||||
assertViolations( result, 0, 4, 0 );
|
||||
assertViolations( result, 0, 0, 4 );
|
||||
|
||||
assertTrue( result.getErrors().get( 0 ).contains( "'repositories.repository.id' must not be 'local'" ) );
|
||||
assertTrue( result.getErrors().get( 1 ).contains(
|
||||
"'pluginRepositories.pluginRepository.id' must not be 'local'" ) );
|
||||
assertTrue( result.getErrors().get( 2 ).contains( "'distributionManagement.repository.id' must not be 'local'" ) );
|
||||
assertTrue( result.getErrors().get( 3 ).contains(
|
||||
"'distributionManagement.snapshotRepository.id' must not be 'local'" ) );
|
||||
assertContains( result.getWarnings().get( 0 ), "'repositories.repository.id'" + " must not be 'local'" );
|
||||
assertContains( result.getWarnings().get( 1 ), "'pluginRepositories.pluginRepository.id' must not be 'local'" );
|
||||
assertContains( result.getWarnings().get( 2 ), "'distributionManagement.repository.id' must not be 'local'" );
|
||||
assertContains( result.getWarnings().get( 3 ),
|
||||
"'distributionManagement.snapshotRepository.id' must not be 'local'" );
|
||||
}
|
||||
|
||||
public void testMissingPluginDependencyGroupId()
|
||||
|
|
Loading…
Reference in New Issue