一、找一个建工程的文件夹,现在为E盘sources
二、cmd进入创建的文件夹下 e:sources
1、创建主工程目录
mvn archetype:create -DgroupId=com.ctoshop -DartifactId=shopsystem -Dversion=1.0
修改生成的pom.xml文件,修改packaging的值为pom
2、进入主工程shopsystem的目录下
mvn archetype:create -DgroupId=com.ctoshop.shopsystem.biz.dal -DartifactId=shopsystem-biz-dal -Dversion=1.0
mvn archetype:create -DgroupId=com.ctoshop.shopsystem.biz.core -DartifactId=shopsystem-biz-core -Dversion=1.0
mvn archetype:create -DgroupId=com.ctoshop.shopsystem.biz.manager -DartifactId=shopsystem-biz-manager -Dversion=1.0
mvn archetype:create -DgroupId=com.ctoshop.shopsystem.web -DartifactId=shopsystem-web -Dversion=1.0 -DarchetypeArtifactId=maven-archetype-webapp
3、分别修改shopsystem-biz-core、shopsystem-biz-manager、shopsystem-web下的pom.xml文件
在shopsystem-biz-core中增加shopsystem-biz-dal的依赖
<dependency>
<groupId>com.ctoshop.shopsystem.biz.dal</groupId>
<artifactId>shopsystem-biz-dal</artifactId>
<version>${project.version}</version>
</dependency>
在shopsystem-biz-manager中增加shopsystem-biz-dal、shopsystem-biz-core的依赖
<dependency>
<groupId>com.ctoshop.shopsystem.biz.dal</groupId>
<artifactId>shopsystem-biz-dal</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctoshop.shopsystem.biz.core</groupId>
<artifactId>shopsystem-biz-core</artifactId>
<version>${project.version}</version>
</dependency>
在shopsystem-web中增加shopsystem-biz-dal、shopsystem-biz-core、shopsystem-biz-manager的依赖
4、把shopsystem-biz-core、shopsystem-biz-manager、shopsystem-web下的pom.xml文件的
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
在主工程目录的pom.xml中加上
5、删除主工程下的src文件夹,整理各pom.xml.bak文件
三、增加主工程中的依赖(常用依赖包)
1、<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jfreechart-plugin</artifactId>
<version>2.1.8</version>
</dependency>
</dependencies>
四、进入e:sources执行
1、mvn eclipse:clean eclipse:eclipse -DdownloadSources=true
2、mvn clean install -Dmaven.test.skip=true
3、在ECLIPSE-->FILE-->IMPORT 导入工程,这样会把四个创建的工程导入ECLIPSE
五、在Eclipse中
1、在shopsystem-biz-dal工程中新建Source Folder,取名为src/main/resources
2、在ctoshopindex-web工程中新建Source Folder,取名为src/main/java,然后新建package,取名为com.ctoshop.shopsystem.web,
在src->main中新建Folder,取名为webconfig,存放spring配置文件
删除各App.java、AppTest.java