Проблема с компиляцией Maven - PullRequest
0 голосов
/ 04 апреля 2020

При попытке встроить в jenkins проект E2E с использованием selenium wd и testng, я получил следующую ошибку:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[9,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[10,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[11,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[12,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[13,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[14,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[15,22] package org.testng.xml does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[21,42] cannot find symbol
  symbol: class IReporter
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,37] cannot find symbol
  symbol:   class XmlSuite
  location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,63] cannot find symbol
  symbol:   class ISuite
  location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[43,33] cannot find symbol
  symbol:   class IResultMap
  location: class resources.ExtentReporterNG
[INFO] 11 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.605 s
[INFO] Finished at: 2020-04-03T19:51:37-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project E2EProject: Compilation failure: Compilation failure: 
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[9,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[10,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[11,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[12,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[13,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[14,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[15,22] package org.testng.xml does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[21,42] cannot find symbol
[ERROR]   symbol: class IReporter
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,37] cannot find symbol
[ERROR]   symbol:   class XmlSuite
[ERROR]   location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,63] cannot find symbol
[ERROR]   symbol:   class ISuite
[ERROR]   location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[43,33] cannot find symbol
[ERROR]   symbol:   class IResultMap
[ERROR]   location: class resources.ExtentReporterNG
[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

Этого не происходило при запуске команды mvn compile раньше, но после обновления моего POM и перекомпиляция, это начало показывать также в терминале. Проект отлично работает при запуске из testng. xml в Eclipse.

Вот как выглядит мой POM-файл

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



  <build>
   <resources>
        <resource>
            <directory>src/main/java/resources</directory>
            <filtering>true</filtering> 
        </resource>
    </resources>
  <plugins>

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

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


  </build>
  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.apple</groupId>
      <artifactId>AppleJavaExtensions</artifactId>
      <version>1.4</version>
    </dependency>

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

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

  <dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>3.0.6</version>
</dependency>

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

      <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.8.2</version>
  </dependency>

  <dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.8.2</version>
  </dependency>

  </dependencies>
</project>

Прикрепленное изображение того, как выглядит проект:

Project

1 Ответ

0 голосов
/ 07 апреля 2020

Наконец-то я смог решить эту проблему, обновив свой файл POM, выполнив следующие действия: Удаление зависимости отчета экстента, в которой был указан идентификатор группы avenstack

<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>3.0.6</version>
</dependency>

, обновив другой отчет экстента до этого v:

<dependency>
     <groupId>com.aventstack</groupId>
     <artifactId>extentreports</artifactId>
     <version>3.1.5</version>
  </dependency>

И добавление этого тоже:

<dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.28</version>
    </dependency>
...