From 8b6616cf3b53b77c40cbb0609b92f8d92da42934 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sun, 31 Jan 2010 00:27:21 +0000 Subject: [PATCH] [MNG-4464] Improve handling of relative paths with backslashes git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@904931 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/maven/project/DefaultProjectBuilder.java | 2 ++ .../org/apache/maven/model/building/DefaultModelBuilder.java | 2 ++ .../java/org/apache/maven/model/path/DefaultPathTranslator.java | 2 ++ pom.xml | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index 8993f16998..021a619531 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -338,6 +338,8 @@ public class DefaultProjectBuilder continue; } + module = module.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar ); + File moduleFile = new File( basedir, module ); if ( moduleFile.isDirectory() ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index 90ff7345d1..ca1e8ba7c5 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -545,6 +545,8 @@ public class DefaultModelBuilder String parentPath = childModel.getParent().getRelativePath(); + parentPath = parentPath.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar ); + File pomFile = new File( new File( projectDirectory, parentPath ).toURI().normalize() ); if ( pomFile.isDirectory() ) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java b/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java index 423654a4c7..757e278e92 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java @@ -39,6 +39,8 @@ public class DefaultPathTranslator if ( path != null && basedir != null ) { + path = path.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar ); + File file = new File( path ); if ( file.isAbsolute() ) { diff --git a/pom.xml b/pom.xml index 5866899967..ab499aa7db 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ 1.2 1.2_Java1.3 3.8.2 - 1.5.3 + 1.5.4 1.11 1.0-alpha-1 2.0.1