dzl84394 2015-04-25 10:24 采纳率: 0%
浏览 4616

新建maven环境,没有junit:jar:3.8.1 ,但是maven自己是依赖这个版本的

新建了maven环境
打包的时候报Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project wostore: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failure to find junit:junit:jar:3.8.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

这是他自己需要的依赖,但是发现现在maven自己已经不能提供这个版本了,真奇怪

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-08-03 18:00
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    要解决这个问题,您需要在Maven项目的pom.xml文件中添加JUnit 3.8.1的依赖。以下是如何实现这一目标的方法:

    1. 首先,在pom.xml文件中找到<dependencies>标签。
    <!-- 在这里添加JUnit 3.8.1的依赖 -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version> <!-- 这里替换为您的实际版本 -->
    </dependency>
    
    1. 确保已正确配置项目,并且pom.xml文件已保存并重新加载。

    2. 最后,运行mvn clean install命令来更新Maven仓库中的依赖。

    如果以上步骤仍然无法解决问题,请检查是否有其他可能的原因,例如:

    • 您是否在使用Maven插件或构建脚本来获取和管理这些依赖。
    • 是否有冲突的第三方库导致了问题。
    • 是否存在与JDK版本不兼容的问题。
    • 是否尝试使用了错误的JDK路径(例如:java -version输出的JDK版本与pom.xml中的指定不同)。

    希望这些建议能帮助您解决问题!

    评论

报告相同问题?