gnodet commented on code in PR #11926:
URL: https://github.com/apache/maven/pull/11926#discussion_r3284330119
##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java:
##########
@@ -99,6 +99,34 @@ public class DefaultModelValidator implements ModelValidator
{
private static final String EMPTY = "";
+ private static final Set<String> LIFECYCLE_PHASES = Set.of(
+ "clean",
+ "validate",
+ "initialize",
+ "generate-sources",
+ "process-sources",
+ "generate-resources",
+ "process-resources",
+ "compile",
+ "process-classes",
+ "generate-test-sources",
+ "process-test-sources",
+ "generate-test-resources",
+ "process-test-resources",
+ "test-compile",
+ "process-test-classes",
+ "test",
+ "prepare-package",
+ "package",
+ "pre-integration-test",
+ "integration-test",
+ "post-integration-test",
+ "verify",
+ "install",
+ "deploy",
+ "site",
Review Comment:
This hardcoded set duplicates phase names that are already defined as
constants in `org.apache.maven.api.Lifecycle.Phase` (in `maven-api-core`, which
is a dependency of this module). It also mixes Maven 3 legacy phase names (e.g.
`generate-sources`, `process-sources`, `process-classes`, `prepare-package`,
`pre-integration-test`, `post-integration-test`, `site-deploy`) with the
standard ones, while missing Maven 4 phases like `all`, `each`, `build`,
`sources`, `resources`, `ready`, and `unit-test`.
Please build this set from the existing `Lifecycle.Phase` constants instead
of duplicating strings. For example:
```suggestion
private static final Set<String> LIFECYCLE_PHASES = Set.of(
Lifecycle.Phase.ALL,
Lifecycle.Phase.EACH,
Lifecycle.Phase.BUILD,
Lifecycle.Phase.INITIALIZE,
Lifecycle.Phase.VALIDATE,
Lifecycle.Phase.SOURCES,
Lifecycle.Phase.RESOURCES,
Lifecycle.Phase.COMPILE,
Lifecycle.Phase.READY,
Lifecycle.Phase.PACKAGE,
Lifecycle.Phase.VERIFY,
Lifecycle.Phase.UNIT_TEST,
Lifecycle.Phase.TEST_SOURCES,
Lifecycle.Phase.TEST_RESOURCES,
Lifecycle.Phase.TEST_COMPILE,
Lifecycle.Phase.TEST,
Lifecycle.Phase.INTEGRATION_TEST,
Lifecycle.Phase.INSTALL,
Lifecycle.Phase.DEPLOY,
Lifecycle.Phase.CLEAN,
Lifecycle.SITE);
```
You may also want to include the legacy Maven 3 aliases (via
`Lifecycle.aliases()`) if the goal is to catch those as well, but at minimum
the canonical names should come from the constants.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]