1 package org.kuali.student.contract.mojo;
2
3 import java.io.File;
4 import java.net.MalformedURLException;
5 import java.net.URL;
6 import java.net.URLClassLoader;
7 import java.util.Collection;
8 import java.util.List;
9
10 import org.apache.maven.artifact.DependencyResolutionRequiredException;
11 import org.apache.maven.model.Dependency;
12 import org.apache.maven.plugin.AbstractMojo;
13 import org.apache.maven.plugin.MojoExecutionException;
14 import org.apache.maven.project.MavenProject;
15 import org.joda.time.DateTime;
16 import org.kuali.student.common.mojo.AbstractKSMojo;
17 import org.kuali.student.contract.model.ServiceContractModel;
18 import org.kuali.student.contract.model.impl.ServiceContractModelCache;
19 import org.kuali.student.contract.model.impl.ServiceContractModelQDoxLoader;
20 import org.kuali.student.contract.model.util.DateUtility;
21 import org.kuali.student.contract.model.util.HtmlContractWriter;
22 import org.kuali.student.contract.model.validation.ServiceContractModelValidator;
23
24
25
26
27
28
29
30 public class KSContractDocMojo extends AbstractKSMojo {
31
32
33
34
35 private File htmlDirectory;
36
37 public File getHtmlDirectory() {
38 return htmlDirectory;
39 }
40
41 public void setHtmlDirectory(File htmlDirectory) {
42 this.htmlDirectory = htmlDirectory;
43 }
44
45 @Override
46 public void execute() throws MojoExecutionException {
47
48 MavenProject project = (MavenProject) getPluginContext().get("project");
49
50 String formattedDate = DateUtility.asYMDHMInEasternTimeZone(new DateTime());
51
52 ServiceContractModel model = null;
53 HtmlContractWriter writer = null;
54 getLog().info("publishing wiki contracts");
55 model = this.getModel();
56 this.validate(model);
57 getLog().info("publishing to = " + this.htmlDirectory.toString());
58 writer = new HtmlContractWriter(htmlDirectory.toString(), model);
59 writer.write(project.getVersion(), formattedDate);
60
61
62 }
63 }