Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

${path.separator} in Maven on Mac is set to ":"

We have a problem with several people using Windows and Maven, and I suspect the issue is with the ${path.separator}. They get an error that a directory "D:\basedir\target/dist" does not exist. We don't get this error on Mac, Linux, and Unix systems.

I'd like to change this to be ${project.build.directory}${path.separator}dist, but on a Mac, the value of ${path.separator} is : and not /. Now my build is failing on Macs because /Users/david/project/target:dist isn't a valid directory.

How can I set my default ${path.separator} on the Mac to be /?

like image 793
David W. Avatar asked Aug 08 '16 13:08

David W.


People also ask

What is a path separator?

The path separator is a character commonly used by the operating system to separate individual paths in a list of paths.

What is the file separator?

A file separator is a character that is used to separate directory names that make up a path to a particular location. This character is operating system specific. On Microsoft Windows, it is a back-slash character (), e.g. C:myprojectmyfilesome.

Which of the following is a filename path separator in Linux?

If you prefer to hard-code the directory separator character, you should use the forward slash ( / ) character. It is the only recognized directory separator character on Unix systems, as the output from the example shows, and is the AltDirectorySeparatorChar on Windows.

Which is the correct constant for a platform independent directory separator Python?

In Windows you can use either \ or / as a directory separator.


1 Answers

Just to close this out...

I wanted ${file.separator} and not ${path.separator}. ${path.separator} is what is used to separate directory names in paths. On Windows, it's ; and on Mac and Unix, it's :.

${file.separator} is the directory separator mark. On Windows, it's \ and on Unix and Macs it's `/'.

I got confused because on the older System X Macs, the file separator was :. I normally just use /, but in this one project, that didn't work.

like image 134
David W. Avatar answered Oct 02 '22 13:10

David W.