Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing argument for option -D #662

Closed
walnut-tom opened this issue Jul 1, 2022 · 5 comments
Closed

Missing argument for option -D #662

walnut-tom opened this issue Jul 1, 2022 · 5 comments
Milestone

Comments

@walnut-tom
Copy link

$mvn -D aaa=aaa -version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /usr/local/Cellar/maven/3.8.6/libexec
Java version: 1.8.0_312, vendor: Amazon.com Inc., runtime: /Users/user/Library/Java/JavaVirtualMachines/corretto-1.8.0_312/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "12.4", arch: "x86_64", family: "mac"

$mvnd -D aaa=aaa -version
Exception in thread "main" java.lang.IllegalArgumentException: Missing argument for option -D
at org.mvndaemon.mvnd.client.DefaultClient.setSystemPropertiesFromCommandLine(DefaultClient.java:146)
at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:106)

walnut-tom pushed a commit to walnut-tom/maven-mvnd that referenced this issue Jul 2, 2022
@nandorholozsnyak
Copy link

Same here, but I'm glad there is already an open issue for that with a "fix" too :)

@cstamas
Copy link
Member

cstamas commented Jul 7, 2022

True with -D aaa=aaa but works OK without space, with -Daaa=aaa

@cstamas
Copy link
Member

cstamas commented Jul 7, 2022

And the -D is "inspired" by Java -D and is defined without space as well. I never used the form with space actually 😄

@nandorholozsnyak
Copy link

Yes true it works without space with -D, and it works with this format too --define=property=value but if it really wants to support the Maven based properties then it should be working with the space too. :D

@walnut-tom
Copy link
Author

walnut-tom commented Jul 7, 2022

use mvn command, I never used the form with space actually too.

but I use org.apache.maven.shared:maven-invoker:3.2.0 invoke maven/mvnd like this:

public class InvokerListClass {

    public static void main(String[] args) throws MavenInvocationException {
        Invoker invoker = new DefaultInvoker();
        invoker.setMavenHome(new File("/Users/xxx/maven-mvnd-0.8.0-darwin-amd64"));
        invoker.setMavenExecutable(new File("mvnd"));
        final InvocationRequest invocationRequest = new DefaultInvocationRequest();
        Properties properties = new Properties();
        properties.setProperty("artifact", "com.h2database:h2:1.4.200");
        invocationRequest.setProperties(properties);
        invocationRequest.setGoals(Collections.singletonList("org.apache.maven.plugins:maven-dependency-plugin:3.2.0:list-classes"));
        invoker.execute(invocationRequest);
    }
}

@gnodet gnodet added this to the 0.8.1 milestone Aug 29, 2022
gnodet pushed a commit to gnodet/mvnd that referenced this issue Aug 30, 2022
@gnodet gnodet closed this as completed in 449e815 Aug 30, 2022
gnodet pushed a commit to gnodet/mvnd that referenced this issue Aug 30, 2022
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

No branches or pull requests

4 participants