zoukankan      html  css  js  c++  java
  • maven clean插件使用进阶

    maven clean插件使用进阶

    参考

    Maven clean 插件

    Maven删除外部文件

    查看命令帮助

    mvn clean:help

    mvn clean:help -Ddetail=true -Dgoal=clean

    跳过clean和删除指定的文件夹

    <properties>
        <!-- 
    		方式一:跳过clean
    		3.0.0以前的版本属性是clean.skip,之后的属性是maven.clean.skip
    	-->
        <!--<maven.clean.skip>true</maven.clean.skip>-->
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <!-- 方式二:跳过clean -->
                    <skip>true</skip>
                    
                    <filesets>
                        <!-- 删除文件夹generated -->
                        <fileset>
                            <directory>src/main/generated</directory>
                        </fileset>
                        <!-- 删除mozq文件夹中符合条件的,但是不会删除mozq文件夹 -->
                        <fileset>
                                <directory>src/main/mozq</directory>
                                <includes>
                                    <include>*.txt</include>
                                </includes>
                            </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ demo-01 ---
    [INFO] Deleting D:0mozq_pro1shirodemo-01srcmaingenerated (includes = [], excludes = [])
    [INFO] Deleting D:0mozq_pro1shirodemo-01srcmainmozq (includes = [*.txt], excludes = [])
    [INFO] ------------------------------------------------------------------------
    

    帮助

    Maven Clean Plugin
      The Maven Clean Plugin is a plugin that removes files generated at build-time
      in a project's directory.
    
    clean:clean
      Goal which cleans the build.
      This attempts to clean a project's working directory of the files that were
      generated at build-time. By default, it discovers and deletes the directories
      configured in project.build.directory, project.build.outputDirectory,
      project.build.testOutputDirectory, and project.reporting.outputDirectory.
    
      Files outside the default may also be included in the deletion by configuring
      the filesets tag.
    
      Available parameters:
    
        excludeDefaultDirectories (Default: false)
          Disables the deletion of the default output directories configured for a
          project. If set to true, only the files/directories selected via the
          parameter filesets will be deleted.
          Expression: ${clean.excludeDefaultDirectories}
    
        failOnError (Default: true)
          Indicates whether the build will continue even if there are clean errors.
          Expression: ${maven.clean.failOnError}
    
        filesets
          The list of file sets to delete, in addition to the default directories.
          For example:
          <filesets>
            <fileset>
              <directory>src/main/generated</directory>
              <followSymlinks>false</followSymlinks>
              <useDefaultExcludes>true</useDefaultExcludes>
              <includes>
                <include>*.java</include>
              </includes>
              <excludes>
                <exclude>Template*</exclude>
              </excludes>
            </fileset>
          </filesets>
    
        followSymLinks (Default: false)
          Sets whether the plugin should follow symbolic links while deleting files
          from the default output directories of the project. Not following symlinks
          requires more IO operations and heap memory, regardless whether symlinks
          are actually present. So projects with a huge output directory that
          knowingly does not contain symlinks can improve performance by setting
          this parameter to true.
          Expression: ${clean.followSymLinks}
    
        retryOnError (Default: true)
          Indicates whether the plugin should undertake additional attempts (after a
          short delay) to delete a file if the first attempt failed. This is meant
          to help deleting files that are temporarily locked by third-party tools
          like virus scanners or search indexing.
          Expression: ${maven.clean.retryOnError}
    
        skip (Default: false)
          Disables the plugin execution.
          Expression: ${clean.skip}
    
        verbose
          Sets whether the plugin runs in verbose mode. As of plugin version 2.3,
          the default value is derived from Maven's global debug flag (compare
          command line switch -X).
          Expression: ${clean.verbose}
    
  • 相关阅读:
    【BZOJ1001】狼抓兔子(网络流)
    【BZOJ4554】游戏(二分图匹配,网络流)
    【BZOJ3993】星际战争(网络流,二分答案)
    【BZOJ3140】消毒(二分图匹配)
    【Luogu1393】动态逆序对(CDQ分治)
    【BZOJ3295】动态逆序对(线段树,树状数组)
    【BZOJ1305】跳舞(网络流)
    【BZOJ1934】善意的投票(网络流)
    【BZOJ3932】任务查询系统(主席树)
    【BZOJ3123】森林(主席树,启发式合并)
  • 原文地址:https://www.cnblogs.com/mozq/p/12007092.html
Copyright © 2011-2022 走看看