| 1 | |
package org.kuali.maven.plugins; |
| 2 | |
|
| 3 | |
import java.io.File; |
| 4 | |
import java.io.IOException; |
| 5 | |
import java.util.List; |
| 6 | |
|
| 7 | |
import org.apache.maven.artifact.Artifact; |
| 8 | |
import org.apache.maven.plugin.AbstractMojo; |
| 9 | |
import org.apache.maven.plugin.MojoExecutionException; |
| 10 | |
import org.apache.maven.plugin.MojoFailureException; |
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | 0 | public class GenerateScriptMojo extends AbstractMojo { |
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
private String jdbcDriverHome; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
private String scriptFile; |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
private String oracleGroupId; |
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
private String versions; |
| 50 | |
|
| 51 | |
@Override |
| 52 | |
public void execute() throws MojoExecutionException, MojoFailureException { |
| 53 | 0 | DeployUtils du = new DeployUtils(); |
| 54 | |
try { |
| 55 | 0 | List<Artifact> artifacts = du.getArtifacts(new File(jdbcDriverHome), oracleGroupId, versions); |
| 56 | 0 | getLog().info("Located " + artifacts.size() + " artifacts"); |
| 57 | 0 | getLog().info("Generating script to: " + scriptFile); |
| 58 | 0 | String s = du.getShellScript(artifacts); |
| 59 | 0 | du.write(scriptFile, s); |
| 60 | 0 | } catch (IOException e) { |
| 61 | 0 | throw new MojoExecutionException("Unexpected issue", e); |
| 62 | 0 | } |
| 63 | 0 | } |
| 64 | |
|
| 65 | |
public String getJdbcDriverHome() { |
| 66 | 0 | return jdbcDriverHome; |
| 67 | |
} |
| 68 | |
|
| 69 | |
public void setJdbcDriverHome(String jdbcDriverHome) { |
| 70 | 0 | this.jdbcDriverHome = jdbcDriverHome; |
| 71 | 0 | } |
| 72 | |
|
| 73 | |
public String getScriptFile() { |
| 74 | 0 | return scriptFile; |
| 75 | |
} |
| 76 | |
|
| 77 | |
public void setScriptFile(String scriptFile) { |
| 78 | 0 | this.scriptFile = scriptFile; |
| 79 | 0 | } |
| 80 | |
|
| 81 | |
public String getOracleGroupId() { |
| 82 | 0 | return oracleGroupId; |
| 83 | |
} |
| 84 | |
|
| 85 | |
public void setOracleGroupId(String oracleGroupId) { |
| 86 | 0 | this.oracleGroupId = oracleGroupId; |
| 87 | 0 | } |
| 88 | |
|
| 89 | |
public String getVersions() { |
| 90 | 0 | return versions; |
| 91 | |
} |
| 92 | |
|
| 93 | |
public void setVersions(String includeVersions) { |
| 94 | 0 | this.versions = includeVersions; |
| 95 | 0 | } |
| 96 | |
} |