On the network to view dozens of articles on the idea of building a MAVEN multi-module project of the blog and article, finally, today is done, here I divided the module to create a common springmvc+spring+hibernate development environment, the project structure is as follows:
First click new->project->
Here with the default MAVEN configuration, do not tick the create from Archetype! direct Next, Balabala, finish ...
Then, delete the SRC directory;
Then select the default Maven project as New->modelu->, and also uncheck the Create from archetype, creating Controller,dao,daoimpl,service,serviceimpl, The Spring,spring module is where the configuration files are stored. Once created, you can see something like this in the Pom.xml of the main module:
See something like this in the Pom.xml in the sub module.
<parent>
<artifactId>multiModuleDemo</artifactId>
<groupid>com.demo</ groupid>
<version>1.0.0</version>
</parent>
This is an indication of the aggregation between the modules.
Of course, you can also create a util module, used to do third-party libraries or tool classes are OK, I do not ...
The last thing to create Mmd-web is to choose WebApp, because this is the equivalent of Webroot in Eclipse, or webcontent in MyEclipse,
Once created,
Then the most important write pom.xml the dependencies between each module:
First, Mmd-controller:
<dependencies>
<dependency>
<groupId>com.demo</groupId>
<artifactId> mmd-service</artifactid>
<version>1.0.0</version>
</dependency>
< dependency>
<groupId>com.demo</groupId>
<artifactid>mmd-serviceimpl</ artifactid>
<version>1.0.0</version>
</dependency>
</dependencies>
Mmd-dao:
<dependencies>
<dependency>
<groupId>com.demo</groupId>
<artifactId> mmd-entity</artifactid>
<version>1.0.0</version>
</dependency>
</ Dependencies>
Mmd-daoimpl:
<dependencies>
<dependency>
<groupId>com.demo</groupId>
<artifactId> mmd-dao</artifactid>
<version>1.0.0</version>
</dependency>
< dependency>
<groupId>com.demo</groupId>
<artifactid>mmd-entity</artifactid >
<version>1.0.0</version>
</dependency>
</dependencies>
Mmd-entity:
No
Mmd-service:
<dependencies>
<dependency>
<groupId>com.demo</groupId>
<artifactId> mmd-daoimpl</artifactid>
<version>1.0.0</version>
</dependency>
< dependency>
<groupId>com.demo</groupId>
<artifactId>MMD-entity</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
Mmd-serviceimpl:
<dependencies>
<dependency>
<groupId>com.demo</groupId>
<artifactId> mmd-dao</artifactid>
<version>1.0.0</version>
</dependency>
<dependency >
<groupId>com.demo</groupId>
<artifactId>MMD-daoImpl</artifactId>
< version>1.0.0</version>
</dependency>
<dependency>
<groupid>com.demo </groupId>
<artifactId>MMD-service</artifactId>
<version>1.0.0</version >
</dependency>
</dependencies>
Mmd-spring: None
Mmd-web:
<dependencies> <dependency> <groupId>junit</groupId> <ARTIFACTID>JUNIT&L t;/artifactid> <version>3.8.1</version> <scope>test</scope> </dependency > <dependency> <groupId>com.demo</groupId> <artifactid>mmd-controller</a rtifactid> <version>1.0.0</version> </dependency> <dependency> <grou Pid>com.demo</groupid> <artifactId>MMD-daoImpl</artifactId> <version>1.0.0</ version> </dependency> <dependency> <groupId>com.demo</groupId> <art Ifactid>mmd-serviceimpl</artifactid> <version>1.0.0</version> </dependency>
;d ependency> <groupId>com.demo</groupId> <artifactId>MMD-spring</artifactId> <version>1.0.0</version> </dependency> </dependencies>
After writing, remember, click
In this way, the module of the dependence on the written, about the construction of the SPRINGMVC environment here will not say, and the usual ways to build no difference, what you do not understand, click on the left of my blog QQ number, add me and I contact it.