Warning "'mainClass' configured in 'maven-jar-plugin' is not a valid Java class" appearing since jib 2.3
See original GitHub issueEnvironment:
- Jib version: 2.4
- Build tool: Maven 3.6.3
- OS: Windows
Description of the issue:
Since jib 2.3 the build prints below warning when I use it with Spring Boot application:
[WARNING] 'mainClass' configured in 'maven-jar-plugin' is not a valid Java class: ${start-class}
Still later entry point is correctly inferred which is visible in log:
[INFO] Container entrypoint set to [java, -cp, /app/resources:/app/classes:/app/libs/*, com.example.ExampleApplication]
Expected behavior:
The warning should not be printed, like before jib 2.3.
Additional Information:
I believe this issue was introduced in pr #2457. Looks like it introduced some additional logging, which in this scenario creates odd experience: jib logs warnings about invalid mainClass, but is still able to set it correctly.
It can be seen as Spring Boot issue, as the Spring Boot sets mainClass
in maven-jar-plugin to ${start-class}
. Still, even though the root cause is in Spring Boot, if maven-jar-plugin does not issue such warning, why should jib do it on its behalf. Better yet, (but I do not know anything about Maven internals), jib could try to resolve value of ${start-class}
, which I believe is empty, and issue warning only when that resolved value is invalid.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@chanseokoh : I think you should decide: Either you provide the automatic class detection as a reasonable working default or you require a definition.
The world currently tends to work with reasonable defaults. In this case, if the main class is wrong, it will surely come up in an integration test. If every reasonably default comes with a warning “Hey we assumed this setting. But it is probably wrong.”, I would disable warnings.
So either it works in the end, then don’t warn. Or it doesn’t work. Then break the build.
@loosebazooka @listaction you’ve probably resolved this by now, but I’ll add this comment for future people that may end up on this ticket while browsing for a solution:
Here’s an example: