pom作爲項目對象模型。通過xml表示maven項目,使用pom.xml來實現。主要描述了項目:包括配置文件、開發者需要遵循的規則、缺陷管理系統、組織和licenses、項目的url、項目的依賴性以及其他所有的項目相關因素。
下面是我在項目中應用的一個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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- 繼承父類 --> <parent> <!-- 座標 --> <groupId>com.shiyue.sysesp</groupId> <artifactId>sysesp-core-parent</artifactId> <version>1.0.CR11</version> <relativePath>../sysesp-core-parent/pom.xml</relativePath> </parent> <artifactId>sysesp-core-web</artifactId> <!-- jar/war/ear --> <packaging>war</packaging> <url>http://maven.apache.org</url> <!-- 依賴jar包 --> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.shiyue.sysesp</groupId> <artifactId>sysesp-core-service</artifactId> </dependency> <!-- Struts2.3.4 --> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-convention-plugin</artifactId> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-json-plugin</artifactId> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-spring-plugin</artifactId> </dependency> <!-- Servlet API --> <dependency> <groupId>com.shiyuesoft</groupId> <artifactId>servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.shiyuesoft</groupId> <artifactId>jsp-api</artifactId> <scope>provided</scope> </dependency> <!-- JSTL --> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> </dependency> <!-- Spring web --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </dependency> <dependency> <groupId>jxl</groupId> <artifactId>jxl</artifactId> </dependency> <!-- 分頁 --> <dependency> <groupId>com.sysesp.tag</groupId> <artifactId>tag</artifactId> </dependency> <dependency> <groupId>org.jasig.cas.client</groupId> <artifactId>cas-client-core</artifactId> </dependency> </dependencies> <!-- build相關 --> <build> <!-- 打包後的名稱 --> <finalName>base</finalName> <!-- 插件 --> <plugins> <!-- war包插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <filtering>true</filtering> <directory>src/main/webapp</directory> <includes> <include>WEB-INF/web.xml</include> <include>WEB-INF/log4j.properties</include> </includes> </resource> </webResources> </configuration> </plugin> <!-- 部署插件,自動部署至遠程tomcat --> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <url>http://192.168.2.203:8080/manager/text</url> <path>/${build.finalName}</path> <username>bruce</username> <password>bruce</password> </configuration> </plugin> </plugins> </build> </project>