fusesource / jansi

Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows.
http://fusesource.github.io/jansi/
Apache License 2.0
1.11k stars 140 forks source link

Maven causes exception if JANSI current git head is used. #180

Closed tyan0 closed 3 years ago

tyan0 commented 3 years ago

Overview

After commit 8c681e900758716824152242fd881a20645b6bd3 and 63bd892b2bdfc253ec119a57bdd42df5e80fd859, Maven causes exception just before it stops. Is this a problem of Maven side?

How to reproduce

  1. Install Maven 3.6.3.
  2. Replace JANSI with 2.0.2-SNAPSHOT (current git head).
  3. Run mvn with any command such as compile, package or install.

Error message

The following message is shown after execution of Maven. If commit 8c681e900758716824152242fd881a20645b6bd3 and 63bd892b2bdfc253ec119a57bdd42df5e80fd859 are reverted, this does not occur.

---------------------------------------------------
constituent[0]: file:/home/user/apache-maven-3.6.3/conf/logging/
constituent[1]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-spi-1.4.1.jar
constituent[2]: file:/home/user/apache-maven-3.6.3/lib/maven-repository-metadata-3.6.3.jar
constituent[3]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-api-1.4.1.jar
constituent[4]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-provider-3.6.3.jar
constituent[5]: file:/home/user/apache-maven-3.6.3/lib/commons-io-2.5.jar
constituent[6]: file:/home/user/apache-maven-3.6.3/lib/jcl-over-slf4j-1.7.29.jar
constituent[7]: file:/home/user/apache-maven-3.6.3/lib/plexus-component-annotations-2.1.0.jar
constituent[8]: file:/home/user/apache-maven-3.6.3/lib/maven-model-3.6.3.jar
constituent[9]: file:/home/user/apache-maven-3.6.3/lib/maven-shared-utils-3.2.1.jar
constituent[10]: file:/home/user/apache-maven-3.6.3/lib/maven-settings-builder-3.6.3.jar
constituent[11]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-impl-1.4.1.jar
constituent[12]: file:/home/user/apache-maven-3.6.3/lib/plexus-cipher-1.7.jar
constituent[13]: file:/home/user/apache-maven-3.6.3/lib/maven-compat-3.6.3.jar
constituent[14]: file:/home/user/apache-maven-3.6.3/lib/wagon-http-3.3.4-shaded.jar
constituent[15]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-transport-wagon-1.4.1.jar
constituent[16]: file:/home/user/apache-maven-3.6.3/lib/org.eclipse.sisu.inject-0.3.4.jar
constituent[17]: file:/home/user/apache-maven-3.6.3/lib/maven-settings-3.6.3.jar
constituent[18]: file:/home/user/apache-maven-3.6.3/lib/guava-25.1-android.jar
constituent[19]: file:/home/user/apache-maven-3.6.3/lib/maven-artifact-3.6.3.jar
constituent[20]: file:/home/user/apache-maven-3.6.3/lib/commons-lang3-3.8.1.jar
constituent[21]: file:/home/user/apache-maven-3.6.3/lib/maven-model-builder-3.6.3.jar
constituent[22]: file:/home/user/apache-maven-3.6.3/lib/jansi-2.0.2-SNAPSHOT.jar
constituent[23]: file:/home/user/apache-maven-3.6.3/lib/guice-4.2.1-no_aop.jar
constituent[24]: file:/home/user/apache-maven-3.6.3/lib/maven-slf4j-provider-3.6.3.jar
constituent[25]: file:/home/user/apache-maven-3.6.3/lib/maven-core-3.6.3.jar
constituent[26]: file:/home/user/apache-maven-3.6.3/lib/plexus-interpolation-1.25.jar
constituent[27]: file:/home/user/apache-maven-3.6.3/lib/maven-embedder-3.6.3.jar
constituent[28]: file:/home/user/apache-maven-3.6.3/lib/wagon-provider-api-3.3.4.jar
constituent[29]: file:/home/user/apache-maven-3.6.3/lib/commons-cli-1.4.jar
constituent[30]: file:/home/user/apache-maven-3.6.3/lib/wagon-file-3.3.4.jar
constituent[31]: file:/home/user/apache-maven-3.6.3/lib/plexus-utils-3.2.1.jar
constituent[32]: file:/home/user/apache-maven-3.6.3/lib/maven-plugin-api-3.6.3.jar
constituent[33]: file:/home/user/apache-maven-3.6.3/lib/jsoup-1.12.1.jar
constituent[34]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-util-1.4.1.jar
constituent[35]: file:/home/user/apache-maven-3.6.3/lib/plexus-sec-dispatcher-1.4.jar
constituent[36]: file:/home/user/apache-maven-3.6.3/lib/cdi-api-1.0.jar
constituent[37]: file:/home/user/apache-maven-3.6.3/lib/jsr250-api-1.0.jar
constituent[38]: file:/home/user/apache-maven-3.6.3/lib/javax.inject-1.jar
constituent[39]: file:/home/user/apache-maven-3.6.3/lib/maven-builder-support-3.6.3.jar
constituent[40]: file:/home/user/apache-maven-3.6.3/lib/slf4j-api-1.7.29.jar
constituent[41]: file:/home/user/apache-maven-3.6.3/lib/maven-resolver-connector-basic-1.4.1.jar
constituent[42]: file:/home/user/apache-maven-3.6.3/lib/org.eclipse.sisu.plexus-0.3.4.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoSuchFieldError: out
        at org.apache.maven.shared.utils.logging.MessageUtils.systemUninstall(MessageUtils.java:85)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

The cause

The exception causes at here. I'm not sure why. out seems to be public in AnsiConsole class.

tyan0 commented 3 years ago

It seems that the cause is the type mismatch of out between jansi 2.0.2-SNAPSHOT (git head) and older jansi with which maven-shared-utils was built. The issue has been resolved by re-building maven-shared-utils with jansi 2.0.2-SNAPSHOT.

Sorry for the noise.