7

I am having a similar problem as Ant produces jsfl with backslashes instead of slashes except that I'm running under Maven.

I'd like to generate cross-platform paths relative to Maven's built-in property ${basedir}. The problem is that under Windows, ${basedir} resolves to a path containing Windows-style slashes. Is there an easy way for me to get ${basedir} into a form that always uses Unix-style slashes even under Windows?

Community
  • 1
  • 1
Gili
  • 86,244
  • 97
  • 390
  • 689

2 Answers2

11

Answering my own question:

Use ${file.separator} instead of slash and watch out for bug MEXEC-81 which was fixed in 2010 by git commit 6e8be6881fe50714a00509f8f106e21d50d606a6 (svn: 12372) which was where quotes and backslashes were misinterpreted.

Gili
  • 86,244
  • 97
  • 390
  • 689
2

In the case of adding a dir to the library path, you are better off creating a new artifact with its own pom, installing it in your local repo and adding it as a dependency in the project.

Maven and Native Libraries: JDIC and java.library.path UPDATED goes into more detail about getting a native dependency into the library path.

Using native dependencies inside Maven Is another approach.

Community
  • 1
  • 1
Gabriel
  • 1,679
  • 3
  • 16
  • 37