diff --git a/tasks/flyway.js b/tasks/flyway.js index 71333f6..84455ab 100644 --- a/tasks/flyway.js +++ b/tasks/flyway.js @@ -29,16 +29,18 @@ module.exports = function(grunt) { // Windows CLASSPATH separator var classPathSeparator = ';'; + var classPathEnvVar = '%CLASSPATH%'; // Unix CLASSPATH separator if(Os.platform() === 'linux' || Os.platform() === 'darwin') { classPathSeparator = ':'; + classPathEnvVar = '$CLASSPATH'; } // Creates the Java CLASSPATH used to run Flyway - var javaClasspath = flywayBinPath + '/flyway-commandline-2.1.1.jar' + classPathSeparator; + var javaClasspath = classPathEnvVar + classPathSeparator + flywayBinPath + '/flyway-commandline-2.1.1.jar' + classPathSeparator; javaClasspath = javaClasspath + flywayBinPath + '/flyway-core-2.1.1.jar'; // Object used to configure the Flyway Commands which are available with the Grunt Flyway Plugin @@ -137,7 +139,7 @@ module.exports = function(grunt) { } // Create the Console Command line used to execute the Flyway Command Line program - var flywayCommand = 'java -cp ' + javaClasspath + ' com.googlecode.flyway.commandline.Main ' + this.data.command; + var flywayCommand = 'java -cp "' + javaClasspath + '" com.googlecode.flyway.commandline.Main ' + this.data.command; // Gets valid command line options associated to the Flyway Command which have been entered var commandOptions = availableCommands[this.data.command]; @@ -264,4 +266,4 @@ module.exports = function(grunt) { }); }); -}; \ No newline at end of file +};