Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void executeGoals(
targetGoals.add(additionalArguments);
}

req.setGoals(targetGoals);
req.addArgs(targetGoals);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.


try {
InvocationResult invocationResult = invoker.execute(req);
Expand Down