1 | |
package liquibase.integration.ant; |
2 | |
|
3 | |
import liquibase.Liquibase; |
4 | |
import liquibase.util.StringUtils; |
5 | |
import org.apache.tools.ant.AntClassLoader; |
6 | |
import org.apache.tools.ant.BuildException; |
7 | |
|
8 | 0 | public class DBDocTask extends BaseLiquibaseTask { |
9 | |
|
10 | |
private String outputDirectory; |
11 | |
|
12 | |
public String getOutputDirectory() { |
13 | 0 | return outputDirectory; |
14 | |
} |
15 | |
|
16 | |
public void setOutputDirectory(String outputDirectory) { |
17 | 0 | this.outputDirectory = outputDirectory; |
18 | 0 | } |
19 | |
|
20 | |
@Override |
21 | |
public void execute() throws BuildException { |
22 | 0 | if (StringUtils.trimToNull(getOutputDirectory()) == null) { |
23 | 0 | throw new BuildException("dbDoc requires outputDirectory to be set"); |
24 | |
} |
25 | |
|
26 | 0 | super.execute(); |
27 | |
|
28 | 0 | Liquibase liquibase = null; |
29 | |
try { |
30 | 0 | liquibase = createLiquibase(); |
31 | 0 | liquibase.generateDocumentation(getOutputDirectory()); |
32 | |
|
33 | 0 | } catch (Exception e) { |
34 | 0 | throw new BuildException(e); |
35 | |
} finally { |
36 | 0 | closeDatabase(liquibase); |
37 | 0 | } |
38 | 0 | } |
39 | |
} |