Skip to content

fix: warn if deprecated configs are used#8366

Open
jeremylong wants to merge 1 commit intomainfrom
scratch/warnings
Open

fix: warn if deprecated configs are used#8366
jeremylong wants to merge 1 commit intomainfrom
scratch/warnings

Conversation

@jeremylong
Copy link
Collaborator

For Ant and the CLI - warn if deprecated configuration settings are used. I would have done this for Maven also, but due to the use of "alias" it is more difficult.

@boring-cyborg boring-cyborg bot added ant changes to ant cli changes to the cli labels Mar 15, 2026
@marcelstoer
Copy link
Collaborator

marcelstoer commented Mar 16, 2026

👍 If we expect the logging code to live longer, you could extract a helper function. The logging message follows a pattern (DRY).

As for Maven, we could check the MojoExecution configuration.

@Parameter(defaultValue = "${mojoExecution}", readonly = true)
private MojoExecution mojoExecution;

private void warnIfDeprecatedParamUsed(String deprecatedName, String currentName) {
    mojoExecution.getConfiguration()
        .getChildren()
        .stream()
        .filter(child -> deprecatedName.equals(child.getName()))
        .findFirst()
        .ifPresent(c -> getLog().warn("..."));
}

// invoke warnIfDeprecatedParamUsed() for each pair or maybe use reflection to find all aliased @Parameter annotation?

Or check the Maven session

@Parameter(defaultValue = "${session}", readonly = true)
private MavenSession session;

...
// session.getUserProperties() or session.getCurrentProject().getProperties()

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

Labels

ant changes to ant cli changes to the cli

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants