Skip to content

Conversation

@elharo
Copy link
Contributor

@elharo elharo commented Nov 28, 2025

No description provided.

@elharo elharo marked this pull request as ready for review November 28, 2025 19:53
}

req.setGoals(targetGoals);
req.addArgs(targetGoals);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a good idea. Each argument passed to setGoals are internal parsed, escaped and so on ...
but addArgs pass arguments as is to command line process

look at line 113 additionalArguments is add as one item to list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what the deprecation message says:

  /**
     * Sets the goals for the Maven invocation.
     *
     * @param goals The goals for the Maven invocation, may be <code>null</code> to execute the POMs default goal.
     * @return This invocation request.
     * @deprecated simply {@link #addArg(String)} or {@link #addArgs(Collection)} should be used
     */

Is that wrong then? Should this method be undeprecated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is correctly deprecated ... but when we use new method we need new parameters where user set each command line argument separately

Parsing, escaping arguments are allwaye error prone, so we should required from users to provided it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, don't reinvent the wheel you will fail.

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.

3 participants