Java NetBeans-Maven-JaCoCo-Can';t使用相同的名称添加不同的类

Java NetBeans-Maven-JaCoCo-Can';t使用相同的名称添加不同的类,java,maven,netbeans,jacoco,jacoco-maven-plugin,Java,Maven,Netbeans,Jacoco,Jacoco Maven Plugin,我将从我已经检查过的链接开始: 这些都是我检查过的问题,更不用说所有的GitHub帖子了 我已经花了整整两天的时间试图找到解决问题的方法,但我还没有找到任何有效的方法 故事是这样的: 用于自动化测试的NetBeans项目 我工作的公司有一个jar文件 我使用以下命令将此jar文件包括在我的项目中: 将依赖项添加到pom.xml文件中 一切都很顺利,除了JaCoCo试图生成报告时。以下是错误日志: 上面错误中提到的JAR文件是我公司的JAR文件/依赖项 这是我的pom.xml文件: 4

我将从我已经检查过的链接开始:

这些都是我检查过的问题,更不用说所有的GitHub帖子了

我已经花了整整两天的时间试图找到解决问题的方法,但我还没有找到任何有效的方法

故事是这样的:

  • 用于自动化测试的NetBeans项目
  • 我工作的公司有一个jar文件
  • 我使用以下命令将此jar文件包括在我的项目中:
  • 将依赖项添加到pom.xml文件中
  • 一切都很顺利,除了JaCoCo试图生成报告时。以下是错误日志:
  • 上面错误中提到的JAR文件是我公司的JAR文件/依赖项

  • 这是我的pom.xml文件:

  • 4.0.0
    自动化框架
    自动化框架
    1.0-快照
    罐子
    UTF-8
    1.8
    1.8
    org.testng
    testng
    7.3.0
    测试
    org.seleniumhq.selenium
    硒爪哇
    3.141.59
    org.seleniumhq.selenium
    硒原料药
    3.141.59
    org.seleniumhq.selenium
    selenium远程驱动程序
    3.141.59
    org.seleniumhq.selenium
    硒铬驱动器
    3.141.59
    org.seleniumhq.selenium
    普通硒
    2.0b1
    org.apache.commons
    commons-lang3
    3.11
    com.automation-comments
    录像机
    1
    org.apache.poi
    poi
    4.1.2
    org.apache.poi
    poi ooxml
    4.1.2
    com.jcraft
    jsch
    0.1.55
    io.reactivex.rxjava3
    rxjava
    3.0.4
    org.freemarker
    自由标记
    2.3.30
    org.projectlombok
    龙目
    1.18.12
    com.google.code.gson
    格森
    2.8.6
    org.apache.jmeter
    ApacheJMeter_核心
    5.4
    org.apache.jmeter
    ApacheJMeter_组件
    5.4
    org.apache.jmeter
    乔芬
    5.4
    org.apache.jmeter
    朱尼特公寓
    5.4
    org.apache.jmeter
    ApacheJMeter_http
    5.4
    org.apache.httpcomponents
    httpcore
    4.4.14
    com.thoughtworks.xstream
    xstream
    1.4.15
    org.jboss.aerogear
    aerogear otp java
    1.0.0
    木卫一
    java客户端
    7.4.1
    这个.jar.xml文件
    api包
    1
    编译
    这个.jar.xml文件
    api包
    org.apache.maven.plugins
    maven surefire插件
    3.0.0-M5
    org.apache.maven.plugins
    maven checkstyle插件
    2.16
    代码检查
    src/main/java
    maven jar插件
    2.3.1
    默认jar
    包裹
    罐子
    org.apache.maven.plugins
    maven编译器插件
    3.6.1
    1.8
    1.8
    
        mvn install:install-file - 
        Dfile=C:\MavenSelenium\Automation_Framework\src\main\resources\Dependencies\java-api-1.0-jar-with- 
        dependencies.jar -DgroupId=this.jar.file -DartifactId=api-bundle -Dversion=1.0 -Dpackaging=jar
    
        <dependency>
            <groupId>this.jar.file</groupId>
            <artifactId>api-bundle</artifactId>
            <version>1.0</version>
        </dependency>
    
        mvn clean verify
    
    [INFO] --- jacoco-maven-plugin:0.8.6:report (report) @ Automation_Framework ---
    [INFO] Loading execution data file C:\MavenSelenium\Automation_Framework\target\jacoco.exec
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  18.851 s
    [INFO] Finished at: 2020-12-20T20:35:00+02:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.6:report (report) on project Automation_Framework: 
    An error has occurred in JaCoCo report generation.: Error while creating report: Error while analyzing 
    
    C:\MavenSelenium\Automation_Framework\target\classes\Dependencies\
    java-api-1.0-jar-with-dependencies.jar@org/apache/logging/log4j/core/util/SystemClock.class. 
    
    Can't add different class with same name: org/apache/logging/log4j/core/util/SystemClock -> [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/MojoExecutionException
    
            <modelVersion>4.0.0</modelVersion> 
            <groupId>Automation_Framework</groupId> 
            <artifactId>Automation_Framework</artifactId> 
            <version>1.0-SNAPSHOT</version> 
            <packaging>jar</packaging> 
                
            <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> 
             
            <dependencies>
                 
                <!-- TestNG --> 
                <dependency>
                    <groupId>org.testng</groupId>
                    <artifactId>testng</artifactId>
                    <version>7.3.0</version>
                    <scope>test</scope>
                </dependency>
         
                <!-- Selenium Java -->
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-java</artifactId>
                    <version>3.141.59</version>
                </dependency>
                
                <!-- Selenium API -->
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-api</artifactId>
                    <version>3.141.59</version>
                </dependency>
                
                <!-- Selenium Remote Driver -->
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-remote-driver</artifactId>
                    <version>3.141.59</version>
                </dependency>
                
                <!-- Selenium Chrome Driver -->
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-chrome-driver</artifactId>
                    <version>3.141.59</version>
                </dependency>
                
                <!-- Selenium Common -->
                <dependency>
                    <groupId>org.seleniumhq.selenium</groupId>
                    <artifactId>selenium-common</artifactId>
                    <version>2.0b1</version>
                </dependency>
          
                <!-- Apache Commons Lang3 --> 
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                    <version>3.11</version>
                </dependency>
                
                <!-- Video Recorder --> 
                <dependency>
                    <groupId>com.automation-remarks</groupId>
                    <artifactId>video-recorder</artifactId>
                    <version>1.0</version>
                </dependency>
                
                <!-- Apache POI -->
                <dependency>
                    <groupId>org.apache.poi</groupId>
                    <artifactId>poi</artifactId>
                    <version>4.1.2</version>
                </dependency>
                
                <!-- Apache POI OOXML-->
                <dependency>
                    <groupId>org.apache.poi</groupId>
                    <artifactId>poi-ooxml</artifactId>
                    <version>4.1.2</version>
                </dependency>
                
                <!-- JCraft -->
                <dependency>
                    <groupId>com.jcraft</groupId>
                    <artifactId>jsch</artifactId>
                    <version>0.1.55</version>
                </dependency>
                
                <!-- Extent - RX Java -->
                <dependency>
                        <groupId>io.reactivex.rxjava3</groupId>
                        <artifactId>rxjava</artifactId>
                        <version>3.0.4</version>
                </dependency>
                
                <!-- Extent - Free Marker -->
                <dependency>
                        <groupId>org.freemarker</groupId>
                        <artifactId>freemarker</artifactId>
                        <version>2.3.30</version>
                </dependency>
                
                <!-- Extent - Lombok -->
                <dependency>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>1.18.12</version>
                </dependency>
                
                <!-- Extent - GSON -->
                <dependency>
                        <groupId>com.google.code.gson</groupId>
                        <artifactId>gson</artifactId>
                        <version>2.8.6</version>
                </dependency>
        
                <!-- Apache JMeter Core -->
                <dependency>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>ApacheJMeter_core</artifactId>
                    <version>5.4</version>
                </dependency>
        
                <!-- Apache JMeter Components -->
                <dependency>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>ApacheJMeter_components</artifactId>
                    <version>5.4</version>
                </dependency>
        
                <!-- Apache JMeter JOrphan -->
                <dependency>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>jorphan</artifactId>
                    <version>5.4</version>
                </dependency>
        
                <!-- Apache JMeter JUnit -->
                <dependency>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>ApacheJMeter_junit</artifactId>
                    <version>5.4</version>
                </dependency>
        
                <!-- Apache JMeter HTTP -->
                <dependency>
                    <groupId>org.apache.jmeter</groupId>
                    <artifactId>ApacheJMeter_http</artifactId>
                    <version>5.4</version>
                </dependency>
        
                <!-- Apache HTTP Core -->
                <dependency>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpcore</artifactId>
                    <version>4.4.14</version>
                </dependency>
                
                <!-- XStream Core -->
                <dependency>
                    <groupId>com.thoughtworks.xstream</groupId>
                    <artifactId>xstream</artifactId>
                    <version>1.4.15</version>
                </dependency>
                
                <!-- Aerogear OTP -->
                <dependency>
                    <groupId>org.jboss.aerogear</groupId>
                    <artifactId>aerogear-otp-java</artifactId>
                    <version>1.0.0</version>
                </dependency>
                
                <!-- Appium Java Client -->
                <dependency>
                    <groupId>io.appium</groupId>
                    <artifactId>java-client</artifactId>
                    <version>7.4.1</version>
                </dependency>
                
                <!-- Company Jar (API) -->
                <dependency>
                    <groupId>this.jar.file</groupId>
                    <artifactId>api-bundle</artifactId>
                    <version>1.0</version>
                    <scope>compile</scope>
                    <exclusions>
                      <exclusion>  <!-- declare the exclusion here -->
                        <groupId>this.jar.file</groupId>
                        <artifactId>api-bundle</artifactId>
                      </exclusion>
                    </exclusions> 
                </dependency>
                
                <!-- Surefire Plugin -->
                <dependency>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M5</version>
                </dependency>
        
        
            </dependencies>
            
            <!-- Extent - Maven Checkstyle Plugin -->
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <version>2.16</version>
                        <reportSets>
                            <reportSet>
                                <reports>
                                    <report>checkstyle</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                </plugins>
            </reporting>
            
            <build>
                <sourceDirectory>src/main/java</sourceDirectory>
                <plugins>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>2.3.1</version>
                        <executions>
                          <execution>
                            <id>default-jar</id>
                            <phase>package</phase>
                            <goals>
                              <goal>jar</goal>
                            </goals>
                          </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.6.1</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.1.0</version>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.6</version>
                        <configuration>
                            <excludes>
                                <exclude>**/util/SystemClock.class</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.0.0-M5</version>
                    </plugin>
                </plugins>
            </build>
            
            <profiles>
                <profile>
                    <build>
                        <plugins>
                            <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-source-plugin</artifactId>
                                <version>3.0.1</version>
                                <executions>
                                    <execution>
                                        <id>attach-sources</id>
                                        <goals>
                                            <goal>jar</goal>
                                        </goals>
                                    </execution>
                                </executions>
                            </plugin>
                            <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-javadoc-plugin</artifactId>
                                <version>3.0.1</version>
                                <executions>
                                    <execution>
                                        <id>attach-javadocs</id>
                                        <goals>
                                            <goal>jar</goal>
                                        </goals>
                                    </execution>
                                </executions>
                            </plugin>
                        </plugins>
                    </build>
                </profile>
            </profiles>
            
            <pluginRepositories>
                <pluginRepository>
                    <id>central</id>
                    <name>Central Repository</name>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <layout>default</layout>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <releases>
                        <updatePolicy>never</updatePolicy>
                    </releases>
                </pluginRepository>
            </pluginRepositories>
        
            <repositories>
                <repository>
                    <id>central</id>
                    <name>Central Repository</name>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <layout>default</layout>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <name>Automation_Framework</name>
        </project>
    
    <!-- Company Jar (API) -->
        <dependency>
            <groupId>this.jar.file</groupId>
            <artifactId>api-bundle</artifactId>
            <version>1.0</version>
            <scope>compile</scope>
            <exclusions>
              <exclusion>  <!-- declare the exclusion here -->
                <groupId>this.jar.file</groupId>
                <artifactId>api-bundle</artifactId>
              </exclusion>
            </exclusions> 
        </dependency>
    
         <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.6</version>
            <configuration>
                <excludes>
                    <exclude>**/util/SystemClock.class</exclude>
                </excludes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    
    C:\MavenSelenium\Automation_Framework\src\main\resources\Dependencies\java-api-1.0-jar-with-dependencies.jar
    
        mvn install:install-file - 
        Dfile=C:\Users\{username}\Downloads\java-api-1.0-jar-with- 
        dependencies.jar -DgroupId=this.jar.file -DartifactId=api-bundle -Dversion=1.0 - 
        Dpackaging=jar
    
            <!-- API -->
            <dependency>
                <groupId>this.jar.file</groupId>
                <artifactId>api-bundle</artifactId>
                <version>1.0</version>
            </dependency>