diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java index 81ecf17d40..1a8512e5a5 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java @@ -1416,9 +1416,8 @@ public static Map getChildModels(MavenProject project, Log logger) * @param model The root model * @param logger The logger for logging. * @return A map of raw models keyed by path relative to the project's basedir. - * @throws IOException if things go wrong. */ - private static Map getChildModels(Model model, Log logger) throws IOException { + private static Map getChildModels(Model model, Log logger) { Map result = new LinkedHashMap<>(); Map childResults = new LinkedHashMap<>(); @@ -1436,7 +1435,7 @@ private static Map getChildModels(Model model, Log logger) throws I result.put(pomFile, moduleModel); childResults.putAll(getChildModels(moduleModel, logger)); } catch (IOException e) { - logger.error("Could not parse " + pomFile.getPath(), e); + throw new UncheckedIOException(e); } }); diff --git a/versions-maven-plugin/pom.xml b/versions-maven-plugin/pom.xml index 9ec07e0b4a..101f0df945 100644 --- a/versions-maven-plugin/pom.xml +++ b/versions-maven-plugin/pom.xml @@ -200,6 +200,7 @@ it-lock-snapshots-junit/* verify + setup ${repository.proxy.url} diff --git a/versions-maven-plugin/src/it/it-set-017-issue-321/module-a2/pom.xml b/versions-maven-plugin/src/it/it-set-017-issue-321/module-a2/pom.invalid similarity index 100% rename from versions-maven-plugin/src/it/it-set-017-issue-321/module-a2/pom.xml rename to versions-maven-plugin/src/it/it-set-017-issue-321/module-a2/pom.invalid diff --git a/versions-maven-plugin/src/it/it-set-017-issue-321/setup.groovy b/versions-maven-plugin/src/it/it-set-017-issue-321/setup.groovy new file mode 100644 index 0000000000..80d08ee9b0 --- /dev/null +++ b/versions-maven-plugin/src/it/it-set-017-issue-321/setup.groovy @@ -0,0 +1,23 @@ +import java.nio.file.Files +/* + * Copyright MojoHaus and Contributors + * + * Licensed 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. + * + */ + +// rename file before run test +def module2Path = basedir.toPath().resolve('module-a2') +Files.move(module2Path.resolve('pom.invalid'), module2Path.resolve('pom.xml')) + +return true diff --git a/versions-maven-plugin/src/it/it-set-017-issue-321/verify.bsh b/versions-maven-plugin/src/it/it-set-017-issue-321/verify.bsh deleted file mode 100644 index a38f0e8e5f..0000000000 --- a/versions-maven-plugin/src/it/it-set-017-issue-321/verify.bsh +++ /dev/null @@ -1,22 +0,0 @@ -import java.io.*; -import org.codehaus.plexus.util.FileUtils; - -try -{ - File file = new File( basedir, "build.log" ); - String buf = FileUtils.fileRead( file, "UTF-8" ); - String expectedMessage = " Illegal processing instruction target (\"xml\"); xml (case insensitive) is reserved by the specs."; - - if ( buf.indexOf( expectedMessage ) < 0 ) - { - System.err.println( "Parsing XML of module-a2/pom.xml should fail the build" ); - return false; - } -} -catch( Throwable t ) -{ - t.printStackTrace(); - return false; -} - -return true; diff --git a/versions-maven-plugin/src/it/it-set-017-issue-321/verify.groovy b/versions-maven-plugin/src/it/it-set-017-issue-321/verify.groovy new file mode 100644 index 0000000000..dd2932b808 --- /dev/null +++ b/versions-maven-plugin/src/it/it-set-017-issue-321/verify.groovy @@ -0,0 +1,4 @@ + + +def log = new File( basedir, "build.log" ).text +assert log.contains(' Illegal processing instruction target ("xml"); xml (case insensitive) is reserved by the specs.')