1 | |
package liquibase.integration.ant; |
2 | |
|
3 | |
import liquibase.Liquibase; |
4 | |
import org.apache.tools.ant.BuildException; |
5 | |
|
6 | |
import java.io.Writer; |
7 | |
|
8 | 0 | public class MarkNextChangeSetRanTask extends BaseLiquibaseTask { |
9 | |
|
10 | |
@Override |
11 | |
public void execute() throws BuildException { |
12 | |
|
13 | 0 | super.execute(); |
14 | |
|
15 | 0 | if (!shouldRun()) { |
16 | 0 | return; |
17 | |
} |
18 | |
|
19 | 0 | Liquibase liquibase = null; |
20 | |
try { |
21 | 0 | liquibase = createLiquibase(); |
22 | |
|
23 | 0 | Writer writer = createOutputWriter(); |
24 | 0 | if (writer == null) { |
25 | 0 | liquibase.markNextChangeSetRan(getContexts()); |
26 | |
} else { |
27 | 0 | liquibase.markNextChangeSetRan(getContexts(), writer); |
28 | 0 | writer.flush(); |
29 | 0 | writer.close(); |
30 | |
} |
31 | |
|
32 | 0 | } catch (Exception e) { |
33 | 0 | throw new BuildException(e); |
34 | |
} finally { |
35 | 0 | closeDatabase(liquibase); |
36 | 0 | } |
37 | 0 | } |
38 | |
} |