首页 > 解决方案 > 在 Windows 10 中为 java 项目运行 maven 构建时,cygwin 在控制台输出中引入空格

问题描述

在使用 java 1.8 运行 maven 3 构建时,在 windows 10 64 位上检查来自 cygwin64 终端的以下输出片段:

[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\proj\t020-domain\src\          test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ t020-domain ---
m
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source f          iles to C:\proj\t020-domain\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ t020-domain                                     ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar)                                @ t020-domain ---
[INFO] Building jar: C:\proj\t020-domain\target\t020-domain-80.1-SNAPSHOT.jar
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent-integration (default-prepare-agent-integration) @
36mt020-domain ---
[INFO] argLine set to -javaagent:C:\\Users\\VBO07\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.4\\org.jacoco.agent-0
.8.4-runtime.jar=destfile=C:\\proj\\t020-domain\\target\\jacoco-it.exec
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) @ t020-domain ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ t020-domain                                           ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:report (default-                            report) @ t020-domain ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:report-integration (def                            ault-report-integration) @ t020-domain
 ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.4:check (default-check) @ t020-domain ---
[INFO] Skipping JaCoCo execution due to mi          ssing execution data file:C:\proj\t020-domain\target\jacoco.exec

你可以清楚地看到它在线条上发生:

[INFO] skip non existing resourceDirectory C:\proj\t020-domain\src\          test\resources

[INFO] Compiling 2 source f          iles to C:\proj\t020-domain\target\test-classes

[INFO] --- jacoco-maven-plugin:0.8.4:report (default-                            report) @ t020-domain ---

[INFO] --- jacoco-maven-plugin:0.8.4:report-integration (def                            ault-report-integration) @ t020-domain

[INFO] Skipping JaCoCo execution due to mi          ssing execution data file:C:\proj\t020-domain\target\jacoco.exec

我怎样才能解决这个问题?

谢谢你。

标签: javawindowsmavencygwin

解决方案


在 cygwin 的网站上发布这个问题后,Marco Atzeri 给出了一个适合我的解决方案:在 windows 的环境变量中设置:

CYGWIN="disable_pcon"

然后,显然,重新启动 cygwin。

编辑:

上面的解决方案有一个很大的副作用:如果您需要使用 运行交互式命令cmd /C,那么上面的标志将终止交互(例如,等待输入将不再起作用)。Takashi Yano 在 cygwin 上发布了一个没有这个问题的更好的解决方案作为我的问题的答案:将jansi-1.17.1.jarmaven 的 lib 文件夹中的 jar 替换为jansi-2.1.1.jar. 您可以从https://mvnrepository.com/artifact/org.fusesource.jansi/jansi/2.1.1下载 2.1.1 版本


推荐阅读