maven 内置pom属性

内置属性:如 ${basedir} 表示项目根目录 即包含了pom.xml文件的目录 ${version} 表示项目版本

pom属性

  ${project.build.sourcedirectory} : 项目构建输出目录,默认为src/main/java

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

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

  ${project.outputDirectory} :项目测试代码编写输出目录。默认为target/test-calsses

  ${project.groupId} : 项目的groupId

  ${project.artifactId}

  ${project.version}

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

setting属性

 用户使用以setting开头的属性引用setting.xml文件中属性的值

 如:${setting.localRepository} 指向用户本地仓库的地址

java系统属性   可使用 mvn help:system 查看所有java系统属性

  举例 : ${user.home} 指向用户目录,

环境变量属性:可使用 mvn help:system 查看所有java系统属性

  举例:${env.JAVA_HOME} 指代了JAVA_HOME环境变量的值

 

如果不记得这些也没关系,直接打开当前项目pom.xml,使用Effective Pom 模式观看即可。如下图代码显示

<sourceDirectory>E:\workspace\eclipse-maven\account\src\main\java</sourceDirectory>
    <scriptSourceDirectory>E:\workspace\eclipse-maven\account\src\main\scripts</scriptSourceDirectory>
    <testSourceDirectory>E:\workspace\eclipse-maven\account\src\test\java</testSourceDirectory>
    <outputDirectory>E:\workspace\eclipse-maven\account\target\classes</outputDirectory>
    <testOutputDirectory>E:\workspace\eclipse-maven\account\target\test-classes</testOutputDirectory>
    <resources>
      <resource>
        <directory>E:\workspace\eclipse-maven\account\src\main\resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>E:\workspace\eclipse-maven\account\src\test\resources</directory>
      </testResource>
    </testResources>
    <directory>E:\workspace\eclipse-maven\account\target</directory>
    <finalName>account-parent-0.0.1-SNAPSHOT</finalName>

 

  

 

posted @ 2019-04-07 17:47  我看见的世界  阅读(264)  评论(0编辑  收藏  举报