Maven--归类依赖
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.juven.mvnbook.account</groupId> 5 <artifactId>account-email</artifactId> 6 <version>0.0.1-SNAPSHOT</version> 7 <name>Account Email</name> 8 9 <properties> 10 <org.springframework.version>3.0.5.RELEASE</org.springframework.version> 11 </properties> 12 13 <dependencies> 14 <dependency> 15 <groupId>org.springframework</groupId> 16 <artifactId>spring-core</artifactId> 17 <version>${org.springframework.version}</version> 18 </dependency> 19 <dependency> 20 <groupId>org.springframework</groupId> 21 <artifactId>spring-expression</artifactId> 22 <version>${org.springframework.version}</version> 23 </dependency> 24 <dependency> 25 <groupId>org.springframework</groupId> 26 <artifactId>spring-beans</artifactId> 27 <version>${org.springframework.version}</version> 28 </dependency> 29 <dependency> 30 <groupId>org.springframework</groupId> 31 <artifactId>spring-aop</artifactId> 32 <version>${org.springframework.version}</version> 33 </dependency> 34 <dependency> 35 <groupId>org.springframework</groupId> 36 <artifactId>spring-context</artifactId> 37 <version>${org.springframework.version}</version> 38 </dependency> 39 <dependency> 40 <groupId>org.springframework</groupId> 41 <artifactId>spring-context-support</artifactId> 42 <version>${org.springframework.version}</version> 43 </dependency> 44 <dependency> 45 <groupId>org.springframework</groupId> 46 <artifactId>spring-tx</artifactId> 47 <version>${org.springframework.version}</version> 48 </dependency> 49 <dependency> 50 <groupId>org.springframework</groupId> 51 <artifactId>spring-jdbc</artifactId> 52 <version>${org.springframework.version}</version> 53 </dependency> 54 <dependency> 55 <groupId>org.springframework</groupId> 56 <artifactId>spring-orm</artifactId> 57 <version>${org.springframework.version}</version> 58 </dependency> 59 <dependency> 60 <groupId>org.springframework</groupId> 61 <artifactId>spring-oxm</artifactId> 62 <version>${org.springframework.version}</version> 63 </dependency> 64 <dependency> 65 <groupId>org.springframework</groupId> 66 <artifactId>spring-web</artifactId> 67 <version>${org.springframework.version}</version> 68 </dependency> 69 <dependency> 70 <groupId>org.springframework</groupId> 71 <artifactId>spring-webmvc</artifactId> 72 <version>${org.springframework.version}</version> 73 </dependency> 74 <dependency> 75 <groupId>org.springframework</groupId> 76 <artifactId>spring-webmvc-portlet</artifactId> 77 <version>${org.springframework.version}</version> 78 </dependency> 79 <dependency> 80 <groupId>org.springframework</groupId> 81 <artifactId>spring-test</artifactId> 82 <version>${org.springframework.version}</version> 83 <scope>test</scope> 84 </dependency> 85 86 </dependencies> 87 88 </project>
这里简单用到了 Maven 属性,首先使用 <properties> 元素定义 Maven 属性,该例中定义了一个 org.springframework.version 子元素,有了这个属性定义之后,Maven 运行的时候会将 POM 中的所有 ${org.springframework.version} 替换成实际定义的值。