使用idea搭建maven项目工程详细步骤:

创建pinyougou-parent父工程

点击File ->New->Module…,创建maven项目

 

点击Next



点击Next



点击Next



♦点击Finish,完成

添加pom文件内容如下:
<?xml version="1.0" encoding="UTF-8"?> <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.0</modelVersion> <groupId>com-pinyougou</groupId>
<artifactId>pinyougou-parent</artifactId> <version>1.0-SNAPSHOT</version>
<packaging>pom</packaging> <!-- 集中定义依赖版本号 --> <properties>
<junit.version>4.12</junit.version>
<spring.version>4.2.4.RELEASE</spring.version>
<pagehelper.version>4.0.0</pagehelper.version>
<servlet-api.version>2.5</servlet-api.version>
<dubbo.version>2.8.4</dubbo.version>
<zookeeper.version>3.4.7</zookeeper.version>
<zkclient.version>0.1</zkclient.version>
<mybatis.version>3.2.8</mybatis.version>
<mybatis.spring.version>1.2.2</mybatis.spring.version>
<mybatis.paginator.version>1.2.15</mybatis.paginator.version>
<mysql.version>5.1.32</mysql.version> <druid.version>1.0.9</druid.version>
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<freemarker.version>2.3.23</freemarker.version>
<activemq.version>5.11.2</activemq.version>
<security.version>3.2.3.RELEASE</security.version>
<solrj.version>4.10.3</solrj.version> <ik.version>2012_u6</ik.version>
</properties> <dependencyManagement> <dependencies> <!-- Spring -->
<dependency> <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version> </dependency> <dependency>
<groupId>org.springframework</groupId> <artifactId>spring-test</artifactId>
<version>${spring.version}</version> </dependency> <!-- dubbo相关 -->
<dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId>
<version>${dubbo.version}</version> </dependency> <dependency>
<groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version> </dependency> <dependency>
<groupId>com.github.sgroschupf</groupId> <artifactId>zkclient</artifactId>
<version>${zkclient.version}</version> </dependency> <dependency>
<groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version>
</dependency> <dependency> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <version>1.2.28</version> </dependency>
<dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId>
<version>3.11.0.GA</version> </dependency> <dependency>
<groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId>
<version>1.10</version> </dependency> <dependency>
<groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId>
<version>2.5</version> <scope>provided</scope> </dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version> </dependency> <!-- Mybatis -->
<dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId>
<version>${mybatis.version}</version> </dependency> <dependency>
<groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId>
<version>${mybatis.spring.version}</version> </dependency> <dependency>
<groupId>com.github.miemiedev</groupId>
<artifactId>mybatis-paginator</artifactId>
<version>${mybatis.paginator.version}</version> </dependency> <!-- MySql -->
<dependency> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version> </dependency> <!-- 连接池 --> <dependency>
<groupId>com.alibaba</groupId> <artifactId>druid</artifactId>
<version>${druid.version}</version> </dependency> <dependency>
<groupId>org.csource.fastdfs</groupId> <artifactId>fastdfs</artifactId>
<version>1.2</version> </dependency> <!-- 文件上传组件 --> <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version> </dependency> <!-- 缓存 -->
<dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId>
<version>2.8.1</version> </dependency> <dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId> <version>1.7.2.RELEASE</version>
</dependency> <dependency> <groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId> <version>${freemarker.version}</version>
</dependency> <dependency> <groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId> <version>${activemq.version}</version>
</dependency> <!-- 身份验证 --> <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId> <version>4.1.0.RELEASE</version>
</dependency> <dependency> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RELEASE</version> </dependency> <dependency>
<groupId>com.github.penggle</groupId> <artifactId>kaptcha</artifactId>
<version>2.3.2</version> <exclusions> <exclusion>
<groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId>
</exclusion> </exclusions> </dependency> <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId> <version>4.1.0.RELEASE</version>
</dependency> <dependency> <groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-core</artifactId> <version>3.3.3</version> <!--
排除log4j包冲突 --> <exclusions> <exclusion> <groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId> </exclusion> </exclusions>
</dependency> <!-- solr客户端 --> <dependency> <groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId> <version>${solrj.version}</version>
</dependency> <dependency> <groupId>com.janeluo</groupId>
<artifactId>ikanalyzer</artifactId> <version>${ik.version}</version>
</dependency> <dependency> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId> <version>4.4.4</version> </dependency>
<dependency> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <version>4.5.3</version> </dependency>
<dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId>
<version>1.6.1</version> </dependency> <dependency> <groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId> <version>1.4.01</version> </dependency>
</dependencies> </dependencyManagement> <build> <plugins> <!-- java编译插件 -->
<plugin> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <version>3.2</version>
<configuration> <source>1.8</source> <target>1.8</target>
<encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build>
</project>
注意pom的打包方式是pom

创建公用工程pinyougou-common

点击File->New->Module…,进入以下界面,请按照下图红色框框进行选中



点击Next



点击Next



 

♦点击Finish,完成

添加pom文件内容如下:
<?xml version="1.0" encoding="UTF-8"?> <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"> <parent>
<artifactId>pinyougou-parent</artifactId> <groupId>com.pinyougou</groupId>
<version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<artifactId>pinyougou-cpmmon</artifactId> </project>
注意pom的打包方式是jar

创建pinyougou-dao工程和pinyougou-pojo工程等子工程步骤和pinyougou-common基本上一样

 

创建pinyougou-manager-web项目



后面的步骤和pinyougou-common一样的

 

 

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:637538335
关注微信