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

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

    Dependency list for Maven Embedded 3.6.3 version that works in my Spring Boot 2.3 project (JDK8 or JDK 11 runtime):

        
        
            org.apache.maven
            maven-embedder
            3.6.3
        
        
            org.apache.maven
            maven-compat
            3.6.3
        
        
            org.apache.maven.wagon
            wagon-http
            3.3.4
        
        
            org.eclipse.aether
            aether-connector-basic
            1.1.0
            runtime
        
        
            org.eclipse.aether
            aether-transport-wagon
            1.1.0
            runtime
        
        
            org.slf4j
            slf4j-simple
            1.7.30
        
        
            org.usefultoys
            slf4j-toys
            1.6.3
        
    

    The Maven CLI command looks like to:

        // Maven CLI to execute Maven Commands
        MavenCli cli = new MavenCli();
        int result = cli.doMain(args, workingDirectory,
                        org.usefultoys.slf4j.LoggerFactory.getInfoPrintStream(LOGGER),
                        org.usefultoys.slf4j.LoggerFactory.getErrorPrintStream(LOGGER));
    

    HTH

提交回复
热议问题