Maven的默认构建配置文件 [英] Default build profile for Maven

查看:81
本文介绍了Maven的默认构建配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将概要分析添加到我的Maven项目中.

I have added profiling to my Maven project.

        <profile>
            <id>da</id>                
        </profile>
        <profile>
            <id>live</id>
        </profile>
        <profile>
            <id>dev</id>
        </profile>

当我输入命令mvn clean install而不指定构建配置文件时.我需要默认情况下构建 dev 配置文件.

When I give the command mvn clean install without specifying the build profile. I need the dev profile to be build by default.

我该如何实现?

推荐答案

如果没有使用-P参数选择其他配置文件,则使用属性activeByDefault,您将能够在Maven中选择默认配置文件.

By using the attribute activeByDefault you will be able to select a default profile in Maven when no other profile is selected with the -P parameter.

<profiles>
    <profile>
        <id>da</id>                
    </profile>
    <profile>
        <id>live</id>
    </profile>
    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
    </profile>
<profiles>

请参见 Maven个人资料简介文档

这篇关于Maven的默认构建配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆