我现在是一个大三的学生了,学的是软件工程,这个学期的课程设计是数据库设计,就是让我们实现一个人力资源管理系统。其中人力资源管理系统包括人事管理和薪酬管理。我这次想用播客的形式记录下我这次的课程设计,因为之前的课程设计有点摸鱼的感觉,然后浑浑噩噩就过去了。感觉学到的东西少之又少。希望这次用博文的形式记录,可以更好的督促我自己的学习,让我写出更好的课程设计。
这次的课程设计采用的是mybatis+spring+springMVC+easyui的架构来实现的,其中需求文档老师已经给出了,数据库设计在之前也已经完成了。现在的状态就是可以动手写程序了,我给自己定的目标是在一个星期内写完。并且持续更新我的播客。
maven的项目有三个版本,一个是pom,一个是jar,一个是war。其中jar和war这两个版本是我们比较熟悉的两个,因为我们平常使用需要导入jar包,写web工程使用的是war包。maven中的pom工程就是一个定义共用pom.xml文件的作用。他可以被继承。
1. 定义项目结构
humanResource.parent ———-(maven project) pom
—-humanResource.common ———–(maven project)jar
—-humanResource.manager ———–(maven project)pom
——–humanResource.manager.pojo ————–(maven model)jar
——–humanResource.manager.mapper ———–(maven model)jar
——–humanResource.manager.service ————(maven model)jar
——–humanResource.manager.web ————-(maven model)war
其中mapper会依赖pojo,service会依赖mapper,web会依赖service
2. 根据项目结构构建
3. 在parent中定义项目需要使用的jar包,然后在各个模块中定义各个模块需要使用的jar包
在parent中定义tomcat插件
<build>
<finalName>${project.artifactId}finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.mavengroupId>
<artifactId>tomcat7-maven-pluginartifactId>
<version>2.2version>
plugin>
plugins>
pluginManagement>
build>
在manager中定义tomcat插件
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.mavengroupId>
<artifactId>tomcat7-maven-pluginartifactId>
<configuration>
<port>8080port>
<path>/path>
configuration>
plugin>
plugins>
build>
最后。项目的构建就已经完成了,如果文章中有什么错误,欢迎指正留言,如果在实践中遇到什么问题,欢迎留言。
末尾附上我的工程pom文件。
parent
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.parentartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>pompackaging>
<properties>
<junit.version>4.12junit.version>
<spring.version>4.3.2.RELEASEspring.version>
<mybatis.version>3.2.8mybatis.version>
<mybatis.spring.version>1.2.2mybatis.spring.version>
<mybatis.paginator.version>1.2.15mybatis.paginator.version>
<mysql.version>5.1.32mysql.version>
<slf4j.version>1.6.4slf4j.version>
<jackson.version>2.4.2jackson.version>
<druid.version>1.0.9druid.version>
<jstl.version>1.2jstl.version>
<servlet-api.version>2.5servlet-api.version>
<jsp-api.version>2.0jsp-api.version>
<joda-time.version>2.5joda-time.version>
<commons-lang3.version>3.3.2commons-lang3.version>
<pagehelper.version>3.4.2-fixpagehelper.version>
<jsqlparser.version>0.9.1jsqlparser.version>
<commons-fileupload.version>1.3.1commons-fileupload.version>
properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>joda-timegroupId>
<artifactId>joda-timeartifactId>
<version>${joda-time.version}version>
dependency>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-lang3artifactId>
<version>${commons-lang3.version}version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
<version>${jackson.version}version>
dependency>
<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<version>${junit.version}version>
<scope>testscope>
dependency>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>slf4j-log4j12artifactId>
<version>${slf4j.version}version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatisartifactId>
<version>${mybatis.version}version>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatis-springartifactId>
<version>${mybatis.spring.version}version>
dependency>
<dependency>
<groupId>com.github.miemiedevgroupId>
<artifactId>mybatis-paginatorartifactId>
<version>${mybatis.paginator.version}version>
dependency>
<dependency>
<groupId>com.github.pagehelpergroupId>
<artifactId>pagehelperartifactId>
<version>${pagehelper.version}version>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<version>${mysql.version}version>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druidartifactId>
<version>${druid.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-beansartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-jdbcartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-aspectsartifactId>
<version>${spring.version}version>
dependency>
<dependency>
<groupId>jstlgroupId>
<artifactId>jstlartifactId>
<version>${jstl.version}version>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>servlet-apiartifactId>
<version>${servlet-api.version}version>
<scope>providedscope>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>jsp-apiartifactId>
<version>${jsp-api.version}version>
<scope>providedscope>
dependency>
<dependency>
<groupId>commons-fileuploadgroupId>
<artifactId>commons-fileuploadartifactId>
<version>${commons-fileupload.version}version>
dependency>
dependencies>
dependencyManagement>
<build>
<finalName>${project.artifactId}finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.mavengroupId>
<artifactId>tomcat7-maven-pluginartifactId>
<version>2.2version>
plugin>
plugins>
pluginManagement>
build>
project>
commom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.parentartifactId>
<version>0.0.1-SNAPSHOTversion>
parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.commonartifactId>
<version>0.0.1-SNAPSHOTversion>
<dependencies>
<dependency>
<groupId>joda-timegroupId>
<artifactId>joda-timeartifactId>
dependency>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-lang3artifactId>
dependency>
<dependency>
<groupId>org.apache.commonsgroupId>
<artifactId>commons-ioartifactId>
dependency>
<dependency>
<groupId>commons-netgroupId>
<artifactId>commons-netartifactId>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
dependency>
<dependency>
<groupId>org.apache.httpcomponentsgroupId>
<artifactId>httpclientartifactId>
dependency>
<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<scope>testscope>
dependency>
<dependency>
<groupId>org.slf4jgroupId>
<artifactId>slf4j-log4j12artifactId>
dependency>
dependencies>
project>
manager
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.parentartifactId>
<version>0.0.1-SNAPSHOTversion>
parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.managerartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>pompackaging>
<dependencies>
<dependency>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.commonartifactId>
<version>0.0.1-SNAPSHOTversion>
dependency>
dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.mavengroupId>
<artifactId>tomcat7-maven-pluginartifactId>
<configuration>
<port>8080port>
<path>/path>
configuration>
plugin>
plugins>
build>
<modules>
<module>humanResource.manager.pojomodule>
<module>humanResource.manager.mappermodule>
<module>humanResource.manager.servicemodule>
<module>humanResource.manager.webmodule>
modules>
project>
pojo
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.managerartifactId>
<version>0.0.1-SNAPSHOTversion>
parent>
<artifactId>humanResource.manager.pojoartifactId>
project>
mapper
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.managerartifactId>
<version>0.0.1-SNAPSHOTversion>
parent>
<artifactId>humanResource.manager.mapperartifactId>
<dependencies>
<dependency>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.manager.pojoartifactId>
<version>0.0.1-SNAPSHOTversion>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatisartifactId>
dependency>
<dependency>
<groupId>org.mybatisgroupId>
<artifactId>mybatis-springartifactId>
dependency>
<dependency>
<groupId>com.github.miemiedevgroupId>
<artifactId>mybatis-paginatorartifactId>
dependency>
<dependency>
<groupId>com.github.pagehelpergroupId>
<artifactId>pagehelperartifactId>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
dependency>
<dependency>
<groupId>com.alibabagroupId>
<artifactId>druidartifactId>
dependency>
dependencies>
<build>
<resources>
<resource>
<directory>src/main/javadirectory>
<includes>
<include>**/*.propertiesinclude>
<include>**/*.xmlinclude>
includes>
<filtering>falsefiltering>
resource>
resources>
build>
project>
service
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.managerartifactId>
<version>0.0.1-SNAPSHOTversion>
parent>
<artifactId>humanResource.manager.serviceartifactId>
<dependencies>
<dependency>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.manager.mapperartifactId>
<version>0.0.1-SNAPSHOTversion>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-beansartifactId>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-webmvcartifactId>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-jdbcartifactId>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-aspectsartifactId>
dependency>
dependencies>
project>
web
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0modelVersion>
<parent>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.managerartifactId>
<version>0.0.1-SNAPSHOTversion>
parent>
<artifactId>humanResource.manager.webartifactId>
<packaging>warpackaging>
<dependencies>
<dependency>
<groupId>bling.humanResourcegroupId>
<artifactId>humanResource.manager.serviceartifactId>
<version>0.0.1-SNAPSHOTversion>
dependency>
<dependency>
<groupId>jstlgroupId>
<artifactId>jstlartifactId>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>servlet-apiartifactId>
<version>${servlet-api.version}version>
<scope>providedscope>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>jsp-apiartifactId>
<scope>providedscope>
dependency>
<dependency>
<groupId>commons-fileuploadgroupId>
<artifactId>commons-fileuploadartifactId>
dependency>
dependencies>
project>