Search code examples
mavengoogle-chromeselenium-webdriverintellij-ideaselenium-chromedriver

java: error reading C:\Users\SP00780555\.m2\repository\com\google\errorprone error executing testcases using Selenium in IntelliJ


Im trying to run simple selenium script in IntelliJ. This is the code I used

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Demo {
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\SP00780555\\Downloads\\chromedriver_win32\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("http://www.google.com");
    }
}

But when I'm trying to run it, it's showing this error:

java: error reading C:\Users\SP00780555\.m2\repository\com\google\errorprone\error_prone_annotations\2.1.3\error_prone_annotations-2.1.3.jar; zip file is empty

Solution

  • This error message...

    java: error reading C:\Users\SP00780555\.m2\repository\com\google\errorprone\error_prone_annotations\2.1.3\error_prone_annotations-2.1.3.jar; zip file is empty
    

    ...implies that your program is unable to read the local Maven repository i.e. some of the contents from .m2 directory as the repository possibly got corrupted.


    Solution

    To address this issue you can adopt any of the following two approaches:

    1. Run: Maven clean, Maven install and Maven test
    2. Delete the .m2 directory and Run: mvn clean, mvn install and mvn test (the libraries within the maven repositories will downloaded afresh)

    References

    You can find a relevant detailed discussion in Getting Selenium-WebDriver Example to work