maven常用插件学习

1.git-commit-id-plugin(记录项目构建的版本信息)

<plugin>
    <!-- https://mvnrepository.com/artifact/pl.project13.maven/git-commit-id-plugin -->
    <groupId>pl.project13.maven</groupId>
    <artifactId>git-commit-id-plugin</artifactId>
    <version>2.2.4</version>
    <executions>
        <execution>
            <goals>
                <goal>revision</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <!--日期格式;默认值:dd.MM.yyyy '@' HH:mm:ss z;-->
        <dateFormat>yyyyMMddHHmmss</dateFormat>
        <!--<dateFormatTimeZone>${user.timezone}</dateFormatTimeZone>-->
        <!--,构建过程中,是否打印详细信息;默认值:false;-->
        <verbose>true</verbose>
        <!-- ".git"文件路径;默认值:${project.basedir}/.git; -->
        <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
        <!--若项目打包类型为pom,是否取消构建;默认值:true;-->
        <skipPoms>true</skipPoms>
        <!--是否生成"git.properties"文件;默认值:false;-->
        <!--<generateGitPropertiesFile>true</generateGitPropertiesFile>-->
        <!--默认值:src/main/resources/git.properties)指定生成的属性文件的路径,相对于${project.basedir}来说-->
        <!--<prefix>gitinfo</prefix>-->
        <!--<generateGitPropertiesFilename>src/main/resources/git.properties</generateGitPropertiesFilename>-->
        <generateGitPropertiesFilename>${project.basedir}/target/classes/git.properties</generateGitPropertiesFilename>
        <!--".git"文件夹未找到时,构建是否失败;若设置true,则构建失败;若设置false,则跳过执行该目标;默认值:true;-->
        <failOnNoGitDirectory>true</failOnNoGitDirectory>
        <!--git描述配置,可选;由JGit提供实现;-->
        <gitDescribe>
            <!--是否生成描述属性-->
            <skip>false</skip>
            <!--提交操作未发现tag时,仅打印提交操作ID,-->
            <always>false</always>
            <!--提交操作ID显式字符长度,最大值为:40;默认值:7;
                0代表特殊意义;后面有解释;
            -->
            <abbrev>7</abbrev>
            <!--构建触发时,代码有修改时(即"dirty state"),添加指定后缀;默认值:"";-->
            <dirty>-dirty</dirty>
            <!--always print using the "tag-commits_from_tag-g_commit_id-maybe_dirty" format, even if "on" a tag.
                The distance will always be 0 if you're "on" the tag.
            -->
            <forceLongFormat>false</forceLongFormat>
        </gitDescribe>
    </configuration>
</plugin>

2.maven-assembly-plugin(将项目打包成其他格式.tar....)

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
        <descriptors>
            <descriptor>src/main/assembly/assembly.xml</descriptor>
        </descriptors>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值