C/C++教程

Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.12.4 from/to central

本文主要是介绍Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.12.4 from/to central,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Maven项目,没有增加单元测试依赖前,可以打包安装

添加测试依赖后

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

报错:Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.12.4 from/to central

 

添加编译插件,刷新Maven,即可解决问题

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>

 

这篇关于Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.12.4 from/to central的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!