Need to convert maven $ {project.basedir} from one backslash to a double

I need to pass a directory using Windows format as an argument to exec on maven, here is an excerpt from pom.xml

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <id>export</id> <phase>deploy</phase> <goals> <goal>exec</goal> </goals> <configuration> <escape>true</escape> <executable>${cmdl.exec}</executable> <workingDirectory>${cmdl.location}</workingDirectory> <arguments> <argument>${project.basedir}\\target\\classes\\publishRoute</argument> </arguments> </configuration> </execution> </executions> </plugin> 

The problem I ran into is that the solution $ {project.basedir} resolves one slash:

 cmd /c script_cmdline.bat C:\Talend_CI\talend\release\Routes\SimpleRoute\\target\\classes\\publishRoute 

and I need to pass it a double backslash. How can I achieve this using $ {project.basedir}?

+6
source share
2 answers

Well, looking at a few posts related to this problem, it seems that the only and effective way to overcome this problem is to use a list of properties and use them, respectively, implementing profiling. Although this is not an elegant workaround, you can dynamically assign file paths regardless of the OS / platform used to start maven.

0
source

you have one way to overload a variable or declare a new variable, which means the project is based on for example:

 <basdir.home>C:/Talend_CI/talend/release/Routes/</basdir.home> 
0
source

Source: https://habr.com/ru/post/979060/


All Articles