Maven实现SSM框架pom.xml实现(版本号:Spring4.2.4+Mybatis3.4.2)

导读:本篇文章讲解 Maven实现SSM框架pom.xml实现(版本号:Spring4.2.4+Mybatis3.4.2),希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

看到很多文章和视频都采用Maven整合SSM,花了一天时间终于跑起来了,话不说话,先分享给大家

 

这里提供不用maven搭建的SSM框架整合jar包:

https://download.csdn.net/download/qq_39809458/10677204

 

一:准备材料

Eclipse+Maven+jdk+Tomcat,安装不多说了。

 

二:Eclipse新建Maven项目

File->New->MavenProject

Maven实现SSM框架pom.xml实现(版本号:Spring4.2.4+Mybatis3.4.2)

Maven实现SSM框架pom.xml实现(版本号:Spring4.2.4+Mybatis3.4.2)

三:构建目录结构

创建自己喜欢的目录结构,体现架构思想 

Maven实现SSM框架pom.xml实现(版本号:Spring4.2.4+Mybatis3.4.2)

四:添加依赖

在pom.xml声明依赖,利用该网站查找配置写法(http://mvnrepository.com/),示范如下:

     <properties>
     	<!-- spring版本号 -->
        <srping.version>4.2.4.RELEASE</srping.version>
        <!-- mybatis版本号 --> 
        <mybatis.version>3.4.2</mybatis.version>
        <!-- log4j日志文件管理包版本 -->  
        <slf4j.version>1.7.22</slf4j.version>    
        <log4j.version>1.2.17</log4j.version>
        <!-- JSON处理版本 -->
        <jackson.version>2.8.1</jackson.version>    
    </properties>
	  <dependencies>
	    <dependency>
	      <groupId>junit</groupId>
	      <artifactId>junit</artifactId>
	      <version>4.12</version>
	      <scope>test</scope>
	    </dependency>
	    <!-- servlet -->
	    <dependency>
	        <groupId>javax.servlet</groupId>
	        <artifactId>javax.servlet-api</artifactId>
	        <version>3.1.0</version>
	        <scope>provided</scope>
	    </dependency>
	    <!--javaee  支持-->
	    <dependency>
	      <groupId>javaee</groupId>
	      <artifactId>javaee-api</artifactId>
	      <version>5</version>
	    </dependency>
        <!-- jstl标签类 -->    
        <dependency>    
            <groupId>jstl</groupId>    
            <artifactId>jstl</artifactId>    
            <version>1.2</version>    
        </dependency>
        <dependency>
	      <groupId>org.javassist</groupId>
	      <artifactId>javassist</artifactId>
	      <version>3.21.0-GA</version>
    	</dependency>  
        <!-- spring框架包 start -->    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-test</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-core</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-oxm</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-tx</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-jdbc</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-aop</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-context</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-context-support</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-expression</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-orm</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-web</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.springframework</groupId>    
            <artifactId>spring-webmvc</artifactId>    
            <version>${srping.version}</version>    
        </dependency>    
        <!-- spring框架包 end -->    
        <!-- mybatis框架包 start -->    
        <dependency>    
            <groupId>org.mybatis</groupId>    
            <artifactId>mybatis</artifactId>    
            <version>${mybatis.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.mybatis</groupId>    
            <artifactId>mybatis-spring</artifactId>    
            <version>1.3.1</version>    
        </dependency>
        <!-- cglib代理 -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>3.2.4</version>
        </dependency>
        <!-- 数据源 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.10</version>
        </dependency>
        <!-- 常用处理事务和AOP所需的包 -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.7</version>
        </dependency>  
        <!-- mybatis框架包 end -->    
        <!-- 数据库驱动 -->    
        <dependency>    
            <groupId>mysql</groupId>    
            <artifactId>mysql-connector-java</artifactId>    
            <version>5.1.45</version>    
        </dependency>  
        <!-- log日志组件 start -->    
        <dependency>    
            <groupId>log4j</groupId>    
            <artifactId>log4j</artifactId>    
            <version>${log4j.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.slf4j</groupId>    
            <artifactId>slf4j-api</artifactId>    
            <version>${slf4j.version}</version>    
        </dependency>    
        <dependency>    
            <groupId>org.slf4j</groupId>    
            <artifactId>slf4j-log4j12</artifactId>    
            <version>${slf4j.version}</version>    
        </dependency>
        <dependency>    
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>    
            <version>1.2</version>    
        </dependency>    
        <!-- log END -->    
        <!-- Json start-->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.47</version>
        </dependency> 
		<dependency>
		    <groupId>com.fasterxml.jackson.core</groupId>
		    <artifactId>jackson-databind</artifactId>
		    <version>${jackson.version}</version>
		</dependency>
		<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>
		<!-- JSON end -->  
        <!-- 上传组件包 start -->    
        <dependency>    
            <groupId>commons-fileupload</groupId>    
            <artifactId>commons-fileupload</artifactId>    
            <version>1.3.3</version>    
        </dependency>    
        <dependency>    
            <groupId>commons-io</groupId>    
            <artifactId>commons-io</artifactId>    
            <version>2.5</version>    
        </dependency>
        <!-- 字符串编解码 -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>    
        <!-- 上传组件包 end -->    
  </dependencies>
  
  <build>
    <finalName>MavenSMM01</finalName>
    
		<plugins>
			<!-- 定义项目编译级别 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<!-- 指定源码使用的JDK版本 -->
					<source>1.8</source>
					<!-- 指定打包使用的JDK版本 -->
					<target>1.8</target>
					<!-- 设置编码方式 -->
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
  </build>

声明依赖后,此时jar包会自动下载

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/15238.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!