You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/09/25 22:21:43 UTC
[03/23] maven git commit: [MNG-6206] display deprecation build
warning in case when dependencies use metaversions (LATEST or RELEASE)
[MNG-6206] display deprecation build warning in case when dependencies
use metaversions (LATEST or RELEASE)
Signed-off-by: Karl Heinz Marbaise <kh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/eb6b212b
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/eb6b212b
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/eb6b212b
Branch: refs/heads/MNG-6196_slf4j
Commit: eb6b212b567c287734a2dbbef3c113fe650f1def
Parents: a7dddcb
Author: dejan2609 <de...@gmail.com>
Authored: Sat May 20 16:57:55 2017 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Sun Jun 4 20:23:02 2017 +0200
----------------------------------------------------------------------
.../model/validation/DefaultModelValidator.java | 6 ++++
.../validation/DefaultModelValidatorTest.java | 12 +++++++
...pendency-metaversions-latest-and-release.xml | 38 ++++++++++++++++++++
3 files changed, 56 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven/blob/eb6b212b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
index e790f21..f46be0e 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -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 )
http://git-wip-us.apache.org/repos/asf/maven/blob/eb6b212b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
index 8525476..bb99be9 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
@@ -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)" );
+ }
}
http://git-wip-us.apache.org/repos/asf/maven/blob/eb6b212b/maven-model-builder/src/test/resources/poms/validation/deprecated-dependency-metaversions-latest-and-release.xml
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/test/resources/poms/validation/deprecated-dependency-metaversions-latest-and-release.xml b/maven-model-builder/src/test/resources/poms/validation/deprecated-dependency-metaversions-latest-and-release.xml
new file mode 100644
index 0000000..eba532b
--- /dev/null
+++ b/maven-model-builder/src/test/resources/poms/validation/deprecated-dependency-metaversions-latest-and-release.xml
@@ -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>