简体   繁体   中英

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1

i am facing issue while compiling my maven project through command prompt, need help Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project Automation: Compilation failure: Compilation failure: i am using JDK14 and latest eclipse IDE Version: 2020-03 (4.15.0)

Error message:

[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/kits/sit/Base_Setup/BQUK_Agent_Flow.java:[50,39] unmappable character (0x93) for encoding UTF-8
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/kits/sit/Base_Setup/BQUK_Agent_Flow.java:[50,66] unmappable character (0x94) for encoding UTF-8
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[3,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[11,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[12,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[13,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[14,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[15,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[16,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[17,22] package org.testng.xml does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[23,48] cannot find symbol
[ERROR]   symbol: class IReporter
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[31,37] cannot find symbol
[ERROR]   symbol:   class XmlSuite
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[31,63] cannot find symbol
[ERROR]   symbol:   class ISuite
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[52,33] cannot find symbol
[ERROR]   symbol:   class IResultMap
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/RetryAnalyzer.java:[4,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/RetryAnalyzer.java:[5,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/RetryAnalyzer.java:[6,39] cannot find symbol
[ERROR]   symbol: class IRetryAnalyzer
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/RetryAnalyzer.java:[25,30] cannot find symbol
[ERROR]   symbol:   class ITestResult
[ERROR]   location: class com.qa.analyzer.RetryAnalyzer
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/MyTransformer.java:[6,18] package org.testng does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/MyTransformer.java:[7,30] package org.testng.annotations does not exist
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/MyTransformer.java:[11,39] cannot find symbol
[ERROR]   symbol: class IAnnotationTransformer
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/analyzer/MyTransformer.java:[13,31] cannot find symbol
[ERROR]   symbol:   class ITestAnnotation
[ERROR]   location: class com.qa.analyzer.MyTransformer
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[36,26] cannot find symbol
[ERROR]   symbol:   class ISuite
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[37,49] cannot find symbol
[ERROR]   symbol:   class ISuiteResult
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[39,42] cannot find symbol
[ERROR]   symbol:   class ISuiteResult
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[40,53] cannot find symbol
[ERROR]   symbol:   class ITestContext
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] /C:/work/Automation Learning/Automation-testing-practise/src/main/java/com/qa/ExtentReportListener/AutomationExtentReport.java:[56,42] cannot find symbol
[ERROR]   symbol:   class ITestResult
[ERROR]   location: class com.qa.ExtentReportListener.AutomationExtentReport
[ERROR] -> [Help 1]

POM.xml that i am using:

<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.kingfisher</groupId>
  <artifactId>Automation</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven Quick Start Archetype</name>
  <url>http://maven.apache.org</url>


   <properties>

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

    <maven.compiler.source>1.8</maven.compiler.source>

    <maven.compiler.target>1.8</maven.compiler.target>

  </properties>


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






    </pluginManagement>
  </build>









  <dependencies>
    <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
</dependency>

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.3</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.17</version>
</dependency>

<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>6.8</version>
  <scope>test</scope>
</dependency>

<dependency>
    <groupId>com.relevantcodes</groupId>
    <artifactId>extentreports</artifactId>
    <version>2.41.2</version>
</dependency>

<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>

  </dependencies>
</project>

First of all remove the unwanted testng dependency from the POM.xml and second you have added the scope as test in the testng dependency. You have also accessed the class file of the testng dependency with the scope test in src/main/java. Please remove the test scope from the dependency and then execute the test again. Let me know if the issue persists even after fixing the above issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM