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}.

 

 

上一篇:怒改springMVC项目为springBoot项目


下一篇:开发对应的登录拦截器以及拦截器注册和路径校验配置