002-Bug記錄-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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM