如何使用eclipse搭建maven多module項(xiàng)目(構(gòu)建父子項(xiàng)目)
創(chuàng)建空maven項(xiàng)目
1、File–>new–>project…
2.next
3.next
4.finish
5.配置pom.xml
<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>pdd-shop</groupId> <artifactId>pdd-shop</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>pdd-shop</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <junit.version>4.11</junit.version> <spring.version>4.0.0.RELEASE</spring.version> </properties> <build> <finalName>pdd-shop</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> <compilerVersion>1.6</compilerVersion> </configuration> </plugin> <!-- jar插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.5</version> <configuration> <archive> <manifest> <addDefaultImplementationEntries>true</addDefaultImplementationEntries> <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> </manifest> </archive> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> </dependency> <!-- spring framework --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> </dependencies> <modules> <module>pdd-shop-application</module> <module>pdd-shop-appweb</module> <module>pdd-shop-application-impl</module> </modules> </project>
創(chuàng)建module
創(chuàng)建java module
1、右鍵ppd-shop項(xiàng)目–>new–>project…
2.next
3.next
4.next
5.finish–>配置pom.xml
(主要把多余部分刪除,junit只要在父工程的pom配置就可以了)
<?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>pdd-shop</artifactId> <groupId>pdd-shop</groupId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>pdd-shop</groupId> <artifactId>pdd-shop-application</artifactId> <version>0.0.1-SNAPSHOT</version> <name>pdd-shop-application</name> </project>
創(chuàng)建web module
1.與創(chuàng)建java module的1、2點(diǎn)一樣;
2.next
3.把包名定義下~
4.右鍵pdd-shop-appweb項(xiàng)目–>properties–>Project Facets–>Convert to faceted form..
這里選2.4版本的web工程是因?yàn)闃侵饔玫氖莟omcat 6.0啦,按自己實(shí)際情況去修改
5.配置pom.xml
配置中有兩點(diǎn)說(shuō)明下:1、把jar包自動(dòng)拷貝到web-inf目錄地下,這個(gè)搞web開(kāi)發(fā)都懂是為什么了;2、配置子項(xiàng)目依賴(lài)
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>pdd-shop</artifactId> <groupId>pdd-shop</groupId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>pdd-shop</groupId> <artifactId>pdd-shop-appweb</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>pdd-shop-appweb Maven Webapp</name> <build> <finalName>pdd-shop-appweb</finalName> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>copy-lib-src-webapps</id> <phase>package</phase> <configuration> <tasks> <delete dir="WebContent/WEB-INF/lib" /> <copy todir="WebContent/WEB-INF/lib"> <fileset dir="target/${artifactId}/WEB-INF/lib"> <include name="*" /> </fileset> </copy> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>${groupId}</groupId> <artifactId>pdd-shop-application-impl</artifactId> <version>${version}</version> </dependency> </dependencies> </project>
項(xiàng)目依賴(lài)
擴(kuò)展
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
mybatis返回list<Integer>時(shí)resultType寫(xiě)Integer問(wèn)題
這篇文章主要介紹了mybatis返回list<Integer>時(shí)resultType寫(xiě)Integer問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,2023-12-12Java使用多線(xiàn)程異步執(zhí)行批量更新操作方法
這篇文章主要介紹了Java使用多線(xiàn)程異步執(zhí)行批量更新操作,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-01-01Java中double數(shù)值保留兩位小數(shù)的4種實(shí)現(xiàn)方式舉例
在Java編程中,我們經(jīng)常遇到需要對(duì)double類(lèi)型的浮點(diǎn)數(shù)進(jìn)行精確截?cái)嗷蛩纳嵛迦氡A魞晌恍?shù)的需求,這篇文章主要給大家介紹了關(guān)于Java中double數(shù)值保留兩位小數(shù)的4種實(shí)現(xiàn)方式,需要的朋友可以參考下2024-07-07IntelliJ IDEA搜索整個(gè)項(xiàng)目進(jìn)行全局替換(有危險(xiǎn)慎用)
今天小編就為大家分享一篇關(guān)于IntelliJ IDEA搜索整個(gè)項(xiàng)目進(jìn)行全局替換(有危險(xiǎn)慎用),小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2018-10-10Java?8?Stream?處理數(shù)據(jù)方法匯總
這篇文章主要介紹了Java?8?Stream處理數(shù)據(jù),Stream是Java?8?新引入的一個(gè)包它讓我們能用聲明式的方式處理數(shù)據(jù),Stream流式處理相較于傳統(tǒng)方法簡(jiǎn)潔高效,也便于進(jìn)行并發(fā)編程,更多相關(guān)內(nèi)容需要的小伙伴可以參考下面文章內(nèi)容2022-06-06Mybatis之foreach標(biāo)簽內(nèi)傳入list為空的問(wèn)題
這篇文章主要介紹了Mybatis之foreach標(biāo)簽內(nèi)傳入list為空的問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03@ConfigurationProperties綁定配置信息至Array、List、Map、Bean的實(shí)現(xiàn)
這篇文章主要介紹了@ConfigurationProperties綁定配置信息至Array、List、Map、Bean的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-05-05

從源碼角度看spring mvc的請(qǐng)求處理過(guò)程