1.怎样使每次测试时不删除数据库中表结构?
解答:将pom.xml配置中的如下代码屏蔽掉。
<!--plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.0-alpha-2</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>
annotationconfiguration
</implementation>
</component>
</components>
<componentProperties>
<drop>true</drop>
<jdk5>true</jdk5>
<propertyfile>
target/classes/jdbc.properties
</propertyfile>
<skip>${maven.test.skip}</skip>
</componentProperties>
</configuration>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin-->
2.怎样使用外部配置变量?
解答:a。在pom.xml配置文件中加入占位符
<!-- FTP settings -->
<ftp.url>135.224.82.4</ftp.url>
<ftp.username>ls</ftp.username>
<ftp.password>FdbEgT+7</ftp.password>
<ftp.path>/data/jyf/0000/SRC/</ftp.path>
b。在resources目录下新建文本文件ftp.properties
ftp.url=${ftp.url}
ftp.username=${ftp.username}
ftp.password=${ftp.password}
ftp.path=${ftp.path}
c。在引用的applicationContext文件节点propertyConfigurer中添加<value>classpath:ftp.properties</value>
d。这时就可以直接使用占位符了
如: <!--FTP Server-START-->
<bean id="myFTP" class="com.xjgzinfo.app.util.MyFTP"
lazy-init="true" destroy-method="destroy">
<property name="server" value="${ftp.url}" />
<property name="user" value="${ftp.username}" />
<property name="password" value="${ftp.password}" />
<property name="path" value="${ftp.path}" />
</bean>
<!--FTP Server-END-->
分享到:
相关推荐
主要介绍了Maven pom.xml与settings.xml详解的相关资料,这里对pom.xml与setting.xml详细的研究说明,需要的朋友可以参考下
该jar包功能,可以在一个properties文件里面定义jdbc.url=${url},在另一个properties文件定义具体的值,通过该jar可以获取到哪个具体的值。下载之后,自行安装到本地...具体pom.xml配置使用可以参考网络其他博文,谢谢
一、Idea关联的maven本地仓库配置文件settings.xml (1)必须使用默认文件名 D:\developsoft\javaweb\commonPlugins\maven\apache-maven-3.8.1_first\conf\settings.xml ...pom-maven-spring-CusConfigV1不推荐使用.xml
maven pom.xml详解
记录一下自己常用的maven工程的pom.xml配置详解,各个标签详解
maven pom.xml详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...
maven的pom.xml的最详细配置,内含pom的依赖、jdk配置等
maven 中 pom.xml 文件详解
本文主要阐述了maven build是用来干什么的,以及对build标签中各子元素配置的作用
maven项目pom.xml中parent标签的使用
spirng mvc maven pom.xml
用于maven setting.xml文件丢失,eclipse集成maven插件.m2下无setting.xml文件需要配置的情况
pom.xml android maven 工程 如何拿Maven 构建 一个 Android 项目的pom配置
SSH框架Maven项目pom.xml
selenium2.53+maven环境pom.xmlselenium2.53+maven环境pom.xmlselenium2.53+maven环境pom.xmlselenium2.53+maven环境pom.xml
Maven_pom.xml常用配置解析
SSM框架整合jar包和maven pom.xml配置文件整合
maven项目的pom.xm,非常齐全,所需的各种jar包都有,的观点观点和额u好肚饿好肚饿的呢就好的好肚饿的好的u好肚饿
springmvc+hibernate的maven工程pom.xml文件配置