Hope you wanted to ask for a workaround to avoid obsolescence.
The old simple build method is Capabilitiesdeprecated. Now, ChromeDriverServiceand is required as parameters Capabilities. So, just build a ChromeDriverServiceand pass the same thing along with yours Capabilitiesto remove the failure warning.
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeDriverService service = new ChromeDriverService.Builder()
.usingDriverExecutable(new File("/usr/local/chromedriver"))
.usingAnyFreePort()
.build();
ChromeDriver driver = new ChromeDriver(service, capabilities);
EDIT:
ChromeDriver(service, capabilities) ,
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeDriverService service = new ChromeDriverService.Builder()
.usingDriverExecutable(new File("/usr/local/chromedriver"))
.usingAnyFreePort()
.build();
ChromeOptions options = new ChromeOptions();
options.merge(capabilities);
ChromeDriver driver = new ChromeDriver(service, options);
DesiredCapabilities ChromeOptions setCapability, ,
ChromeOptions options = new ChromeOptions();
options.setCapability("capability_name", "capability_value");
driver = new ChromeDriver(options);