[ 
https://issues.apache.org/jira/browse/MNG-6239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240695#comment-17240695
 ] 

Michael Osipov commented on MNG-6239:
-------------------------------------

This seems to work, but not as expected:
{noformat}
mosipov@bsd1srv:/usr/home/mosipov/var/Projekte/maven/apache-maven/target/mvn-jansi
 (MNG-7028<>)
$ ../apache-maven-4.0.0-alpha-1-SNAPSHOT/bin/mvn  exec:exec -V -q
Apache Maven 4.0.0-alpha-1-SNAPSHOT (2777a9957671b85d9d5911389c8d803033a8ade9)
Maven home: 
/usr/home/mosipov/var/Projekte/maven/apache-maven/target/apache-maven-4.0.0-alpha-1-SNAPSHOT
Java version: 1.8.0_275, vendor: OpenJDK BSD Porting Team, runtime: 
/usr/local/openjdk8/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "freebsd", version: "12.2-stable", arch: "amd64", family: "unix"
err.printlnout.println

err.printout.printerr.printfout.printf
{noformat}

I do now have the second line before the enter, but a newline is missing after 
{{err.println}}.

This one looks different:
{noformat}
$ ../apache-maven-4.0.0-alpha-1-SNAPSHOT/bin/mvn  exec:exec  -q
out.println
err.println
err.printerr.printfout.printout.printf
{noformat}

as well as
{noformat}
$ ../apache-maven-4.0.0-alpha-1-SNAPSHOT/bin/mvn  exec:exec
[INFO] Scanning for projects...
[INFO] Maven detected that the requested POM file is part of a multi module 
project, but could not find a pom.xml file in the multi module root directory: 
'/var/mosipov/Projekte/maven/apache-maven/target'.
[INFO] The reactor is limited to all projects under: 
/var/mosipov/Projekte/maven/apache-maven/target/mvn-jansi
[INFO]
[INFO] ------------------< org.apache.maven.jansi:mvn-jansi >------------------
[INFO] Building mvn-jansi 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) @ mvn-jansi ---
err.printlnout.println

err.printerr.printfout.printout.printf
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.780 s
[INFO] Finished at: 2020-11-30T12:35:08+01:00
[INFO] ------------------------------------------------------------------------
{noformat}

I guess SLF4J Simple is interfering here. Sometimes the output is correct:
{noformat}
$ ../apache-maven-4.0.0-alpha-1-SNAPSHOT/bin/mvn  exec:exec
[INFO] Scanning for projects...
[INFO] Maven detected that the requested POM file is part of a multi module 
project, but could not find a pom.xml file in the multi module root directory: 
'/var/mosipov/Projekte/maven/apache-maven/target'.
[INFO] The reactor is limited to all projects under: 
/var/mosipov/Projekte/maven/apache-maven/target/mvn-jansi
[INFO]
[INFO] ------------------< org.apache.maven.jansi:mvn-jansi >------------------
[INFO] Building mvn-jansi 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) @ mvn-jansi ---
err.println
out.println
err.printerr.printfout.printout.printf
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.556 s
[INFO] Finished at: 2020-11-30T12:37:00+01:00
{noformat}

> jansi messes up System.err and System.out
> -----------------------------------------
>
>                 Key: MNG-6239
>                 URL: https://issues.apache.org/jira/browse/MNG-6239
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0
>         Environment: Java 1.8.0_131, Ubuntu 17.04
>            Reporter: Simone Bordet
>            Priority: Minor
>         Attachments: mvn-jansi.tgz
>
>
> I use the Maven Exec Plugin to run a class that asks for interactive input 
> from the user. This was working in 3.3.9, but does not work in 3.5.0.
> Anything printed on {{System.err}} or {{System.out}} without a newline is not 
> printed immediately on the terminal window.
> Example:
> {code:java}
> BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
> System.err.printf("listen port: ");
> String value = console.readLine().trim();
> {code}
> The example above would not print {{listen port:}} on the terminal.
> Attached you can find a project that reproduces this issue.
> Unpack the project and then run:
> {noformat}
> $ mvn install && mvn exec:exec
> {noformat}
> The expected output of the reproducer would be:
> {noformat}
> err.println
> out.println
> err.printerr.printfout.printout.printf
> {noformat}
> instead I get:
> {noformat}
> err.println
> out.println
> {noformat}
> Removing {{jansi-1.13.jar}} from {{$MAVEN/lib/}} fixes the issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to