How to create user defined properties in Maven
来源:互联网 发布:乐秀软件下载 编辑:程序博客网 时间:2024/06/05 01:15
How to create user defined properties in Maven
Custom properties or variables are useful to keep your Maven pom.xml
file more easy to read and maintain.
File : pom.xml
<project>... <properties> <my.plugin.version>1.5</my.plugin.version> </properties>...</project>
In above pom.xml
, you can refer “my.plugin.version” via code ${my.plugin.version}
.
Example 1
A classic use case is used to define a jar or plugin version.
<properties><spring.version>3.1.2.RELEASE</spring.version></properties> <dependencies> <dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version></dependency> <dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency> </dependencies>
If you want to upgrade Spring to 3.1.5, just change the “spring.version” to 3.1.5, and all the dependencies will be affected.
Example 2
Another common use case is used to define a long file path.
<properties><project.theme.name>default</project.theme.name><project.resources.build.folder>${project.build.directory}/temp-resources/${project.theme.name}/</project.resources.build.folder></properties> <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>2.5</version><executions> <execution> <id>copy-resources</id> <goals><goal>copy-resources</goal> </goals> <configuration> <outputDirectory> ${project.resources.build.folder} </outputDirectory> //...
Note
Furthermore, Maven comes with many useful project properties like
Furthermore, Maven comes with many useful project properties like
project.build.directory}
,project.build.directory}
, make sure you check this Maven Properties Guide 0 0
- How to create user defined properties in Maven
- How to create a user in PostgreSQL
- you have to know about how to create user defined control.
- How to Create J2ee Project With Maven in Eclipse
- How to access a value defined in the application.properties file in Spring Boot ( Externalized Conf)
- T-SQL Tips: How to raise error in user defined function
- How to create ftp user on Linux
- How to create a remote desktop user
- How to create a read-only user in TFS source control
- how to extend C style IO to user defined types
- How to create function polymorphism in C
- How to Create Procedure in DB2
- How To Create Alternate Background In WPF?
- How to create Function/Procedure in Oracle?
- How to create scheduler in liferay portlet
- How to Create QuickAction Dialog in Android
- How to: Create a Binding in Code
- How to create new module in npm
- nyist oj 1172 unlucky number
- 事务与锁(转)
- [Objective-C]关联(objc_setAssociatedObject、objc_getAssociatedObject、objc_removeAssociatedObjects)
- 利用头插法实现单向链表的逆置
- 如何对待日新月异的软件技术
- How to create user defined properties in Maven
- Bitmap插入二进制字符串及解析
- vim使用方法
- 2014阿里巴巴实习生笔试题目 .
- HDU 2095 find your present(异或)
- Linux Used内存到底哪里去了?
- makefile详解 嵌套执行make,定义命令包
- 【JS学习笔记】07 添加和删除节点(HTML 元素)
- Android 不要标题和全屏的设置方式