时间:2021-07-01 10:21:17 帮助过:23人阅读
背景 工作中要实现跨数据库的package调用,在jsp前端返回,目前项目上只是Maven,所以参照Andyの笔记来看看结合自己所在项目都需要哪些更新来实现一个简单的功能。 1、Maven 虽然项目中已经在Eclipse中嵌入了Maven,但还是可以单独安装一个Maven的工具在系统
工作中要实现跨数据库的package调用,在jsp前端返回,目前项目上只是Maven,所以参照Andyの笔记来看看结合自己所在项目都需要哪些更新来实现一个简单的功能。
虽然项目中已经在Eclipse中嵌入了Maven,但还是可以单独安装一个Maven的工具在系统中,参考Andy的Maven环境搭建和介绍 来操作即可。
中间遇到了问题“-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME environment variable and mvn script match.”,可以在这里解决。
加载完dependence之后,按Andy的Mybatis使用generator自动生成映射配置文件信息交待生成配置文件。其中正确生成了BxxxxxLxxxx.java,BxxxxxLxxxxMapper.java 以及BxxxxxLxxxxMapper.xml,分别放在\src\main\java\com\xxxxx\xxx\domain,src\main\java\com\xxxxx\xxx\mapper以及src\main\java\com\xxxxx\xxx\mapper\sqlmaps目录下。
按照步骤提示继续,针对即将新引入的jar包,更改pom.xml文件
org.springframework
spring-core
3.1.1.RELEASE
org.springframework
spring-beans
3.1.1.RELEASE
org.springframework
spring-context
3.1.1.RELEASE
org.springframework
spring-tx
3.1.1.RELEASE
org.springframework
spring-web
3.1.1.RELEASE
org.springframework
spring-webmvc
3.1.1.RELEASE
org.springframework
spring-jdbc
3.1.1.RELEASE
org.springframework
spring-test
3.1.1.RELEASE
test
org.mybatis
mybatis
3.1.0
org.mybatis
mybatis-spring
1.1.1
log4j
log4j
1.2.17
org.apache.struts
struts2-core
2.3.16.3
org.apache.struts
struts2-json-plugin
2.3.16.3
org.apache.struts
struts2-spring-plugin
2.3.16.3
com.google.code.gson
gson
2.1
com.mchange
c3p0
0.9.5
org.aspectj
aspectjweaver
1.6.8
cglib
cglib
2.2.2
...
src/main/resource
*.xml
*.properties
以及需要在build节点里加入以下resources引用,以帮助Maven加载需要的struts和myBatisConfig的配置文件。