Description
Attempting to build custom karaf distributions using the karaf-maven-plugin to add features with config files with leading white space causes errors similar to the following:
[WARNING] == Installing configuration file
mvn:org.apache.karaf.cave/apache-karaf-cave/3.0.0/cfg/filesystem
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.487s
[INFO] Finished at: Fri Feb 06 17:13:52 CST 2015
[INFO] Final Memory: 12M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.0.M1:install-kars (default-install-kars) on project karaf-tooling-bug: Can not install cave-server feature: Illegal character in scheme name at index 0:
[ERROR] mvn:org.apache.karaf.cave/apache-karaf-cave/3.0.0/cfg/filesystem
In the above case, it appears that the source of the problem is that the configuration file location in apache-karaf-cave has a new line at the beginning of it that isn't handled correctly on line 537 of org.apache.karaf.tooling.features.InstallKarsMojo.java in the installConfigFile method:
String configFileLocation = configFile.getLocation();
updating that line to:
String configFileLocation = configFile.getLocation().trim();
resolves the problem.