How to echo in Maven without Antrun plugin?

后端 未结 4 713
攒了一身酷
攒了一身酷 2021-02-13 16:22

How can I print to the console while executing a mvn command (in a phase/goal), but not using Maven Antrun plugin?

Why I reject Antrun solutions:

  • The over
4条回答
  •  情歌与酒
    2021-02-13 17:01

    You can use Björn Ekryd's Echo Maven Plugin, which is published in Maven Central.

    It has a normal amount of XML required for a Maven plugin, the output is formatted like the other Maven log lines, and you can assign a severity level to your message (default is INFO).

    
        com.github.ekryd.echo-maven-plugin
        echo-maven-plugin
        1.2.0
        
            
                package
                
                    echo
                
                
                    war has changed
                    INFO
                
            
        
    
    

    [INFO] --- maven-war-plugin:2.4:war (default-war) @ mymodule ---
    [INFO] Packaging webapp
    [INFO] Processing war project
    [INFO]
    [INFO] --- echo-maven-plugin:1.2.0:echo (default) @ mymodule ---
    [INFO] war has changed
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    

    Also, this plugin has 95% code coverage, which is pretty cool.

提交回复
热议问题