jboss-logging i18n not working with gradle #38436
-
Describe the bugI want to use localized messages for the exceptions and logging. Since jboss-logging is already included in Quarkus it's perfectly fits my requirements. I used this documentation. I created an empty Quarkus project from the starter and additionaly added this dependency in gradle.build file:
Expected behaviorLocalized message is successfully printed to the concole Actual behaviorI'm getting exceptions:
How to Reproduce?
Output of
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
/cc @glefloch, @quarkusio/devtools |
Beta Was this translation helpful? Give feedback.
-
Take a look at how it is done here (Maven): https://github.com/quarkiverse/quarkus-ironjacamar/blob/main/runtime/pom.xml#L75 |
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply, do you have a working example with Gradle? Because, as I mentioned early, I don't have problems with Maven, it works fine for me. |
Beta Was this translation helpful? Give feedback.
-
To configure the Here is how you can do it: dependencies {
// other dependencies...
annotationProcessor 'org.jboss.logging:jboss-logging:3.5.3.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-processor:2.2.1.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-annotations:2.2.1.Final'
} This will ensure that the annotation processor is included in the classpath during the compile phase. Here is my plugins {
id 'java'
id 'io.quarkus'
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-arc'
implementation 'io.quarkus:quarkus-resteasy-reactive'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
annotationProcessor 'org.jboss.logging:jboss-logging:3.5.3.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-processor:2.2.1.Final'
annotationProcessor 'org.jboss.logging:jboss-logging-annotations:2.2.1.Final'
}
group 'org.acme'
version '1.0.0-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
test {
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
}
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
}
compileTestJava {
options.encoding = 'UTF-8'
} |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your reply! It works now, but, unfortunately, only with the default locale. I can't figure out where should I put translation files so the jboss logger catch them and compile locale specific implementations. I tried to place them in the package, where the interfaces are located (like it's suggested in the docs) and in the resources with the full package path ( |
Beta Was this translation helpful? Give feedback.
-
I think I've found a solution, but I'm not sure if it's a correct one. I created a
then made a
After that locale specific implementations have been successfully generated |
Beta Was this translation helpful? Give feedback.
-
/cc @glefloch, @quarkusio/devtools |
Beta Was this translation helpful? Give feedback.
-
I'm attaching a working solution (just for the history): |
Beta Was this translation helpful? Give feedback.
To configure the
jboss-logging-processor
annotation processor in Gradle, you need to add it to theannotationProcessor
configuration in yourdependencies
block. This will ensure that the annotation processor is run during the compile phase of your build.Here is how you can do it:
This will ensure that the annotation processor is included in the classpath during the compile phase.
Here is my
build.gradle
file:plugins…