即使我在POM.xml中包含了所有依赖项,我在“mvn install”时遇到符号未找到错误

时间:2017-09-03 20:09:52

标签: java maven rest-assured

我是maven的新手。请帮忙! 即使我在POM.xml中包含了所有依赖项,但在“mvn install”时我得到符号未找到错误。

以下是完整的堆栈跟踪供您参考 -

[INFO] Scanning for projects...
[INFO] Building XDMS Automation 0.0.1-SNAPSHOT
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ XDMS ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ XDMS ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to C:\JavaProgs\xdms\target\classes
[INFO] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java: Some input files use unchecked or unsafe operations.
[INFO] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java: Recompile with -Xlint:unchecked for details.
[ERROR] COMPILATION ERROR : 
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[7,22] package io.restassured does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[8,29] package io.restassured.config does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[10,30] package io.restassured.parsing does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[13,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[14,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[15,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[17,29] cannot find symbol
  symbol:   class RestAssured
  location: package io.restassured
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[17,1] static import only from classes and interfaces
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[27,18] package org.testng does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[28,18] package org.testng does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[32,26] package org.testng.asserts does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[12,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[15,22] cannot find symbol
  symbol:   class RestAssured
  location: package io.restassured
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[21,1] static import only from classes and interfaces
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[23,1] package io.restassured.RestAssured does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[25,1] package org.hamcrest.Matchers does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[45,29] cannot find symbol
  symbol:   class ITestResult
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[151,12] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/resources/TestNGPagefactoryRunnerTest.java:[3,24] package org.junit.runner does not exist
[ERROR] /C:/..../TestNGPagefactoryRunnerTest.java:[6,26] package cucumber.api.junit does not exist
[ERROR] /C:/../TestNGPagefactoryRunnerTest.java:[9,2] cannot find symbol
  symbol: class RunWith
[ERROR] /C:/.../CommonFunctions.java:[8,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/resources/StepDefCommon.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/resources/StepDefCommon.java:[8,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[44,10] cannot find symbol
  symbol:   class AfterMethod
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[59,10] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[69,10] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[82,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/.../SmokeTest.java:[104,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/.../SmokeTest.java:[119,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/.../SmokeTest.java:[135,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/.../SmokeTest.java:[156,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[166,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[184,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[207,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[236,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[244,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[252,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[269,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[276,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[283,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[304,6] cannot find symbol
  symbol:   class Test
  location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[43,10] cannot find symbol
  symbol:   class BeforeSuite
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[103,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[154,11] cannot find symbol
  symbol:   variable RestAssured
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[155,11] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[155,26] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[168,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[170,78] cannot find symbol
  symbol:   variable XmlConfig
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[170,47] cannot find symbol
  symbol:   variable RestAssured
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[168,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[179,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[179,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[189,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[196,40] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[211,25] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[213,92] cannot find symbol
  symbol:   variable XmlConfig
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[213,55] cannot find symbol
  symbol:   variable RestAssuredConfig
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[211,40] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[228,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[228,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[243,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[243,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[254,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[254,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[272,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[272,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[284,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[284,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[294,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[294,32] cannot find symbol
  symbol:   method given()
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[304,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[306,17] cannot find symbol
  symbol:   class Response
  location: class restprograms.GrpUpdates
[INFO] 100 errors 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project XDMS: Compilation failure: Compilation failure:
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[7,22] package io.restassured does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[8,29] package io.restassured.config does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[10,30] package io.restassured.parsing does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[13,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[14,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[15,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[17,29] cannot find symbol
[ERROR] symbol:   class RestAssured
[ERROR] location: package io.restassured
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[17,1] static import only from classes and interfaces
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[27,18] package org.testng does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[28,18] package org.testng does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[29,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[31,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[32,26] package org.testng.asserts does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[12,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[13,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[14,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[15,22] cannot find symbol
[ERROR] symbol:   class RestAssured
[ERROR] location: package io.restassured
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[16,29] package io.restassured.config does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[17,29] package io.restassured.config does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[19,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[21,29] cannot find symbol
[ERROR] symbol:   class RestAssured
[ERROR] location: package io.restassured
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[21,1] static import only from classes and interfaces
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[23,1] package io.restassured.RestAssured does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[24,1] package io.restassured.matcher.RestAssuredMatchers does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[25,1] package org.hamcrest.Matchers does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[45,29] cannot find symbol
[ERROR] symbol:   class ITestResult
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[151,12] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[166,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[177,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[207,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[222,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[240,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[251,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[263,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[282,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[292,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[302,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[335,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[345,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[355,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[368,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[378,16] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/resources/TestNGPagefactoryRunnerTest.java:[3,24] package org.junit.runner does not exist
[ERROR] /C:/JavaProgs/xdms/src/resources/TestNGPagefactoryRunnerTest.java:[6,26] package cucumber.api.junit does not exist
[ERROR] /C:/JavaProgs/xdms/src/resources/TestNGPagefactoryRunnerTest.java:[9,2] cannot find symbol
[ERROR] symbol: class RunWith
[ERROR] /C:/JavaProgs/xdms/src/restprograms/CommonFunctions.java:[8,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/resources/StepDefCommon.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/JavaProgs/xdms/src/resources/StepDefCommon.java:[8,31] package io.restassured.response does not exist
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[44,10] cannot find symbol
[ERROR] symbol:   class AfterMethod
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[59,10] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[69,10] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[82,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[104,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[119,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[135,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[156,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[166,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[184,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[207,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[236,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[244,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[252,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[269,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[276,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[283,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/SmokeTest.java:[304,6] cannot find symbol
[ERROR] symbol:   class Test
[ERROR] location: class restprograms.SmokeTest
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[43,10] cannot find symbol
[ERROR] symbol:   class BeforeSuite
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[103,17] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[103,32] cannot find symbol
[ERROR] symbol:   method given()
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[119,17] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[119,32] cannot find symbol
[ERROR] symbol:   method given()
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[154,11] cannot find symbol
[ERROR] symbol:   variable RestAssured
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[155,11] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[155,26] cannot find symbol
[ERROR] symbol:   method given()
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[168,17] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[170,78] cannot find symbol
[ERROR] symbol:   variable XmlConfig
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[170,47] cannot find symbol
[ERROR] symbol:   variable RestAssured
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[168,32] cannot find symbol
[ERROR] symbol:   method given()
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[179,17] cannot find symbol
[ERROR] symbol:   class Response
[ERROR] location: class restprograms.GrpUpdates
[ERROR] /C:/JavaProgs/xdms/src/restprograms/GrpUpdates.java:[179,32] cannot find symbol
[ERROR] symbol:   method given()
[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

这是我的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>MyProject</groupId>
  <artifactId>MyProject</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>MyProject Automation</name>
  <description>MyProject Automation with Rest Assured</description>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>

    </plugins>
  </build>

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

  <dependencies>
 <!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>3.0.3</version>
      <scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/xml-path -->
<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>xml-path</artifactId>
    <version>3.0.3</version>
</dependency>


<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.11</version>
    <scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>


<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-testng -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-testng</artifactId>
    <version>1.2.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-core -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-core</artifactId>
    <version>1.2.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-picocontainer</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>

  </dependencies> 
</project>

自上周以来,我一直坚持这一点。在stackoverflow上尝试了所有相同的错误描述!仍然没有运气,因此发布了问题。 谢谢你的帮助!

4 个答案:

答案 0 :(得分:0)

您最好遵循标准的Maven目录布局,例如src/main/javasrc/test/java等。

在这种情况下的问题可能是你包括

<dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>3.0.3</version>
      <scope>test</scope>
</dependency>

在测试范围内,但在看似“主要”代码中使用它。

答案 1 :(得分:0)

感谢“lexicore”提出的建议。即使我根据你的建议创建了目录结构并复制了文件,我仍然会收到错误。

这个错误消失了,当我在POM.xml中评论以下行时,我能够通过eclipse运行“maven install”

  <build>
    <!-- <sourceDirectory>src</sourceDirectory> -->
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>

答案 2 :(得分:0)

我面临着同样的问题。我评论了其中的范围测试部分, 因为使用的是标准的Maven目录布局,例如src / main / java,src / test / java等。

答案 3 :(得分:0)

解决此问题的另一种方法是

1。打开POM.xml 2.导航到依赖项选项卡 3.选择放心单击属性按钮 4.在范围字段中,更改测试的值 编译。 5.保存并再次运行。

enter image description here