下载 🔗

SSM整合及Maven配置文件.zip
 ├── maven_ssm
 │   ├── pom.xml
 │   ├── pom_test.xml
 │   └── ssm
 │       ├── applicationContext_mapper.xml
 │       ├── applicationContext_service.xml
 │       ├── applicationContext_transaction.xml
 │       ├── db.properties
 │       ├── ItemMapper.xml
 │       ├── springmvc.xml
 │       └── web.xml
 ├── pom.xml
 └── web.xml

如何使用

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><!-- maven版本 -->
	<groupId>com.sikiedu</groupId><!-- 域名反写 + 项目名 -->
	<artifactId>HelloMaven</artifactId><!-- 项目名 子项目名 模块名 -->
	<version>0.0.1-SNAPSHOT</version><!-- 版本号-类型 -->
	<packaging>war</packaging><!-- 打包类型 -->
	<name>mavenProject</name><!-- 当前项目名 -->
	<description>我的第一个maven工程</description><!-- 项目描述 -->
	

	<dependencies><!-- 依赖标签 配置项目中依赖的jar包坐标 -->
	
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.9</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jsp-api</artifactId>
			<version>2.0</version>
			<scope>provided</scope>
		</dependency>

	</dependencies>
  
	
	<build>
		<plugins><!-- 插件列表 -->
			<plugin><!-- 通过坐标获取插件 -->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.0</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
  
</project>

SSM整合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>com.sikiedu</groupId>
  <artifactId>MavenSSM2</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  
  <properties>
  	<!-- lib version -->
  	<spring.version>5.0.8.RELEASE</spring.version>
  	<mybais.version>3.4.6</mybais.version>
  	<mybatis-spring.version>1.3.2</mybatis-spring.version>
  	<mysql-connector.version>5.1.46</mysql-connector.version>
  	<ojdbc7.version>12.1.0.2.0</ojdbc7.version>
  	<druid.version>1.0.16</druid.version>
  	<aopalliance.version>1.0</aopalliance.version>
  	<aspectj.weaver.version>1.6.4.RELEASE</aspectj.weaver.version>
  	<commons.logging.version>1.1.1</commons.logging.version>
  	<jstl.version>1.2</jstl.version>
  	<log4j.version>1.2.16</log4j.version>
  	<slf4j-api.version>1.6.1</slf4j-api.version>
  	<slf4j-nop.version>1.6.4</slf4j-nop.version>
  	<fileupload.version>1.3.1</fileupload.version>
  	<jackson.version>2.9.6</jackson.version>
  	<junit.version>4.9</junit.version>
  	<servlet-api.version>8.5.32</servlet-api.version>
  	<jsp-api.version>8.5.32</jsp-api.version>
  	
  	<!-- plugins version -->
  	<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
  	<tomcat7-maven-plugin.version>2.2</tomcat7-maven-plugin.version>
  </properties>
  
  <!-- 锁定版本, -->
  <dependencyManagement>
  	<dependencies>
  		 <!-- spring -->
		<dependency>
		    <groupId>org.springframework</groupId>
		    <artifactId>spring-core</artifactId>
		    <version>${spring.version}</version>
		</dependency>
	 	<dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-web</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-tx</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-jdbc</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-webmvc</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-aop</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-context-support</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <dependency>
		   <groupId>org.springframework</groupId>
		   <artifactId>spring-test</artifactId>
		   <version>${spring.version}</version>
	    </dependency>
	    <!-- spring end -->
	    
	     <!-- mybais -->
		<dependency>
		    <groupId>org.mybatis</groupId>
		    <artifactId>mybatis</artifactId>
		    <version>${mybais.version}</version>
		</dependency>
		<!-- mybatis - spring 整合包-->
		<dependency>
		    <groupId>org.mybatis</groupId>
		    <artifactId>mybatis-spring</artifactId>
		    <version>${mybatis-spring.version}</version>
		</dependency>
		
		<!-- json -->
		<dependency>
		    <groupId>com.fasterxml.jackson.core</groupId>
		    <artifactId>jackson-core</artifactId>
		    <version>${jackson.version}</version>
		</dependency>
		<dependency>
		    <groupId>com.fasterxml.jackson.core</groupId>
		    <artifactId>jackson-annotations</artifactId>
		    <version>${jackson.version}</version>
		</dependency>
		<dependency>
		    <groupId>com.fasterxml.jackson.core</groupId>
		    <artifactId>jackson-databind</artifactId>
		    <version>${jackson.version}</version>
		</dependency>
		<!-- json end -->
  	</dependencies>
  
  </dependencyManagement>
  
  <dependencies>
    <!-- spring -->
	<dependency>
	    <groupId>org.springframework</groupId>
	    <artifactId>spring-core</artifactId>
	</dependency>
 	<dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-tx</artifactId>
    </dependency>
    <dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-jdbc</artifactId>
    </dependency>
    <dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-webmvc</artifactId>
    </dependency>
    <dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-aop</artifactId>
    </dependency>
    <dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
	   <groupId>org.springframework</groupId>
	   <artifactId>spring-test</artifactId>
    </dependency>
    <!-- spring end -->
        
    <!-- mybais -->
	<dependency>
	    <groupId>org.mybatis</groupId>
	    <artifactId>mybatis</artifactId>
	</dependency>
	
	<!-- mybatis - spring 整合包-->
	<dependency>
	    <groupId>org.mybatis</groupId>
	    <artifactId>mybatis-spring</artifactId>
	</dependency>

	<!-- mysql -->
	<dependency>
	    <groupId>mysql</groupId>
	    <artifactId>mysql-connector-java</artifactId>
	    <version>${mysql-connector.version}</version>
	</dependency>

	<dependency>
	    <groupId>cn.easyproject</groupId>
	    <artifactId>ojdbc7</artifactId>
	    <version>${ojdbc7.version}</version>
	</dependency>
	<!-- mysql end -->
	
	 <!-- 阿里巴巴的数据库连接池 -->
	<dependency>
	    <groupId>com.alibaba</groupId>
	    <artifactId>druid</artifactId>
	    <version>${druid.version}</version>
	</dependency>
	
	<!-- aop -->
	<dependency>
	    <groupId>aopalliance</groupId>
	    <artifactId>aopalliance</artifactId>
	    <version>${aopalliance.version}</version>
	</dependency>
	
	<dependency>
	    <groupId>org.aspectj</groupId>
	    <artifactId>com.springsource.org.aspectj.weaver</artifactId>
	    <version>${aspectj.weaver.version}</version>
	</dependency>
	<!-- aop end -->
	
	<!-- logging -->
	<dependency>
	    <groupId>org.apache.commons</groupId>
	    <artifactId>com.springsource.org.apache.commons.logging</artifactId>
	    <version>${commons.logging.version}</version>
	</dependency>

	<!-- jsp标准标签库 -->
	<dependency>
		<groupId>javax.servlet</groupId>
		<artifactId>jstl</artifactId>
		<version>${jstl.version}</version>
	</dependency>
	
	<!-- log -->
	<dependency>
		<groupId>log4j</groupId>
		<artifactId>log4j</artifactId>
		<version>${log4j.version}</version>
	</dependency>
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-api</artifactId>
		<version>${slf4j-api.version}</version>
	</dependency>
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-nop</artifactId>
		<version>${slf4j-nop.version}</version>
	</dependency>
	<!-- log end -->

	<!--文件上传-->
	<dependency>  
		<groupId>commons-fileupload</groupId>  
		<artifactId>commons-fileupload</artifactId>  
		<version>${fileupload.version}</version>  
	</dependency>
	
	<!-- json -->
	<dependency>
	    <groupId>com.fasterxml.jackson.core</groupId>
	    <artifactId>jackson-core</artifactId>
	</dependency>
	<dependency>
	    <groupId>com.fasterxml.jackson.core</groupId>
	    <artifactId>jackson-annotations</artifactId>
	</dependency>
	<dependency>
	    <groupId>com.fasterxml.jackson.core</groupId>
	    <artifactId>jackson-databind</artifactId>
	</dependency>
	<!-- json end -->
	
	<!-- junit单元测试 -->
	<dependency>
	    <groupId>junit</groupId>
	    <artifactId>junit</artifactId>
	    <version>${junit.version}</version>
	    <scope>test</scope>
	</dependency>
	
	<!-- servlet-api 8.5.32 -->
	<dependency>
  		<groupId>org.apache.tomcat</groupId>
  		<artifactId>tomcat-servlet-api</artifactId>
  		<version>${servlet-api.version}</version>
  		<scope>provided</scope>
  	</dependency>
	<!-- jsp-api 8.5.32 -->
	<dependency>
	    <groupId>org.apache.tomcat</groupId>
	    <artifactId>tomcat-jsp-api</artifactId>
	    <version>${jsp-api.version}</version>
	    <scope>provided</scope>
	</dependency>
  </dependencies>
  
  <build>
  	<plugins>
  		<plugin>
  			<groupId>org.apache.maven.plugins</groupId>
  			<artifactId>maven-compiler-plugin</artifactId>
  			<version>${maven-compiler-plugin.version}</version>
  			<configuration>
  				<source>1.8</source>
				<target>1.8</target>  			
  			</configuration>
  		</plugin>
  		
  		<plugin>
  			<groupId>org.apache.tomcat.maven</groupId>
  			<artifactId>tomcat7-maven-plugin</artifactId>
  			<version>${tomcat7-maven-plugin.version}</version>
  			<configuration>
  				<url>http://localhost:8080/manager/text</url>
  				<username>joey</username>
  				<password>123123</password>
  			</configuration>
  		</plugin>
  		
  	</plugins>
  	
  	<!-- 配置文件放行 -->
    <resources>
		<resource>
			<directory>src/main/java</directory>
			<includes>
				<include>**/*.properties</include>
				<include>**/*.xml</include>
			</includes>
			<filtering>false</filtering>
		</resource>
		<!-- 放行main/resources下的配置文件 如果不放行spring mybatis等配置文件不会被打到包里从而导致错误 -->
		<resource>
			<directory>src/main/resources</directory>
			<includes>
				<include>**/*.properties</include>
				<include>**/*.xml</include>
			</includes>
			<filtering>false</filtering>
		</resource>
	</resources>
  </build>
  
 
</project>