Hi all,
this is a quite boring issue, in addition it is very easy to fix directly the code.
Is there a specific process to submit patch?
The issue can be resolved with few lines of code. This is the fix for 3.0.0-rc3-SNAPSHOT:
In AbstractLiquibaseMojo.java add:
/**
* Flag to set the character encoding of the output file produced by Liquibase during the updateSQL phase.
*
* @parameter expression="${liquibase.outputFileEncoding}"
*/
protected String outputFileEncoding;
In LiquibaseUpdateSQL.java substitute:
line 68: outputWriter = new FileWriter(migrationSqlOutputFile);
with:
if (outputFileEncoding==null) {
getLog().warn("Charser encoding not set! The created file will be system dependent!");
outputWriter = new FileWriter(migrationSqlOutputFile);
}
else {
getLog().info("Writing output file with [" + outputFileEncoding + "] file encoding.");
outputWriter = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(migrationSqlOutputFile), outputFileEncoding));
}
These simple changes allow the user to specify the charset directly in the pom.xml:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.0.0-rc3-SNAPSHOT</version>
<configuration>
<propertyFile>pathToLiquibaseFiles/liquibase.properties</propertyFile>
<outputFileEncoding>UTF-8</outputFileEncoding>
</configuration>
</plugin>
Could you include it in the source of version 3.0?
Regards
Francesco Cina
this is a quite boring issue, in addition it is very easy to fix directly the code.
Is there a specific process to submit patch?
The issue can be resolved with few lines of code. This is the fix for 3.0.0-rc3-SNAPSHOT:
In AbstractLiquibaseMojo.java add:
/**
* Flag to set the character encoding of the output file produced by Liquibase during the updateSQL phase.
*
* @parameter expression="${liquibase.outputFileEncoding}"
*/
protected String outputFileEncoding;
In LiquibaseUpdateSQL.java substitute:
line 68: outputWriter = new FileWriter(migrationSqlOutputFile);
with:
if (outputFileEncoding==null) {
getLog().warn("Charser encoding not set! The created file will be system dependent!");
outputWriter = new FileWriter(migrationSqlOutputFile);
}
else {
getLog().info("Writing output file with [" + outputFileEncoding + "] file encoding.");
outputWriter = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(migrationSqlOutputFile), outputFileEncoding));
}
These simple changes allow the user to specify the charset directly in the pom.xml:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.0.0-rc3-SNAPSHOT</version>
<configuration>
<propertyFile>pathToLiquibaseFiles/liquibase.properties</propertyFile>
<outputFileEncoding>UTF-8</outputFileEncoding>
</configuration>
</plugin>
Could you include it in the source of version 3.0?
Regards
Francesco Cina