[MNG-5477] check warning issued when no version in reporting section
Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/ed1501ec Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/ed1501ec Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/ed1501ec Branch: refs/heads/slf4j-log4j2 Commit: ed1501ecb5505895de0a62e39221d7175c003748 Parents: 15a1352 Author: Hervé Boutemy <hbout...@apache.org> Authored: Mon May 20 23:10:31 2013 +0200 Committer: Hervé Boutemy <hbout...@apache.org> Committed: Mon May 20 23:10:31 2013 +0200 ---------------------------------------------------------------------- .../validation/DefaultModelValidatorTest.java | 11 +++ .../poms/validation/missing-report-version-pom.xml | 57 +++++++++++++++ 2 files changed, 68 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/ed1501ec/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 dceae51..6fb5de7 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 @@ -613,4 +613,15 @@ public class DefaultModelValidatorTest + "should not point at files within the project directory" ); } + public void testMissingReportPluginVersion() + throws Exception + { + SimpleProblemCollector result = validate( "missing-report-version-pom.xml" ); + + assertViolations( result, 0, 0, 3 ); + + assertContains( result.getWarnings().get( 0 ), "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-noversion-plugin is missing." ); + assertContains( result.getWarnings().get( 1 ), "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-from-plugins-plugin is missing." ); + assertContains( result.getWarnings().get( 2 ), "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-from-pluginManagement-plugin is missing." ); + } } http://git-wip-us.apache.org/repos/asf/maven/blob/ed1501ec/maven-model-builder/src/test/resources/poms/validation/missing-report-version-pom.xml ---------------------------------------------------------------------- diff --git a/maven-model-builder/src/test/resources/poms/validation/missing-report-version-pom.xml b/maven-model-builder/src/test/resources/poms/validation/missing-report-version-pom.xml new file mode 100644 index 0000000..46a560f --- /dev/null +++ b/maven-model-builder/src/test/resources/poms/validation/missing-report-version-pom.xml @@ -0,0 +1,57 @@ +<!-- +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> + <artifactId>foo</artifactId> + <groupId>foo</groupId> + <version>99.44</version> + <packaging>bleh</packaging> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-from-pluginManagement-plugin</artifactId> + <version>1.0</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <artifactId>maven-from-plugins-plugin</artifactId> + <version>1.0</version> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <artifactId>maven-noversion-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-from-plugins-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-from-pluginManagement-plugin</artifactId> + </plugin> + </plugins> + </reporting> +</project>