apache / apache/maven-shade-plugin

[MSHADE-460] Cannot find default constructor of record

Open
#672 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
188
Forks
103
Avg merge
16h 39m
Merged PRs (30d)
4

Description

**[Markus Karg](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mkarg)** opened **[MSHADE-460](https://issues.apache.org/jira/browse/MSHADE-460?redirect=false)** and commented

I have setup up a small demo project which uses JSONB to deserialize JSON into a Java record. The created JAR works fine when using java -cp with the full class-path as shown by mvn dependency:build-classpath. As soon as I am building an uberjar using the Maven Shade Plugin, at runtime I end up with an exception like "Cannot create instance of a class: class eu.headcrashing.jaxrsdoneright.sebootstrap.HelloWorld$TimeInfo, No default constructor found". I already replaced the contained record class file, but the result is the same. As it seems, besides merging services descriptors, there seems to be some more resource type to get merge – but which?! Possibly there is just something missing in the plugin's docs, possible we actually need to invent a new type of transformer.

(BTW, minimizeJar is false, and it works once using a class instead of a record)

---

**Affects:** 3.5.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported difference between the full class path and an uberjar with the described Java record demo. Read the Maven Shade Plugin's handling of resource transformers and service descriptors, then determine whether the result calls for documentation or a new transformer. Done means the record deserializes correctly from the shaded JAR, with the required behavior documented or covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.