Skip to content

Keep a custom @Execute phase instead of resolving it as an enum - #1235

Open
CaptainAni187 wants to merge 1 commit into
apache:masterfrom
CaptainAni187:fix-execute-custom-phase
Open

CaptainAni187 wants to merge 1 commit into
apache:masterfrom
CaptainAni187:fix-execute-custom-phase

Conversation

@CaptainAni187

Copy link
Copy Markdown

Fixes #1232.

ExecuteAnnotationContent.phase(String) already maps a standard phase id or enum name to LifecyclePhase and keeps any other value as customPhase, but its last line then overwrote the result with LifecyclePhase.valueOf(phase). A standard phase returns from the loop before reaching it; any other value threw, so @Execute(phase = "my-phase") and @Execute(phase = "none") failed descriptor extraction with No enum constant ... LifecyclePhase.none.

This removes that leftover line. The extractor already turns customPhase into the descriptor's execute phase, so nothing else needed to change.

Added ExecuteAnnotationContentTest: a standard phase id, an enum constant name, a custom phase and "none". The last two fail on master with the error from the issue.

One thing worth a look: with this change, Maven 4 @Execute(phase = "none") is kept as the custom phase none, while Maven 3 LifecyclePhase.NONE still resolves to the enum, whose id is "". I kept to the fix described in the issue rather than mapping "none" to NONE; happy to add that if you'd prefer.


ExecuteAnnotationContent.phase(String) already matches the value against
LifecyclePhase and keeps anything else as a custom phase, but its last line
then overwrote the result with LifecyclePhase.valueOf(phase). A standard
phase returns from the loop before reaching that line; any other value threw,
so @execute(phase = "my-phase") and @execute(phase = "none") failed
descriptor extraction with "No enum constant LifecyclePhase.none".

Drop the leftover line, which predates the loop added for MPLUGIN-508.

Fixes apache#1232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@Execute with a custom phase or "none" fails descriptor extraction

1 participant