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

前端 未结 6 904
情歌与酒
情歌与酒 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:32

    Working maven configuration for maven 3.6.3

    Code

    MavenCli cli = new MavenCli();
    System.setProperty("maven.multiModuleProjectDirectory", workingDirectory);
    cli.doMain(new String[]{"compile"}, workingDirectory, System.out, System.err);
    

    Dependencies

    
        
            org.apache.maven
            maven-embedder
            3.6.3
        
        
        
            org.apache.maven
            maven-compat
            3.6.3
        
    
        
        
            org.slf4j
            slf4j-simple
            1.7.30
        
    
    

提交回复
热议问题