当我尝试升级Spring Framework版本时,整个项目都有问题

时间:2018-11-02 08:55:04

标签: java spring spring-mvc

我当前正在使用Spring Framework版本4.1.6.RELEASE。当我尝试将其版本升级到4.2.4.RELEASE时,我的项目遇到了麻烦。

将版本升级到4.1.7-4.2.3完全可以,但是我需要4.2.4以上的版本。谁能告诉我这是怎么回事?

这是我的整个pom.xml。 现在,当我使用jUnit测试api时,我也遇到了这个问题。

<?xml version="1.0" encoding="UTF-8"?>
<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.isu</groupId>
    <artifactId>ifm</artifactId>
    <name>IfMobileHrAdapterService</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <!-- Generic properties -->
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Spring -->
        <springframework.version>4.2.5.RELEASE</springframework.version>
        <springframework.jpa.version>1.8.0.RELEASE</springframework.jpa.version>
        <springframework.ldap.version>2.0.3.RELEASE</springframework.ldap.version>

        <!-- Mysql -->
        <db.version>5.1.35</db.version>

        <!-- Hibernate / JPA -->
        <hibernate.version>4.3.8.Final</hibernate.version>
        <hibernate.validator.version>5.1.3.Final</hibernate.validator.version>
        <hibernate.core.version>4.3.8.Final</hibernate.core.version>

        <org.aspectj-version>1.8.5</org.aspectj-version>
        <!-- Logging -->
        <org.slf4j-version>1.6.6</org.slf4j-version>

        <!-- Test -->
        <junit.version>4.11</junit.version>

    </properties>

    <repositories>
        <repository>
            <id>thirdparty</id>
            <url>http://hatch.pearbranch.com:8081/content/repositories/thirdparty</url>
        </repository>
    </repositories>


    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.apache.tika/tika-core -->
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.8</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.tika/tika -->
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika</artifactId>
            <version>1.8</version>
            <type>pom</type>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.2</version>
        </dependency>

        <!-- Oracle -->
        <dependency>
            <groupId>oracle</groupId>
            <artifactId>OracleDriver</artifactId>
            <version>11.2.0.1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ojdbc6.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>log4sql</groupId>
            <artifactId>log4sql</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/log4sql.jar</systemPath>
        </dependency>


        <!-- JSON -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20141113</version>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
        </dependency>


        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${springframework.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>




        <!-- https://mvnrepository.com/artifact/log4j/apache-log4j-extras -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>apache-log4j-extras</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${springframework.version}</version>
        </dependency>


    </dependencies>

    <build>
        <!-- <sourceDirectory>src</sourceDirectory> -->
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
PS D:\Workspace\SpringToolSuiteProjects\ifMobileApiUnitTest> mvn clean package
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.isu:ifm:war:1.0.0-BUILD-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for oracle:OracleDriver:jar should not point at files within the project directory, ${basedir}/src/main/webapp/WEB-INF/lib/ojdbc6.jar will be unresolvable by dependent projects @ line 76, column 16
[WARNING] 'dependencies.dependency.systemPath' for log4sql:log4sql:jar should not point at files within the project directory, ${basedir}/src/main/webapp/WEB-INF/lib/log4sql.jar will be unresolvable by dependent projects @ line 84, column 16
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-beans:jar -> duplicate declaration of version ${springframework.version} @ line 178, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ----------------------------< com.isu:ifm >-----------------------------
[INFO] Building IfMobileHrAdapterService 1.0.0-BUILD-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ifm ---
[INFO] Deleting D:\Workspace\SpringToolSuiteProjects\ifMobileApiUnitTest\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ifm ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ ifm ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to D:\Workspace\SpringToolSuiteProjects\ifMobileApiUnitTest\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[4,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[5,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[6,24] package org.junit.runner does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[7,19] package org.mockito does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[8,19] package org.mockito does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[9,19] package org.mockito does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[18,30] package com.isu.ifm.hr.control does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[19,30] package com.isu.ifm.hr.service does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[21,2] cannot find symbol
  symbol: class RunWith
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[26,23] cannot find symbol
  symbol:   class LoginService
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[27,30] cannot find symbol
  symbol:   class LoginController
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[4,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[5,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[6,24] package org.junit.runner does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[14,30] package com.isu.ifm.hr.control does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[16,2] cannot find symbol
  symbol: class RunWith
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[23,9] cannot find symbol
  symbol:   class SalaryController
  location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[4,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[6,24] package org.junit.runner does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[14,30] package com.isu.ifm.hr.control does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[16,2] cannot find symbol
  symbol: class RunWith
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[23,9] cannot find symbol
  symbol:   class EDocumentController
  location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[26,10] cannot find symbol
  symbol:   class Mock
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[27,10] cannot find symbol
  symbol:   class InjectMocks
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[34,6] cannot find symbol
  symbol:   class Before
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[40,6] cannot find symbol
  symbol:   class Test
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[25,6] cannot find symbol
  symbol:   class Before
  location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[30,6] cannot find symbol
  symbol:   class Test
  location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[25,6] cannot find symbol
  symbol:   class Before
  location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[30,6] cannot find symbol
  symbol:   class Test
  location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[36,9] cannot find symbol
  symbol:   variable MockitoAnnotations
  location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[23,49] cannot find symbol
  symbol:   class SalaryController
  location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[23,55] cannot find symbol
  symbol:   class EDocumentController
  location: class com.isu.ifm.testcase.EDocumentControllerTest
[INFO] 33 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.814 s
[INFO] Finished at: 2018-11-02T18:07:26+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project ifm: Compilation failure: Compilation failure:
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[4,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[5,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[6,24] package org.junit.runner does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[7,19] package org.mockito does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[8,19] package org.mockito does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[9,19] package org.mockito does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[18,30] package com.isu.ifm.hr.control does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[19,30] package com.isu.ifm.hr.service does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[21,2] cannot find symbol
[ERROR]   symbol: class RunWith
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[26,23] cannot find symbol
[ERROR]   symbol:   class LoginService
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[27,30] cannot find symbol
[ERROR]   symbol:   class LoginController
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[4,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[5,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[6,24] package org.junit.runner does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[14,30] package com.isu.ifm.hr.control does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[16,2] cannot find symbol
[ERROR]   symbol: class RunWith
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[23,9] cannot find symbol
[ERROR]   symbol:   class SalaryController
[ERROR]   location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[4,17] package org.junit does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[6,24] package org.junit.runner does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[14,30] package com.isu.ifm.hr.control does not exist
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[16,2] cannot find symbol
[ERROR]   symbol: class RunWith
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[23,9] cannot find symbol
[ERROR]   symbol:   class EDocumentController
[ERROR]   location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[26,10] cannot find symbol
[ERROR]   symbol:   class Mock
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[27,10] cannot find symbol
[ERROR]   symbol:   class InjectMocks
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[34,6] cannot find symbol
[ERROR]   symbol:   class Before
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[40,6] cannot find symbol
[ERROR]   symbol:   class Test
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[25,6] cannot find symbol
[ERROR]   symbol:   class Before
[ERROR]   location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[30,6] cannot find symbol
[ERROR]   symbol:   class Test
[ERROR]   location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[25,6] cannot find symbol
[ERROR]   symbol:   class Before
[ERROR]   location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[30,6] cannot find symbol
[ERROR]   symbol:   class Test
[ERROR]   location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/LoginControllerTest.java:[36,9] cannot find symbol
[ERROR]   symbol:   variable MockitoAnnotations
[ERROR]   location: class com.isu.ifm.testcase.LoginControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/SalaryControllerTest.java:[23,49] cannot find symbol
[ERROR]   symbol:   class SalaryController
[ERROR]   location: class com.isu.ifm.testcase.SalaryControllerTest
[ERROR] /D:/Workspace/SpringToolSuiteProjects/ifMobileApiUnitTest/src/main/java/com/isu/ifm/testcase/EDocumentControllerTest.java:[23,55] cannot find symbol
[ERROR]   symbol:   class EDocumentController
[ERROR]   location: class com.isu.ifm.testcase.EDocumentControllerTest
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

2 个答案:

答案 0 :(得分:0)

只需更改版本即可,但是您必须遵循spring社区的指示。

但是在此之前,请清除m2存储库并执行全新安装以再次下载maven依赖项,以防jar损坏。

Upgrading-to-Spring-Framework-4.x

并尝试执行eclipse清理项目,然后Maven > update project应该可以解决您的问题。请按照以下步骤操作。

  1. 项目->清洁
  2. 重新启动Eclipse
  3. 先禁用然后重新启用依赖性管理(右键单击Maven->禁用依赖性管理,然后依次Maven->启用依赖性管理
  4. 关闭并重新打开项目
  5. 项目->运行方式-> Maven构建->将目标设置为clean install->选择选项Update Snapshots Debug Output Non Recursive Resolve Workspace Artifacts->应用并运行
  6. 从〜/ .m2 /存储库中删除依赖项后,重复步骤5
  7. 检查您的Maven设置是否正确配置。如果您位于代理之后,则需要在全局或用户设置中配置代理设置。

答案 1 :(得分:0)

我在更新春季版本时也遇到了同样的问题

我检查了您的POM.XML文件,所以没有杰克逊依赖项,因此请在下面的依赖项中添加它

<dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.1</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.8.1</version>
    </dependency>

如果您未使用以上依赖版本,请使用最新版本的依赖。