【问题标题】:unable to run maven project some dependencies error无法运行maven项目一些依赖错误
【发布时间】:2022-11-24 19:26:58
【问题描述】:

大家好,感谢您的意见,我无法解决 Maven 测试运行中的依赖项错误。 获取错误'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.slf4j:slf4j-api:jar -> version 2.0.0-alpha0 vs 2.0.3 @ line 65, column 15

org.slf4j 错误给出依赖。

下面是我的 POM.XML 文件

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>4.5.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.0-alpha0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
         <version>6.14.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
         <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-adb</artifactId>
        <version>${axis2.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-http</artifactId>
        <version>${axis2.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.3</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.36</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.36</version>
        <type>pom</type>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-transport-local</artifactId>
        <version>${axis2.version}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<build>
    <plugins>

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

尝试运行项目但得到这个。

enter image description here

【问题讨论】:

    标签: java selenium runtime-error pom.xml


    【解决方案1】:

    这部分真的很奇怪:

        <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
    

    您真的要使用 Java 5 吗? 更改为 1.8 并重试。 此外,您在 pom.xml 中有重复的依赖项。

    【讨论】:

      猜你喜欢
      • 2012-01-26
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-09
      • 2016-03-08
      • 2020-02-03
      相关资源
      最近更新 更多