V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zuicaidenage
V2EX  ›  Java

maven 的一个小问题请教一下

  •  
  •   zuicaidenage · 2018-05-09 15:43:27 +08:00 · 2182 次点击
    这是一个创建于 2389 天前的主题,其中的信息可能已经有所发展或是发生改变。

    在网上看 maven 教程时,学习了构建生命周期,然后按教程给 clean 生命周期的 pre-clean、clean、post-clean 三个阶段绑定了 maven-antrun-plugin 插件来输出信息,然而执行 mvn post-clean 只有 clean 阶段才有输出,不明白是哪里出了问题。

    附配置文件

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
       http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.companyname.projectgroup</groupId>
        <artifactId>project</artifactId>
        <version>1.0</version>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                        <execution>
                            <id>pre-clean-echo</id>
                            <phase>pre-clean</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <tasks>
                                    <echo>pre-clean phase</echo>
                                </tasks>
                            </configuration>
                        </execution>
                        <execution>
                            <id>clean-echo</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <tasks>
                                    <echo>clean phase</echo>
                                </tasks>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-clean-echo</id>
                            <phase>post-clean</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <tasks>
                                    <echo>post-clean phase</echo>
                                </tasks>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>
    

    mvn post-clean 输出如下

    D:\other>mvn post-clean
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ----------------< com.companyname.projectgroup:project >----------------
    [INFO] Building project 1.0
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ project ---
    [INFO]
    [INFO] --- maven-antrun-plugin:1.1:run (id.clean) @ project ---
    [INFO] Executing tasks
         [echo] clean phase
    [INFO] Executed tasks
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.652 s
    [INFO] Finished at: 2018-05-09T15:39:00+08:00
    [INFO] ------------------------------------------------------------------------
    
    1 条回复    2018-05-09 16:00:00 +08:00
    kassadin
        1
    kassadin  
       2018-05-09 16:00:00 +08:00
    配置没问题,找找环境上的问题吧。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5076 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:35 · PVG 17:35 · LAX 01:35 · JFK 04:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.