1.pom.xml
===========================
<!-- 不同的打包环境配置: test=开发/测试测试环境, product=生产环境; 命令行方式: mvn clean install -Dmaven.test.skip=true -Ptest 或 -Pproduct-->
<profiles>
<!-- 开发/测试环境,默认激活 -->
<profile>
<id>test</id>
<properties>
<env>test</env>
</properties>
<activation>
<activeByDefault>true</activeByDefault><!--默认启用的是dev环境配置-->
</activation>
</profile>
<!-- 预发布环境 -->
<profile>
<id>preproduction</id>
<properties>
<env>preproduction</env>
</properties>
</profile>
<!-- 生产环境 -->
<profile>
<id>production</id>
<properties>
<env>production</env>
</properties>
</profile>
</profiles>
<build>
<filters> <!-- 指定使用的 filter -->
<filter>src/main/filters/filter-${env}-env.properties</filter>
</filters>
<resources>
<resource> <!-- 配置需要被替换的资源文件路径, db.properties 应该在 src/main/resource 目录下 -->
<directory>src/main/resources</directory>
<filtering>true</filtering> <!-- 是否使用过滤器 -->
</resource>
</resources>
</build>
2.src/main/filters/下不同环境的配置文件
src/main/filters/filter-preproduction-env.properties
src/main/filters/filter-production-env.properties
src/main/filters/filter-test-env.properties
======filter-test-env.properties 举例
jdbc.url=jdbc:mysql://192.168.120.220:3306/testdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
jdbc.username=testuser
jdbc.password=123456
3.src/main/resources下要应用处理的文件
src/main/resources/conf/db.properties
======db.properties
jdbc.datasource=com.mchange.v2.c3p0.ComboPooledDataSource
jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.url=${jdbc.url}
jdbc.username=${jdbc.username}
jdbc.password=${jdbc.password}
jdbc.minPoolSize=10
jdbc.maxPoolSize=50
jdbc.autoCommit=false
¥¥¥¥¥¥¥¥
A.pom.xml属性介绍:
project: pom的xml根元素。
parent: 声明继承。
modules: 声明聚合,该值是一个当前POM的相对目录。用户项目的聚合。
groupId: 定义当前Maven项目隶属的实际项目。
artifactId: 定义实际项目中的一个Maven项目模块,一般为实际项目名称。
version: 定义Maven项目当前版本。
groupId、artifactId、version三个属性构成项目的坐标,必须全部填写。
packaging: 坐标元素之一,可以不填,不填默认jar,表示项目构建成jar包;值为war表示可部署的web项目。
name: 名称。
description: 项目描述。
organization: 所属组织。
licenses: 许可证。
mailingLists: 邮件列表。
developers: 开发者。
contributors: 贡献者。
issueManagement: 问题追踪系统。
ciManagement: 持续集成系统。
scm: 版本控制系统。
prerequisites-->maven: 要求maven最低版本,默认值为2.0.
build-->sourceDirectory: 主源码目录。
build-->scriptSourceDirectory: 脚本源码目录。
build-->testSourceDirectory: 测试源码目录。
build-->outputDirectory: 主源码输出目录。
build-->testOutputDirectory: 测试源码输出目录。
build-->resources-->resource: 主资源目录。
build-->testResources-->testResource: 测试资源目录。
build-->finalName: 输出主构件的名称。
build-->directory: 输出目录。
build-->filters-->filter: 通过properties文件定义资源过滤属性。
build-->extensions-->extension: 扩展Maven的核心。
build-->pluginManagement: 插件管理。
build-->plugins-->plugin: 插件。
profiles-->profile: POM Profile。
distributionManagement-->repository: 发布版本部署仓库。
distributionManagement-->snapshotRepository: 快照版本部署仓库。
distributionManagement-->site: 站点部署。
repositories-->repository: 仓库。
pluginRepositories-->pluginRepository: 插件仓库。
dependencies-->dependency: 依赖管理。
properties: Maven属性。
reporting-->plugins: 报告插件。
a-->b表示a元素嵌套着b元素。
B.settings.xml文件配置。
settings: settings.xml的根元素。
localRepository: 本地仓库。
interactiveMode: Maven是否与用户交互,默认值为true。
offline: 离线模式,默认false。
pluginGroups-->pluginGroup: 插件组。
servers-->server: 下载与部署仓库的认证信息。
mirrors-->mirror: 仓库镜像。
proxies-->proxy: 代理。
profiles-->profile: Settings Profile。
activeProfiles-->activeProfile: 激活Profile。
Maven目录下的conf文件夹下的settings.xml为全局的,影响所有用户的配置。一般建议修改c:\Users\用户名\.m2\目录下的settings.xml,属于局部的,只对当前目
录下的用户有用。
相关推荐
该jar包功能,可以在一个properties文件里面定义jdbc.url=${url},在另一个properties文件定义具体的值,通过该jar可以获取到哪个具体的值。下载之后,自行安装到本地...具体pom.xml配置使用可以参考网络其他博文,谢谢
sbt pom阅读器插件 该项目旨在读取Maven pom.xml文件并适当配置一个基本的sbt项目。 我们的目标有限: 目的不是解析/使用Maven插件。 目的是翻译项目结构,依赖关系和工件解析无法读取pom.xml文件会导致Maven版本...
Maven集成SSM所需要的所有配置文件,包括pom.xml web.xml applicationContext_*.xml db.properties springmvc.xml等等
用Go编写的Maven POM解析器,支持递归变量扩展/解释。 图书馆 pom.xml : ${p1}.${a.b}.z < properties> < p1>x${p.b} < p>x </ properties> model , err := Unmarshal ([] byte ( data )) // supply ...
Maven权威指南 Authors Tim O'Brien (Sonatype, Inc.) , John Casey (Sonatype, Inc.) , Brian Fox (Sonatype, Inc.) , Bruce Snyder () , Jason Van Zyl (Sonatype, Inc.) , Juven Xu () Abstract Maven权威指南...
pom.xml添加依赖jar: <groupId>javax.mail <artifactId>mail ${javamail.version} </dependency> <properties> <javamail.version>1.4.1</javamail.version> </properties> /* 功能:加入了参考文章...
META-INF/maven/org.htmlparser/htmlparser/pom.properties META-INF/maven/org.htmlparser/htmlparser/pom.xml org.htmlparser.Parser.class org.htmlparser.PrototypicalNodeFactory.class org.htmlparser.beans....
(具体见源码 pom.xml 文件)右键项目找到Maven Reimport 导入Maven依赖。 修改目录结构 4.完整目录展示: main.java 存放源码 resources 存放相关配置文件 sql 存放相关sql webapp 存放前台页面 创建 jdbc....
1、进入存储库文件夹,修改 pom.xml 中的以下2个标签,更改为您当前使用的 JDK 版本: <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>11</maven....
文章目录动态扫描过程图配置xml配置pom.xml配置ApplicationContext.xml提供bean和mapper实现访问数据库 Spring框架是一个开放源代码的J2EE应用程序框架,它使得我们的开发过程更简单,可以大大减少工作量,提高效率...
在Maven2中,配置使用settings.xml,它取代了原有的project.properties和build.properties。配置在Maven2中存在两种级别: • 用户级,针对操作系统登录用户而言。一般在$home/.m2/,对于windows用户,就是目录:C:\...
3、搭建Spring配置:spring.xml(扫描service),config.properties,log4j.properties; 4、搭建spring和mybatis的配置:spring-mybatis.xm(扫描dao)) 5、测试Spring+mybatis的框架搭建,写单元测试JUnit,测试事务配置...
Eclipse Maven集成(M2E扩展)用于空分析配置Eclipse外部批注的路径以对Maven Dependencies和JRE容器类路径容器进行空分析,并设置JDT编译器配置: 允许从maven-compiler-plugin配置Java编译器项目属性; 从包含org....
pom.xml配置 <properties> <springside.version>4.2.2.GA</springside.version> </properties> <groupId>org.springside <artifactId>springside-core ${springside.version} <classifier>tests <scope>...
入门pom.xml添加到pom.xml构建部分: <plugin><groupId>io.qameta.allure</groupId><artifactId>allure-maven</artifactId><version>2.9</version></plugin>mvn clean test -运行测试您可以使用以下命令之一生成报告...
SSM框架整合的资料:SSM 编程,即 SpringMVC + ...5、设置配置文件(1、配置jdbc.properties;2、配置mybatis.xml;3、配置spring.xml;4、配置springmvc.xml;5、配置web.xml;6、设置web依赖;7、项目发布并运行);
${project.basedir}表示包含pom.xml的目录(不建议使用: ${basedir} ) ${project.baseUri}包含pom.xml文件作为URI的目录${project.version} (不建议使用: ${pom.version}和${version} ) ${maven.home}到当前...
这是从分叉出来的,用于修复包含的 AWS jar 的问题。允许您使用 Maven2 构建一个包含所有... 原来的0.97还是完整的,可以通过在maven pom.xml中指定onejarVersion配置选项使用。示例 pom.xml 构建插件配置 ...<build>
META-INF / maven / org.glassfish.main.ejb / javax.ejb / pom.properties META-INF / maven / org.glassfish.main.ejb / javax.ejb / pom.xml javax.ejb.AccessLocalException.class javax.ejb.AccessTimeout....
此Api使用Java和Spring引导构建,通过简单的DAO和...\ api \ pom.xml” [Packagae] mvn软件包-f“。\ api \ pom.xml” [RunTest] mvn test -f“。\ api \ pom.xml” API网址 [欢迎] curl --location --request GE