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>

 

上一篇:List | 静态链表 —— 游标实现


下一篇:天宝Trimble Data Transfer安装并传输数据