[MNG-6206] display deprecation build warning in case when dependencies

use metaversions (LATEST or RELEASE)

Signed-off-by: Karl Heinz Marbaise <khmarbaise@apache.org>
This commit is contained in:
dejan2609 2017-05-20 16:57:55 +02:00 committed by Karl Heinz Marbaise
parent a7dddcb876
commit eb6b212b56
3 changed files with 56 additions and 0 deletions

View File

@ -485,6 +485,12 @@ public class DefaultModelValidator
}
}
if ( equals( "LATEST", dependency.getVersion() ) || equals( "RELEASE", dependency.getVersion() ) )
{
addViolation( problems, Severity.WARNING, Version.BASE, prefix + ".version", key,
"is either LATEST or RELEASE (both of them are being deprecated)", dependency );
}
Dependency existing = index.get( key );
if ( existing != null )

View File

@ -676,4 +676,16 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
public void testDeprecatedDependencyMetaversionsLatestAndRelease()
throws Exception
{
SimpleProblemCollector result = validateRaw( "deprecated-dependency-metaversions-latest-and-release.xml" );
assertViolations( result, 0, 0, 2 );
assertContains( result.getWarnings().get( 0 ),
"'dependencies.dependency.version' for test:a:jar is either LATEST or RELEASE (both of them are being deprecated)" );
assertContains( result.getWarnings().get( 1 ),
"'dependencies.dependency.version' for test:b:jar is either LATEST or RELEASE (both of them are being deprecated)" );
}
}

View File

@ -0,0 +1,38 @@
<!--
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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>gid</groupId>
<artifactId>aid</artifactId>
<version>0.1</version>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>a</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>test</groupId>
<artifactId>b</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
</project>