SSM项目-医药采购-01

来源:互联网 发布:sql developer添加数据 编辑:程序博客网 时间:2024/04/27 19:29

一、系统结构与框架的搭建

最终要构建三个maven工程:

 

系统主工程模块:yycgproject

 

系统工具类模块:yycgutils


技术架构模块:springmybatis


1.1 maven与me的整合



如何判断maven和eclipse整合好?

在eclipse中打开下边的视图:



1.2    创建技术架构模块

 

创建一个maven工程,在pom.xml配置springmvc3.1.4和mybatis3.2.3的依赖

 

在从mybatis官方网站下载mybatis的jar包。

 

在mybatis目录中找到pom.xml文件;



确定java编译版本:

在pom.xml文件添加:




1.3     工具模块

 

创建一个maven工程(java工程),yycgutil

 

先将工具类拷贝到src/main/java中。

 

在pom.xml添加依赖。



1.4     主工程模块yycgproject

 

创建一个maven工程(webapp)



1.5     聚合模块yycgparent

 

开发在eclipse上开发,将开发后的代码提交svn。

测试从svn上得到代码,编译,打成war包,将war拷贝到测试服务器。

创建聚合工程:yycgparent

 

负责:将各各工程模块聚合

不需要开发。

 

创建maven工程,修改pom.xml文件:






需要自动生成 war包,需要在yycgproject的pom.xml添加生成war的插件。

 

<!-- war包生成插件 -->

         <plugin>

            <groupId>org.apache.maven.plugins</groupId>

            <artifactId>maven-war-plugin</artifactId>

            <version>2.4</version>

            <configuration>

                <warSourceDirectory>src/main/webapp</warSourceDirectory>

            </configuration>

         </plugin>

 

 

为了生成war包之后,自动启动tomcat运行(达到一步构建,执行一个命令:编译、测试、打包、运行。。)

 

注意:下边要配置正确的tomcat的目录。

<!--tomcat运行插件 -->

         <plugin>

              <groupId>org.codehaus.cargo</groupId>

              <artifactId>cargo-maven2-plugin</artifactId>

            <version>1.2.3</version>

            <configuration>

                <container>

                    <containerId>tomcat7x</containerId>

                    <home>e:/apache-tomcat-7.0.52</home>

                </container>

                <configuration>

                    <type>existing</type>

                    <home>e:/apache-tomcat-7.0.52</home>

                </configuration>

            </configuration>

            <executions> 

                  <execution> 

                      <id>cargo-run</id> 

                      <phase>install</phase> 

                      <goals> 

                          <goal>run</goal> 

                      </goals> 

                  </execution> 

              </executions>

          </plugin>

 

 

在cmd命令行执行工程聚合,达到一步构建。

 

也可以在me中右键直接运行 install进行安装




0 0
原创粉丝点击