Extract output dir preparation to separate goal - #20
Merged
Merged
Conversation
The reason being that the record analyzing for code generation is based on reflection, i.e. actually loading the classes to figure out how to generate corresponding Matchers, and for IDEs able to integrate plugin executions as part of their integral build processes, will typically execute within the runtime JVM of the IDE, which may be incompatible (i.e. earlier version) than the compilation target of the records to load. But creating the output directory and adding it as a test source folder is still desireable to happen within the build of the IDE, so doing this as a separate goal makes the IDE "discover" the output directory automatically. The generate goal will inform about this change if the output directory has not been created, and suggest adding the goal to the plugin execution configuration.
Allows the use of the generate goal without requiring the prepare-output-directory goal, but if the directory does not exist, emits a warning about the dir will not be included as test sources. This will allow to try the plugin with the single goal to generate matchers and manually include the folder in your IDE, and when configured properly in the POM with both goals, it will still be applicable to only run the single generate goal to update the generated matchers when needed.
Owner
Author
|
This closes #13 |
1 of 2 tasks
runeflobakk
added a commit
to runeflobakk/myconfig
that referenced
this pull request
Mar 15, 2026
Not necessary anymore, handled by the plugin itself runeflobakk/record-matcher#20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The intention is to enable a more streamlined integration with IDEs which support incorporating Maven plugin goals as an integral part of the IDE's internal project building process (e.g. Eclipse).
The
prepare-output-directorygoal will create (if necessary) the output directory for the generated matchers, as well as add this directory to the project's test sources, which will include them in the regular test compilation. This goal is also automatically run within IDEs which supportlifecycle-mapping-metadata.xml. Thegenerategoal is now excluded in this file.To properly configure the plugin in your build, it is now required to specify both goals:
It is still applicable to run only the
generatein order to manually update the generated matchers to reflect your records. But running a full build will now require theprepare-output-directorygoal to be configured to have this directory to be included as a test compilation source directory.This fixes #18 by avoiding the matcher generation in IDE (Eclipse) altogether.