spring的声明式事务AOP-maven版-代码仓库:https://gitee.com/DerekAndroid/springaction.git
https://blog.csdn.net/ThinkWon/article/details/94346569
如果你不知道你所依赖的jar包的dependency怎么写的话,可以到网站检索 https://mvnrepository.com/
参考:https://www.cnblogs.com/zwwhnly/p/10894781.html
参考:https://blog.csdn.net/whutwwg/article/details/93914032
4.pom文件如下
4.0.0
cn.itcast
spring-action
1.0-SNAPSHOT
1.8
4.2.4.RELEASE
org.aopalliance
com.springsource.org.aopalliance
1.0.0
com.mchange.c3p0
com.springsource.com.mchange.v2.c3p0
0.9.1.2
org.apache.commons
com.springsource.org.apache.commons.logging
1.1.1
org.apache.log4j
com.springsource.org.apache.log4j
1.2.15
org.aspectj
com.springsource.org.aspectj.weaver
1.6.8.RELEASE
mysql
mysql-connector-java
5.1.17
org.springframework
spring-aop
${spring-framework.version}
org.springframework
spring-aspects
${spring-framework.version}
org.springframework
spring-beans
${spring-framework.version}
org.springframework
spring-context
${spring-framework.version}
org.springframework
spring-core
${spring-framework.version}
org.springframework
spring-expression
${spring-framework.version}
org.springframework
spring-jdbc
${spring-framework.version}
org.springframework
spring-test
${spring-framework.version}
org.springframework
spring-tx
${spring-framework.version}
org.hamcrest
hamcrest-core
1.3
junit
junit
4.12
org.apache.maven.plugins
maven-compiler-plugin
3.8.0
${java.version}
参考:https://github.com/zwwhnly/spring-action
如图:
对应的pom.xml文件
4.0.0
com
com
1.0-SNAPSHOT
war
com Maven Webapp
http://www.example.com
UTF-8
1.7
1.7
junit
junit
4.12
test
com
maven-clean-plugin
3.1.0
maven-resources-plugin
3.0.2
maven-compiler-plugin
3.8.0
maven-surefire-plugin
2.22.1
maven-war-plugin
3.2.2
maven-install-plugin
2.5.2
maven-deploy-plugin
2.8.2
1.M项目依赖HF项目,HF项目依赖Ho项目
对应privodie修饰的jar包,在主程序和测试程序都有效,privide默认tomcat容器会提供该jar包,所以不会被打包也不会被部署到应用服务器中,类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar
父工程
子工程
参考:https://blog.csdn.net/zy_01113/article/details/80238003
父项目的pom.xml文件的相对路径。默认值为../pom.xml。maven首先从当前构建项目开始查找父项目的pom文件,然后从本地仓库,最有从远程仓库。
继承依赖使用junit测试
父项目(注意:没有配置test的工程,此处scope是compile)
4.0.0
pom
maven-a
com.maven.two
maven-two
1.0-SNAPSHOT
junit
junit
4.12
compile
子项目:
maven-two
com.maven.two
1.0-SNAPSHOT
../pom.xml
4.0.0
maven-a
junit
junit
使用:
import org.junit.Test;
public class ATest {
@Test
public void go(){}
}