I actually found out how to do it:
I created a .java file within src/main/java/mycompany and added a method that sets up the property:
package mycompany;
public class Setup {
public void browserSetup() {
System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
}
}
Then, in my test, I imported this as a library:
*** Settings ***
Library Selenium2Library
Library mycompany.Setup
And then invoked the method as a new keyword: Browser Setup
.
That was it. I ran it and it worked.
EDIT: Just in case anyone is wondering how to reference chromedriver.exe as a relative path within the project, I placed the exe file in my {root_project_directory}\src\test\resources directory, then used it as src\\test\\resources\\chromedriver.exe
(notice the \
escaping needed).