Maven搭建SSH案例(一)-----常见报错解决

Maven搭建SSH框架(一)

1.      创建一个maven工程

2.      此时创建成功后会有很多问题需要解决

l  解决jsp页面报错

       在build path 页面给项目加入Tomcat

l  修改JDK版本,默认的为1.5,修改为自己的版本

l  编写pop.xml文件,保存,eclipse会自动下载相关jar包,但是pop.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/maven-v4_0_0.xsd">

 

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.zys</groupId>

  <artifactId>mssh</artifactId>

  <packaging>war</packaging>

  <version>0.0.1-SNAPSHOT</version>

  <name>mssh Maven Webapp</name>

  <url>http://maven.apache.org</url>

 

  <properties>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  </properties>

 

  <dependencies>

    <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>4.10</version>

      <scope>test</scope>

    </dependency>

 

    <!-- 添加SSH依赖 --> 

    <!-- Struts2 --> 

    <dependency> 

        <groupId>org.apache.struts</groupId> 

        <artifactId>struts2-core</artifactId> 

        <version>2.3.1</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.apache.struts</groupId> 

        <artifactId>struts2-spring-plugin</artifactId> 

        <version>2.3.1</version> 

    </dependency> 

 

      

    <!-- 添加Hibernate依赖 --> 

    <dependency> 

        <groupId>org.hibernate</groupId> 

        <artifactId>hibernate-core</artifactId> 

        <version>3.6.5.Final</version> 

    </dependency> 

 

    <dependency> 

        <groupId>commons-dbcp</groupId> 

        <artifactId>commons-dbcp</artifactId> 

        <version>1.4</version> 

    </dependency> 

 

 

    <!-- 添加Log4J依赖 --> 

    <dependency> 

        <groupId>log4j</groupId> 

        <artifactId>log4j</artifactId> 

        <version>1.2.16</version> 

    </dependency> 

 

    <dependency> 

      <groupId>org.slf4j</groupId> 

      <artifactId>slf4j-api</artifactId> 

      <version>1.6.1</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.slf4j</groupId> 

        <artifactId>slf4j-nop</artifactId> 

        <version>1.6.4</version> 

    </dependency> 

      

 

    <!-- 添加javassist --> 

    <dependency> 

        <groupId>javassist</groupId> 

        <artifactId>javassist</artifactId> 

        <version>3.11.0.GA</version> 

    </dependency> 

      

 

    <!-- 添加Spring依赖 --> 

    <dependency> 

        <groupId>org.springframework</groupId> 

        <artifactId>spring-core</artifactId> 

        <version>3.1.1.RELEASE</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.springframework</groupId> 

        <artifactId>spring-beans</artifactId> 

        <version>3.1.1.RELEASE</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.springframework</groupId> 

        <artifactId>spring-context</artifactId> 

        <version>3.1.1.RELEASE</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.springframework</groupId> 

        <artifactId>spring-jdbc</artifactId> 

        <version>3.1.1.RELEASE</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.springframework</groupId> 

        <artifactId>spring-orm</artifactId> 

        <version>3.1.1.RELEASE</version> 

    </dependency> 

 

    <dependency> 

        <groupId>org.springframework</groupId> 

        <artifactId>spring-web</artifactId> 

        <version>3.1.1.RELEASE</version> 

    </dependency> 

  </dependencies>

 

  <build>

    <finalName>mssh</finalName>

  </build>

</project>

 

解决错误:右键项目-à Maven--à update project---à勾选“forceupdate of Snapshots/Releases”---à 确认,等待片刻,错误提示消失。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小胖墩有点瘦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值