[jira] [Commented] (MNG-6225) Application cannot output ANSI colors when run by Maven
[ https://issues.apache.org/jira/browse/MNG-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16770213#comment-16770213 ] Gili commented on MNG-6225: --- [~michael-o] How would I test this? I don't see where I can download 3.6.1-SNAPSHOT binaries for Windows. Here is a more concise testcase for you: # Create a Maven project with Surefire plugin configured with 0. # Run "mvn -Djava.library.path=X". # Try reading "java.library.path" from within a unit test. # Notice that the system property is not set. Expected behavior: Running "mvn -D" should trigger a build failure or warning indicating that users should use MAVEN_OPTS to set system properties. > Application cannot output ANSI colors when run by Maven > --- > > Key: MNG-6225 > URL: https://issues.apache.org/jira/browse/MNG-6225 > Project: Maven > Issue Type: Bug > Components: Command Line, core >Affects Versions: 3.5.0 >Reporter: Gili >Priority: Major > > I'm not sure which Maven component this bug report belongs to (please > reassign if needed). > This is a follow-up to https://issues.apache.org/jira/browse/SUREFIRE-1369 > To recap: someone (probably Maven core) is redirecting the native stdout > handle when running plugins such as Surefire. This prevents applications from > outputting ANSI colors under Windows 10 because: > * Applications must explicitly enable ANSI support using JNI. > * The JNI calls fail if the stdout handle has been redirected. > If I run the exact same application outside of Maven, JNI no longer detects > that stdout has been redirected and ANSI colors as expected. > Any idea who is doing the redirection, and how to disable it? -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MNG-6225) Application cannot output ANSI colors when run by Maven
[ https://issues.apache.org/jira/browse/MNG-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16770189#comment-16770189 ] Michael Osipov commented on MNG-6225: - I guess this still applies for 3.6.1-SNAPSHOT? > Application cannot output ANSI colors when run by Maven > --- > > Key: MNG-6225 > URL: https://issues.apache.org/jira/browse/MNG-6225 > Project: Maven > Issue Type: Bug > Components: Command Line, core >Affects Versions: 3.5.0 >Reporter: Gili >Priority: Major > > I'm not sure which Maven component this bug report belongs to (please > reassign if needed). > This is a follow-up to https://issues.apache.org/jira/browse/SUREFIRE-1369 > To recap: someone (probably Maven core) is redirecting the native stdout > handle when running plugins such as Surefire. This prevents applications from > outputting ANSI colors under Windows 10 because: > * Applications must explicitly enable ANSI support using JNI. > * The JNI calls fail if the stdout handle has been redirected. > If I run the exact same application outside of Maven, JNI no longer detects > that stdout has been redirected and ANSI colors as expected. > Any idea who is doing the redirection, and how to disable it? -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MNG-6225) Application cannot output ANSI colors when run by Maven
[ https://issues.apache.org/jira/browse/MNG-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16741663#comment-16741663 ] Gili commented on MNG-6225: --- Here is the follow-up issue for Surefire: SUREFIRE-1371 > Application cannot output ANSI colors when run by Maven > --- > > Key: MNG-6225 > URL: https://issues.apache.org/jira/browse/MNG-6225 > Project: Maven > Issue Type: Bug > Components: Command Line, core >Affects Versions: 3.5.0 >Reporter: Gili >Priority: Major > Fix For: 3.x / Backlog > > > I'm not sure which Maven component this bug report belongs to (please > reassign if needed). > This is a follow-up to https://issues.apache.org/jira/browse/SUREFIRE-1369 > To recap: someone (probably Maven core) is redirecting the native stdout > handle when running plugins such as Surefire. This prevents applications from > outputting ANSI colors under Windows 10 because: > * Applications must explicitly enable ANSI support using JNI. > * The JNI calls fail if the stdout handle has been redirected. > If I run the exact same application outside of Maven, JNI no longer detects > that stdout has been redirected and ANSI colors as expected. > Any idea who is doing the redirection, and how to disable it? -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (MNG-6225) Application cannot output ANSI colors when run by Maven
[ https://issues.apache.org/jira/browse/MNG-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16001441#comment-16001441 ] Gili commented on MNG-6225: --- Thanks for asking for a minimal testcase. As painful as it was to try to produce, it helped me figure out the problem. * In order to use native code, one has to point {{java.library.path}} to the directory holding the native library. * There are 3 ways to set this: ** Plugin-specific configuration (e.g. Surefire {{-Djava.library.path=X}}) ** Pass the system properties to the {{mvn}} command-line launcher: {{mvn -Djava.library.path=X goals}} ** Set {{MAVEN_OPTS=-Djava.library.path=X}} prior to running {{mvn}} command-line launcher. I was initially configuring Surefire with {{0}} and setting {{}}. I assumed that adding {{0}} would be enough to transition from a forked processed to a non-forked process, but I was wrong. When the process is not forked, {{}} gets ignored and the system properties of the initial Maven process gets used instead. This seems obvious in hindsight but was not obvious at the moment. I then tried the other two options. It turns out that {{mvn -Dkey=value goals}} is meant for non-JVM system properties (e.g. if the user application wants to read a system property). This leaves us with one option: setting the {{MAVEN_OPTS=-Djava.library.path=X}} environment variable. This worked. As a result, I would like to request two changes: 1. Maven CLI should warn when it is passed a JVM system property since we know these cannot be set this way. 2. Surefire should warn when {{0}} is mixed with {{}} I will file a separate bug report against Surefire for the second point. Are you able to convert this bug report for the first point? > Application cannot output ANSI colors when run by Maven > --- > > Key: MNG-6225 > URL: https://issues.apache.org/jira/browse/MNG-6225 > Project: Maven > Issue Type: Bug > Components: Command Line, core >Affects Versions: 3.5.0 >Reporter: Gili > > I'm not sure which Maven component this bug report belongs to (please > reassign if needed). > This is a follow-up to https://issues.apache.org/jira/browse/SUREFIRE-1369 > To recap: someone (probably Maven core) is redirecting the native stdout > handle when running plugins such as Surefire. This prevents applications from > outputting ANSI colors under Windows 10 because: > * Applications must explicitly enable ANSI support using JNI. > * The JNI calls fail if the stdout handle has been redirected. > If I run the exact same application outside of Maven, JNI no longer detects > that stdout has been redirected and ANSI colors as expected. > Any idea who is doing the redirection, and how to disable it? -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (MNG-6225) Application cannot output ANSI colors when run by Maven
[ https://issues.apache.org/jira/browse/MNG-6225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16001098#comment-16001098 ] Michael Osipov commented on MNG-6225: - A minimal example would be very helpful. > Application cannot output ANSI colors when run by Maven > --- > > Key: MNG-6225 > URL: https://issues.apache.org/jira/browse/MNG-6225 > Project: Maven > Issue Type: Bug > Components: Command Line, core >Affects Versions: 3.5.0 >Reporter: Gili > > I'm not sure which Maven component this bug report belongs to (please > reassign if needed). > This is a follow-up to https://issues.apache.org/jira/browse/SUREFIRE-1369 > To recap: someone (probably Maven core) is redirecting the native stdout > handle when running plugins such as Surefire. This prevents applications from > outputting ANSI colors under Windows 10 because: > * Applications must explicitly enable ANSI support using JNI. > * The JNI calls fail if the stdout handle has been redirected. > If I run the exact same application outside of Maven, JNI no longer detects > that stdout has been redirected and ANSI colors as expected. > Any idea who is doing the redirection, and how to disable it? -- This message was sent by Atlassian JIRA (v6.3.15#6346)