我需要传递一个使用Windows格式的目录作为maven上exec的参数,这是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>

我遇到的问题是$ {project.basedir}解析为单斜杠:
cmd /c script_cmdline.bat C:\Talend_CI\talend\release\Routes\SimpleRoute\\target\\classes\\publishRoute

我需要以双反斜杠传递它。如何使用$ {project.basedir}实现此目标?

最佳答案

您有一种方法可以重载变量或声明新变量以表示基于项目的方法
像这样 :

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

关于windows - 需要将Maven的$ {project.basedir}从单反斜杠转换为双斜杠,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27276589/

10-14 09:04