Can anyone give a good example of using org.apache.maven.cli.MavenCli programmatically?

前端 未结 6 914
情歌与酒
情歌与酒 2020-12-04 17:03

I\'m trying to create an intelliJ plugin that needs to execute maven targets on the current project. All the talk in the intertubes recommends using the MavenEmbedder. Goo

6条回答
  •  孤城傲影
    2020-12-04 17:49

    Yeah, the's not much in the way of documentation of MavenCli. The API is significatly simpler but i'd still like some examples. Here's one that works...

    MavenCli cli = new MavenCli();
    int result = cli.doMain(new String[]{"compile"},
            "/home/aioffe/workspace/MiscMaven",
            System.out, System.out);
    System.out.println("result: " + result);
    

    It takes a dir and runs the 'compile' phase...

提交回复
热议问题