Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jansi does not work when running application with gradle run #283

Open
tauinger-de opened this issue Feb 21, 2024 · 2 comments
Open

Jansi does not work when running application with gradle run #283

tauinger-de opened this issue Feb 21, 2024 · 2 comments

Comments

@tauinger-de
Copy link

I wrote a tiny Java application and run it through Gradle 8.5 but there is no colored output.

it works when running in Intellij with flag -Djansi.passthrough=true.

Adding the same flag to Gradle doesn't make a difference (gradle -Djansi.passthrough=true clean run)

@tauinger-de
Copy link
Author

tauinger-de commented Feb 22, 2024

I could get it to work by adding (thanks to chatgpt)

application {
    applicationDefaultJvmArgs = ["-Djansi.passthrough=true"]
}

@tkslaw
Copy link

tkslaw commented Apr 21, 2024

I could get it to work by adding (thanks to chatgpt)

application {
    applicationDefaultJvmArgs = ["-Djansi.passthrough=true"]
}

Thank you for that solution. And if you want a narrower scope, you can instead just configure the run task:

tasks {
    named<JavaExec>("run") {
        systemProperty("jansi.passthrough", "true")
    }
}

- Kotlin DSL

Though note JANSI_PASSTHROUGH is deprecated in favor of JANSI_MODE. So, it would probably be better to use:

applicationDefaultJvmArgs = listOf("-Djansi.mode=force")

- Kotlin DSL

Or:

systemProperty("jansi.mode", "force")

- Kotlin DSL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants