Closed ErwinvanBrandwijk closed 13 years ago
I think this is a duplicate of https://github.com/tlberglund/groovy-liquibase/issues#issue/12. Nevertheless, you should try changing the line to:
include(file: 'C:\\Users\\Erwin\\AppData\\Local\\Temp\\liquibase-8652829959237818445.groovy')
You should be able to use forward slashes too, and java.io.File will translate them when it comes time to open the file. As it stands, the compiler is trying to turn all the single backslashes into string escapes, and it's failing, since not all of them are valid escape sequences.
Change test of rootElements and build is ok. In windows and ubuntu.
add includedChangeLogFile = includedChangeLogFile.canonicalPath includedChangeLogFile = includedChangeLogFile.replaceAll("\", "/") and remove canonicalPath from include(file: '${includedChangeLogFile.canonicalPath}')
Result is
void includeChangelog() {
def includedChangeLogFile = createFileFrom("""
databaseChangeLog {
preConditions {
runningAs(username: 'tlberglund')
}
changeSet(author: 'tlberglund', id: 'included-change-set') {
renameTable(oldTableName: 'prosaic_table_name', newTableName: 'monkey')
}
}
""")
includedChangeLogFile = includedChangeLogFile.canonicalPath
includedChangeLogFile = includedChangeLogFile.replaceAll("\\\\", "/")
def rootChangeLogFile = createFileFrom("""
databaseChangeLog {
preConditions {
dbms(type: 'mysql')
}
include(file: '${includedChangeLogFile}')
changeSet(author: 'tlberglund', id: 'root-change-set') {
addColumn(tableName: 'monkey') {
column(name: 'emotion', type: 'varchar(50)')
}
}
}
""")
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 6: unexpected char: '\' @ line 6, column 20. include(file: 'C:\Users\Erwin\AppData\Local\Temp\liquibase-8652829959237818445.groovy') ^ 1 error