将line.separator传递给Maven [英] Passing line.separator to maven

查看:97
本文介绍了将line.separator传递给Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将line.separator传递给exec插件,但似乎我没有正确传递它.我尝试了许多组合,但找不到解决方案.正确的方法是什么?

I would like to pass line.separator to exec plugin but it seems that I do not correctly passing it. I have tried many combinations but could not find the solution. What is the correct way?

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <phase>test</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>java</executable>
               <arguments>
                   <argument>-Dline.separator=\n</argument>
                   <argument>-classpath</argument>
                   <classpath />
                   <argument>GeneratorExec</argument>
               </arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

推荐答案

那是行不通的.问题是该命令在外壳中执行.外壳程序会将\n解释为两个字符,而不是一个转义字符.

That is not going to work. The problem is that the command is executed in a shell. The shell will interpret the \n as two characters, not one escaped.

查看此博客:在Java中的命令行上传递"\ n"(换行符).

您将不得不让GeneratorExec将两个字符作为参数,然后在程序中进行处理.

You will have to let the GeneratorExec take the two characters as an argument and then handle it in the program.

这篇关于将line.separator传递给Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆