• maven 内置变量对应目录


    [b]在创建Maven工程后,插件配置中通常会用到一些Maven变量,因此需要找个地方对这些变量进行统一定义,下面介绍如何定义自定义变量。[/b]

    在根节点project下增加properties节点,所有自定义变量均可以定义在此节点内,如下所示:


    <!-- 全局属性配置 -->
    <properties>
    <project.build.name>tools</project.build.name>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    [b]Maven内置变量说明:[/b]
    [list]
    [*]${basedir} 项目根目录
    [*]${project.build.directory} 构建目录,缺省为target
    [*]${project.build.outputDirectory} 构建过程输出目录,缺省为target/classes
    [*]${project.build.finalName} 产出物名称,缺省为${project.artifactId}-${project.version}
    [*]${project.packaging} 打包类型,缺省为jar
    [*]${project.xxx} 当前pom文件的任意节点的内容
    [/list]

     

    pom中对应元素的值。例如${project.artifactId}对应了<project><artifactId>元素的值,常用的POM属性包括:                                     

    ${project.build.sourceDirectory}:项目的主源码目录,默认为src/main/java/.                                                                                                         

     ${project.build.testSourceDirectory}:项目的测试源码目录,默认为/src/test/java/.                                                                                             

      ${project.build.directory}:项目构建输出目录,默认为target/.                                                                                                                               

     ${project.build.outputDirectory}:项目主代码编译输出目录,默认为target/classes/.                                                                                             

     ${project.build.testOutputDirectory}:项目测试代码编译输出目录,默认为target/testclasses/.                                                                              

     ${project.groupId}:项目的groupId.                                                                                                                                                                       

     ${project.artifactId}:项目的artifactId.                                                                                                                                                                    

     ${project.version}:项目的version,于${version}等价                                                                                                                                                

    ${project.build.finalName}:项目打包输出文件的名称,默认为${project.artifactId}${project.version}.

     

  • 相关阅读:
    洛谷 P4114 Qtree1
    洛谷 P2486 [SDOI2011]染色
    洛谷 P1505 [国家集训队]旅游
    洛谷 P4281 [AHOI2008]紧急集合 / 聚会
    C++中main函数的返回值一定要是int
    局部变量作为函数返回值
    sizeof和strlen在string类中的使用
    strlen 和 sizeof 的区别
    数据结构中的堆栈和内存中的堆栈问题
    数据类型的字长,字节问题
  • 原文地址:https://www.cnblogs.com/Andrew520/p/10521546.html
Copyright © 2020-2023  润新知