Spring3已经不是新鲜玩意了,最近才拿来试试,每次构建项目都是件头疼的事情,结合maven nexus本地库相对要方便很多,只是前期工作也不少比如库的下载,上传到nexus。。。等等都是很麻烦的事,搞了我2天,才完成了spring最小依赖的例子,在这里记录下步骤(老了,忘事的很):
工具:eclipse-jee(maven 插件), maven2, nexus.
1.开始创建项目:mvn archetype:generate
默认选项50,1.0,group id: com.allen, arctifactid: testspring(maven2 基础东西,不知道的可以搜索下)
2. 进入创建好的testspring ,覆盖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>
<groupId>com.allen</groupId>
<artifactId>testspring</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>testspring</name>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.beans</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context.support</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.asm</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.expression</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<!-- Indicate the JDK version and encoding -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
OK ,可以从dependency标签中看出spring3的最小依赖了
再运行下mvn eclipse:eclipse
好像不能添加附件,我本地nexus库已经上传了相关的依赖库,thirdparty.zip,解压到你的nexus里面就行了。。。