cd / && mvn -f /project/backend/pom.xml clean compile
I get an error message like this:
java.io.FileNotFoundException: /roject/backend/foobar/my-schema.xsd (No such file or directory)
Note that the path here starts with /roject, not /project.
When I run
cd /tmp && mvn -f /project/backend/pom.xml clean compile
Everything works fine.
I tracked the problem down to the FileSystemUtilities.relativize method. Shortened to the essential part, the method looks like this:
public static String relativize(final String path, final File parentDir) {
final String basedirPath = FileSystemUtilities.getCanonicalPath(parentDir);
String toReturn = path;
if (path.toLowerCase().startsWith(basedirPath.toLowerCase())) {
toReturn = path.substring(basedirPath.length() + 1);
}
return toReturn;
}
This method is called with path=/project/backend/foobar/my-schema.xsd and parentDir=/. The substring command removes the /p which I think is not intended.
When I run
I get an error message like this:
Note that the path here starts with
/roject
, not/project
.When I run
Everything works fine.
I tracked the problem down to the FileSystemUtilities.relativize method. Shortened to the essential part, the method looks like this:
This method is called with
path=/project/backend/foobar/my-schema.xsd
andparentDir=/
. The substring command removes the/p
which I think is not intended.