其他分享
首页 > 其他分享> > 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>

 

标签:central,transfer,surefire,maven,apache,org,junit4
来源: https://www.cnblogs.com/zoudiaogangqin/p/15743115.html