The main problem with your code is that you haven't provided the proper download path.
String downloadFilepath = "/target";
Replace or Change it with below code:
String downloadFilepath = System.getProperty("user.dir") + File.separator + "target";
Complete Code for testing:
String downloadFilepath = System.getProperty("user.dir") + File.separator + "target";
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("download.default_directory", downloadFilepath);
chromePrefs.put("download.prompt_for_download", false);
chromePrefs.put("download.directory_upgrade",true);
options.setExperimentalOption("prefs", chromePrefs);
WebDriver driver = new ChromeDriver(options);
//Example Site for REF
driver.get("http://the-internet.herokuapp.com/download/some-file.txt");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…