• eclipse maven工程错误总汇


    1、问题:

             Target runtime Apache Tomcat v7.0 is not defined

       解决方法:

              right click on your project > Properties > Targeted Runtime > Click the version required 8.0 

       相关资料:

                 问题网址

    2、问题:

               Maven项目中的Dynamic Web Module 3.0 requires Java 1.6 or newer

         解决方法

              在项目的pom.xml的 build 标签中加入:

        

    <plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-compiler-plugin</artifactId>  
            <version>2.3.2</version>  
            <configuration>  
                <source>1.7</source>  
                <target>1.7</target>  
            </configuration>  
        </plugin>  
    </plugins> 

        相关资料:

            http://blog.csdn.net/liuxinghao/article/details/37088063

    3、问题

    Cannot change version of project facet Dynamic web module to 3.0

    解决方法

    打开工程目录下的.settings文件夹中的 org.eclipse.wst.common.project.facet.core.xml文件修改标签 facet="jst.web" 中的version版本为3.0,

    修改后如下所示:

    <faceted-project>
      <fixed facet="wst.jsdt.web"/>
      <installed facet="jst.web" version="3.0"/>
      <installed facet="wst.jsdt.web" version="1.0"/>
      <installed facet="jst.jaxrs" version="2.0"/>
      <installed facet="java" version="1.7"/>
      <installed facet="jst.jsf" version="2.2"/>
    </faceted-project>

     4、问题

    cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation- driven'

    解决办法

    在 spring-mybatis.xml的标签 http://www.springframework.org/schema/context/spring-context-3.5.xsd 中,去掉后面的版本号

    5、问题

    Failed to read artifact descriptor for org.springframework:spring-orm:jar:${spring.version}

    解决办法

    因为上面jar包的版本是用变量定义的,所有需要定义变量的版本号,下面就是定义spring的包的版本号。

      <properties>
            <spring.version>3.1.1.RELEASE</spring.version>
            <org.aspectj-version>1.6.10</org.aspectj-version>
            <org.slf4j-version>1.6.6</org.slf4j-version>
        </properties>

     6、问题

    Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml]

    解决办法

    在WEB-INF文件夹中找到web.xml,在该文件中添加server配置,如下所示:

    <!-- 前端控制器 -->
    <servlet>
    <!-- 名称,真实的文件名需要在这个名字后面加上-servlet后缀 -->
    <servlet-name>spring-mvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <!--设置spring-mvc.xml文件路径,确保和文件名相同-->
    <param-value>classpath:spring-mvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    spring-mvc.xml 配置文件在src/main/resource文件夹中。用于启动对应的控制器(controller),核心配置如下:

    <context:component-scan base-package="com.bicycleway.controller" />  

    base-package 后面的内容要和服务类相同,如下图所示:

     7.问题

    1、Failed to read artifact descriptor 
    2、Cannot find the declaration of element 'beans'.
    解决办法
    在更新项目的时候,勾选 "Force Update of Snapshot/Releases",如下图所示:

    8、java.lang.NullPointerException

    可能是方法没有真确的调用,调用的服务没有使用@Resource

    笔记

    1、maven插件和仓库配置

    打开下载下来的maven包的settings.xml文件,路径如下:F:workspaceapache-maven-3.3.9conf

    配置仓库地址,如下图:

    网络资源:

    http://stackoverflow.com/questions/23290699/cvc-complex-type-2-4-c-the-matching-wildcard-is-strict-but-no-declaration-can

    https://stackoverflow.com/questions/18145774/eclipse-an-error-occurred-while-filtering-resources

    9、

    Cannot change version of project facet Dynamic web module to 2.5

    将web.xml进行修改:

    修改前:

    !DOCTYPE web-app PUBLIC  
     "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"  
     "http://java.sun.com/dtd/web-app_2_3.dtd" >  
      
    <web-app>  
      <display-name>Archetype Created Web Application</display-name>  
    </web-app>  

    修改后:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
      <display-name>Archetype Created Web Application</display-name>
    </web-app>
  • 相关阅读:
    第二阶段冲刺站立会议报告
    09软件工程读后感之三
    08软件工程读后感之二
    07软件工程读后感之一
    一个整数数组中最大字数组二
    返回一个二维数组最大联通子数组的和
    项目阶段总结
    大道至简阅读笔记之三
    大道至简阅读笔记二
    课堂设计
  • 原文地址:https://www.cnblogs.com/GIScore/p/6844813.html
Copyright © 2020-2023  润新知