您好,登錄后才能下訂單哦!
創建空maven項目
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>
創建module
創建java module
1、右鍵ppd-shop項目–>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>
創建web module
1.與創建java module的1、2點一樣;
2.next
3.把包名定義下~
4.右鍵pdd-shop-appweb項目–>properties–>Project Facets–>Convert to faceted form..
這里選2.4版本的web工程是因為樓主用的是tomcat 6.0啦,按自己實際情況去修改
5.配置pom.xml
配置中有兩點說明下:1、把jar包自動拷貝到web-inf目錄地下,這個搞web開發都懂是為什么了;2、配置子項目依賴
<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>
項目依賴
擴展
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持億速云。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。