Spring3.1.1学习笔记01-aurora-parent
环境使用STS中的Maven直接搭建一个多模块项目,Maven依赖直接使用SpringSide4.0的依赖库,这里列出来只是备查,细节操作不具体说明。
1、新建一个类型为pom的父项目,这里的项目名称为aurora-parent
?
<projectxmlns="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>aurora</groupId><artifactId>aurora-parent</artifactId><version>1.0-zodiac</version><packaging>pom</packaging><properties><!-- 主要依赖库的版本定义 --><springside.version>4.0.0.RC2</springside.version><spring.version>3.1.1.RELEASE</spring.version><hibernate.version>4.1.1.Final</hibernate.version><mybatis.version>3.1.0</mybatis.version><cxf.version>2.5.2</cxf.version><jersey.version>1.12</jersey.version><shiro.version>1.2.0</shiro.version><activemq.version>5.5.1</activemq.version><jetty.version>8.1.0.RC2</jetty.version><h2.version>1.3.164</h2.version><jackson.version>1.9.5</jackson.version><slf4j.version>1.6.4</slf4j.version><selenium.version>2.20.0</selenium.version><mysql.connector.version>5.1.18</mysql.connector.version><mssql.version>1.2.4</mssql.version><!-- Plugin的属性定义 --><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><jdk.version>1.7</jdk.version></properties><dependencyManagement><dependencies><!-- SPRINGSIDE MODULES begin --><dependency><groupId>org.springside</groupId><artifactId>springside-core</artifactId><version>${springside.version}</version></dependency><dependency><groupId>org.springside</groupId><artifactId>springside-extension</artifactId><version>${springside.version}</version></dependency><!-- SPRINGSIDE MODULES end --><!-- SPRING begin --><!-- spring basic --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version><exclusions><exclusion><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${spring.version}</version></dependency><!-- spring tx --><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjrt</artifactId><version>1.6.12</version></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>1.6.12</version></dependency><dependency><groupId>cglib</groupId><artifactId>cglib-nodep</artifactId><version>2.2.2</version></dependency><dependency><groupId>cglib</groupId><artifactId>cglib</artifactId><version>2.2.2</version></dependency><!-- asm --><dependency><groupId>asm</groupId><artifactId>asm</artifactId><version>3.3.1</version></dependency><!-- SPRING end --><!-- PERSISTENCE begin --><!-- hibernate --><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-core</artifactId><version>${hibernate.version}</version></dependency><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-entitymanager</artifactId><version>${hibernate.version}</version></dependency><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-ehcache</artifactId><version>${hibernate.version}</version></dependency><dependency><groupId>org.hibernate.javax.persistence</groupId><artifactId>hibernate-jpa-2.0-api</artifactId><version>1.0.1.Final</version></dependency><dependency><groupId>joda-time</groupId><artifactId>joda-time-hibernate</artifactId><version>1.3</version></dependency><!-- spring data jpa --><dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <version>1.0.3.RELEASE</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>1.1.0</version></dependency><!-- spring orm --><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><!-- optional datasource pool --><dependency><groupId>commons-pool</groupId><artifactId>commons-pool</artifactId><version>1.6</version></dependency><!-- PERSISTENCE end --><!-- DATABASE begin --><!-- MySQL JDBC connector --><!-- If you want to use MySQL, uncomment this dependency declation. --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.connector.version}</version></dependency><!-- MSSQL JDBC connector --><!-- If you want to use MsSQL, uncomment this dependency declation. --><dependency><groupId>net.sourceforge.jtds</groupId><artifactId>jtds</artifactId><version>${mssql.version}</version></dependency><!-- PostgreSQL JDBC 4 --><!-- If you don't want to use PostgreSQL, uncomment this dependency declaration. --><dependency><groupId>postgresql</groupId><artifactId>postgresql</artifactId><version>9.0-801.jdbc4</version></dependency><!-- H2 Database --><!-- If you want to use H2, uncomment this dependency declation. --><dependency><groupId>com.h2database</groupId><artifactId>h2</artifactId><version>1.3.160</version></dependency><!-- BoneCP --><dependency><groupId>com.jolbox</groupId><artifactId>bonecp</artifactId><version>0.7.1.RELEASE</version></dependency><!-- DBCP --><dependency><groupId>commons-dbcp</groupId><artifactId>commons-dbcp</artifactId><version>1.4</version></dependency><!-- DATABASE end --><!-- WEB begin --><!-- spring mvc --><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><!-- sitemesh --><dependency><groupId>opensymphony</groupId><artifactId>sitemesh</artifactId><version>2.4.2</version></dependency><!-- j2ee web spec --><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version><scope>provided</scope></dependency><!-- WEB end --><!-- SOAP begin --><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-core</artifactId><version>${cxf.version}</version><exclusions><!-- use javax.mail.mail instead --><exclusion><groupId>org.apache.geronimo.specs</groupId><artifactId>geronimo-javamail_1.4_spec</artifactId></exclusion><!-- use javax.activation.activation instead --><exclusion><groupId>org.apache.geronimo.specs</groupId><artifactId>geronimo-activation_1.1_spec</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-frontend-jaxws</artifactId><version>${cxf.version}</version><exclusions><!-- see above --><exclusion><groupId>org.apache.geronimo.specs</groupId><artifactId>geronimo-javamail_1.4_spec</artifactId></exclusion><exclusion><groupId>org.apache.geronimo.specs</groupId><artifactId>geronimo-activation_1.1_spec</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-transports-http</artifactId><version>${cxf.version}</version></dependency><!-- SOAP end --><!-- REST begin --><dependency><groupId>com.sun.jersey</groupId><artifactId>jersey-server</artifactId><version>${jersey.version}</version></dependency><dependency><groupId>com.sun.jersey</groupId><artifactId>jersey-servlet</artifactId><version>${jersey.version}</version></dependency><dependency><groupId>com.sun.jersey</groupId><artifactId>jersey-client</artifactId><version>${jersey.version}</version></dependency><dependency><groupId>com.sun.jersey</groupId><artifactId>jersey-json</artifactId><version>${jersey.version}</version><exclusions><exclusion><groupId>org.codehaus.jettison</groupId><artifactId>jettison</artifactId></exclusion></exclusions></dependency><dependency><groupId>com.sun.jersey.contribs</groupId><artifactId>jersey-spring</artifactId><version>${jersey.version}</version><exclusions><exclusion><groupId>org.springframework</groupId><artifactId>spring</artifactId></exclusion><exclusion><groupId>com.sun.jersey</groupId><artifactId>jersey-grizzly2</artifactId></exclusion><exclusion><groupId>com.sun.jersey</groupId><artifactId>jersey-servlet</artifactId></exclusion></exclusions></dependency><dependency><groupId>com.sun.jersey.contribs</groupId><artifactId>jersey-multipart</artifactId><version>${jersey.version}</version></dependency><!-- REST end --><!-- SECURITY begin --><dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-core</artifactId><version>${shiro.version}</version></dependency><dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-spring</artifactId><version>${shiro.version}</version></dependency><dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-web</artifactId><version>${shiro.version}</version></dependency><!-- SECURITY end --><!-- JMS begin --><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-core</artifactId><version>${activemq.version}</version><exclusions><exclusion><groupId>org.apache.activemq.protobuf</groupId><artifactId>activemq-protobuf</artifactId></exclusion><exclusion><groupId>org.springframework.osgi</groupId><artifactId>spring-osgi-core</artifactId></exclusion><exclusion><groupId>org.osgi</groupId><artifactId>org.osgi.core</artifactId></exclusion></exclusions></dependency><!-- JMS end --><!-- TIMER --><dependency><groupId>org.quartz-scheduler</groupId><artifactId>quartz</artifactId><version>2.1.3</version></dependency><!-- CACHE begin --><!-- memcached --><!-- sysmemcached is provided by springside repository --><dependency><groupId>spy</groupId><artifactId>spymemcached</artifactId><version>2.8.0</version></dependency><dependency><groupId>com.thimbleware.jmemcached</groupId><artifactId>jmemcached-core</artifactId><version>1.0.0</version><scope>test</scope></dependency><!-- ehcache --><dependency><groupId>net.sf.ehcache</groupId><artifactId>ehcache-core</artifactId><version>2.5.1</version></dependency><!-- CACHE end --><!-- LOGGING begin --><!-- slf4j --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>${slf4j.version}</version></dependency><!-- slf4j-log4j绑定 --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>${slf4j.version}</version></dependency><!-- common-logging 實際調用 slf4j --><dependency><groupId>org.slf4j</groupId><artifactId>jcl-over-slf4j</artifactId><version>${slf4j.version}</version></dependency><!-- log4j --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.16</version></dependency><!-- log4jdbc --><!-- log4jdbc is provided by springside repository --><dependency><groupId>log4jdbc</groupId><artifactId>log4jdbc4</artifactId><version>1.2</version></dependency><!-- logback --><dependency><groupId>ch.qos.logback</groupId><artifactId>logback-classic</artifactId><version>1.0.0</version></dependency><!-- LOGGING end --><!-- XML begin --><dependency><groupId>dom4j</groupId><artifactId>dom4j</artifactId><version>1.6.1</version><exclusions><exclusion><groupId>xml-apis</groupId><artifactId>xml-apis</artifactId></exclusion></exclusions></dependency><!-- 重新定义Java XPath Engine, exclude不必要的依赖 --><dependency><groupId>jaxen</groupId><artifactId>jaxen</artifactId><version>1.1.3</version><exclusions><exclusion><groupId>xerces</groupId><artifactId>xercesImpl</artifactId></exclusion><exclusion><groupId>xml-apis</groupId><artifactId>xml-apis</artifactId></exclusion><exclusion><groupId>dom4j</groupId><artifactId>dom4j</artifactId></exclusion><exclusion><groupId>jdom</groupId><artifactId>jdom</artifactId></exclusion><exclusion><groupId>xom</groupId><artifactId>xom</artifactId></exclusion><exclusion><groupId>maven-plugins</groupId><artifactId>maven-cobertura-plugin</artifactId></exclusion><exclusion><groupId>maven-plugins</groupId><artifactId>maven-findbugs-plugin</artifactId></exclusion></exclusions></dependency><!-- jaxb --><dependency><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId><version>2.2.5</version></dependency><dependency><groupId>com.sun.xml.bind</groupId><artifactId>jaxb-impl</artifactId><version>2.2.5</version></dependency><!-- XML end --><!-- JSON begin --><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-core-asl</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-jaxrs</artifactId><version>${jackson.version}</version></dependency><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-xc</artifactId><version>${jackson.version}</version></dependency><!-- JSON end --><!-- GENERAL UTILS begin --><dependency><groupId>commons-lang</groupId><artifactId>commons-lang</artifactId><version>2.6</version></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.1</version></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.1</version></dependency><dependency><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.1</version></dependency><dependency><groupId>commons-beanutils</groupId><artifactId>commons-beanutils</artifactId><version>1.8.3</version><exclusions><exclusion><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId></exclusion></exclusions></dependency><dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.6</version></dependency><!-- google java library --><dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>11.0.2</version></dependency><!-- joda --><dependency><groupId>joda-time</groupId><artifactId>joda-time</artifactId><version>2.1</version></dependency><!-- GENERAL UTILS end --><!-- OTHER UTILS begin --><!-- pojo copy --><dependency><groupId>net.sf.dozer</groupId><artifactId>dozer</artifactId><version>5.3.2</version></dependency><!-- excel --><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.7</version></dependency><!-- validator --><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-validator</artifactId><version>4.2.0.Final</version></dependency><!-- httpclient --><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.2-beta1</version></dependency><!-- template engine --><dependency><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId><version>2.3.19</version></dependency><!-- email --><dependency><groupId>javax.mail</groupId><artifactId>mail</artifactId><version>1.4.5</version></dependency><dependency><groupId>javax.activation</groupId><artifactId>activation</artifactId><version>1.1.1</version></dependency><!-- international component for Unicode --><dependency><groupId>com.ibm.icu</groupId><artifactId>icu4j</artifactId><version>4.8.1.1</version></dependency><!-- OTHER UTILS end --><!-- TEST begin --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.10</version><scope>test</scope></dependency><dependency><groupId>org.hamcrest</groupId><artifactId>hamcrest-core</artifactId><version>1.3.RC2</version><scope>test</scope></dependency><dependency><groupId>org.hamcrest</groupId><artifactId>hamcrest-library</artifactId><version>1.3.RC2</version><scope>test</scope></dependency><dependency><groupId>org.mockito</groupId><artifactId>mockito-core</artifactId><version>1.9.0</version><scope>test</scope></dependency><dependency><groupId>org.powermock</groupId><artifactId>powermock-module-junit4</artifactId><version>1.4.11</version><scope>test</scope></dependency><dependency><groupId>org.powermock</groupId><artifactId>powermock-api-mockito</artifactId><version>1.4.11</version><scope>test</scope><exclusions><exclusion><groupId>org.mockito</groupId><artifactId>mockito-all</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${spring.version}</version><scope>test</scope></dependency><!-- jetty --><dependency><groupId>org.eclipse.jetty.aggregate</groupId><artifactId>jetty-webapp</artifactId><version>${jetty.version}</version><scope>test</scope></dependency><dependency><groupId>org.eclipse.jetty</groupId><artifactId>jetty-jsp</artifactId><version>${jetty.version}</version><scope>test</scope></dependency><!-- selenium 2.0 --><dependency><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-java</artifactId><version>${selenium.version}</version><scope>test</scope><exclusions><exclusion><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-android-driver</artifactId></exclusion><exclusion><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-iphone-driver</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-remote-driver</artifactId><version>${selenium.version}</version><scope>test</scope><exclusions><exclusion><groupId>cglib</groupId><artifactId>cglib-nodep</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.dbunit</groupId><artifactId>dbunit</artifactId><version>2.4.8</version><scope>test</scope></dependency><!-- TEST end --><!-- perf4j --><dependency><groupId>org.perf4j</groupId><artifactId>perf4j</artifactId><version>0.9.16</version></dependency></dependencies></dependencyManagement><!-- 插件配置 --><build><pluginManagement><plugins><!-- compiler插件, 设定JDK版本 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><source>${jdk.version}</source><target>${jdk.version}</target><showWarnings>true</showWarnings></configuration></plugin><!-- test插件, 增大内存且仅测试名称为*Test的类 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.12</version><configuration><includes><include>**/*Test.java</include></includes></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-failsafe-plugin</artifactId><version>2.12</version><dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit47</artifactId> <version>2.12</version> </dependency> </dependencies> <executions><execution><id>integration-test</id><goals><goal>integration-test</goal></goals></execution></executions> </plugin><!-- cobertura插件 --><plugin><groupId>org.codehaus.mojo</groupId><artifactId>cobertura-maven-plugin</artifactId><version>2.5.1</version></plugin><!-- war插件, 设定war名称不带版本号 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.2</version><configuration><warName>${project.artifactId}</warName></configuration></plugin><!-- resource插件, 设定编码 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>2.5</version><configuration><encoding>${project.build.sourceEncoding}</encoding></configuration></plugin><!-- jar相关插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><version>2.4</version><configuration><archive><manifest><addDefaultImplementationEntries>true</addDefaultImplementationEntries><addDefaultSpecificationEntries>true</addDefaultSpecificationEntries></manifest></archive></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>2.1.2</version></plugin><!-- clean插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-clean-plugin</artifactId><version>2.4.1</version></plugin><!-- install插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-install-plugin</artifactId><version>2.3.1</version></plugin><!-- eclipse插件,设定下载Source --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-eclipse-plugin</artifactId><version>2.9</version><configuration><downloadSources>true</downloadSources><downloadJavadocs>false</downloadJavadocs></configuration></plugin><!-- jetty插件,设定重载模式 --><plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>${jetty.version}</version><configuration><reload>manual</reload></configuration></plugin><!-- dependency插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>2.4</version></plugin><plugin><groupId>org.codehaus.mojo</groupId><artifactId>versions-maven-plugin</artifactId><version>1.3.1</version></plugin><!-- ant插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId><version>1.7</version></plugin><!-- exec java 插件 --><plugin><groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>1.2.1</version></plugin><!-- sonar插件 --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>sonar-maven-plugin</artifactId> <version>2.0</version> </plugin></plugins></pluginManagement></build><modules><module>aurora-core</module><module>aurora-service</module><module>aurora-web</module></modules></project>