assertj-assertions-generator-maven-plugin icon indicating copy to clipboard operation
assertj-assertions-generator-maven-plugin copied to clipboard

allow the jakarta version of `@Generated` instead of the javax one.

Open Zegveld opened this issue 3 years ago • 2 comments

all javax modules are being replaced with jakarta, this includes @javax.annotation.Generated. This is replaced by @jakarta.annotation.Generated, allow users to choose which annotation they want on the generated classes.

(Related to https://github.com/assertj/assertj-assertions-generator/issues/194 ) (I'm also making a PR for this one)

Zegveld avatar Jan 14 '22 13:01 Zegveld

Yes, this is very important, the tests are broken when migrating to Spring Boot 3 because of this annotation.

Is there a new version of the plugin probably? Version 2.2.0 was released at March 2019 (see mvn repo) 😱 🙀

dmitry-weirdo avatar Jan 11 '23 13:01 dmitry-weirdo

As a workaround for the current plugin version 2.2.0, I overrode the following templates in the plugin configuration,

The template files are taken from here, and just replaced @javax.annotation.Generated(value="assertj-assertions-generator") with @jakarta.annotation.Generated(value="assertj-assertions-generator")

                    <templates>
                        <!-- specify the base directory where to look for templates -->
                        <!-- !!! No file separator at the end, else it will still silently take the default templates -->
                        <templatesDirectory>${project.basedir}/src/test/resources/assertj/templates</templatesDirectory>

                        <assertionClass>_ins_custom_assertion_class_template.txt</assertionClass>
                        <softEntryPointAssertionClass>_ins_soft_assertions_entry_point_class_template.txt</softEntryPointAssertionClass>
                        <junitSoftEntryPointAssertionClass>_ins_junit_soft_assertions_entry_point_class_template.txt</junitSoftEntryPointAssertionClass>
                        <bddEntryPointAssertionClass>_ins_bdd_assertions_entry_point_class_template.txt</bddEntryPointAssertionClass>
                        <assertionsEntryPointClass>_ins_standard_assertions_entry_point_class_template.txt</assertionsEntryPointClass>
                    </templates>

dmitry-weirdo avatar Jan 11 '23 16:01 dmitry-weirdo