| 1 | |
package org.kuali.maven.plugin.ksite.mojo; |
| 2 | |
|
| 3 | |
import java.util.Properties; |
| 4 | |
|
| 5 | |
import org.apache.maven.model.DistributionManagement; |
| 6 | |
import org.apache.maven.model.Site; |
| 7 | |
import org.apache.maven.plugin.AbstractMojo; |
| 8 | |
import org.apache.maven.plugin.MojoExecutionException; |
| 9 | |
import org.apache.maven.plugin.MojoFailureException; |
| 10 | |
import org.apache.maven.project.MavenProject; |
| 11 | |
import org.kuali.maven.common.SiteContext; |
| 12 | |
import org.kuali.maven.common.UrlBuilder; |
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | 0 | public class KualiSiteMojo extends AbstractMojo implements SiteContext { |
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
private String downloadSnapshotPrefix; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
private String downloadReleasePrefix; |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
private String publishUrlProtocol; |
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
private String publicUrlProtocol; |
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
private String downloadPrefix; |
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
private String organizationGroupId; |
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
private String bucket; |
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
private String hostname; |
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | |
private MavenProject project; |
| 89 | |
|
| 90 | |
@Override |
| 91 | |
public void execute() throws MojoExecutionException, MojoFailureException { |
| 92 | 0 | UrlBuilder builder = new UrlBuilder(); |
| 93 | |
|
| 94 | |
|
| 95 | 0 | String publicUrl = builder.getPublicUrl(getProject(), this); |
| 96 | 0 | String publishUrl = builder.getPublishUrl(getProject(), this); |
| 97 | 0 | String downloadUrl = builder.getDownloadUrl(getProject(), this); |
| 98 | |
|
| 99 | |
|
| 100 | 0 | MavenProject project = getProject(); |
| 101 | 0 | DistributionManagement dm = project.getDistributionManagement(); |
| 102 | 0 | Site site = dm.getSite(); |
| 103 | |
|
| 104 | 0 | getLog().info("Public url - " + publicUrl); |
| 105 | 0 | getLog().info("Publish url - " + publishUrl); |
| 106 | 0 | getLog().info("Download url - " + downloadUrl); |
| 107 | |
|
| 108 | |
|
| 109 | 0 | project.setUrl(publicUrl); |
| 110 | 0 | dm.setDownloadUrl(downloadUrl); |
| 111 | 0 | site.setUrl(publishUrl); |
| 112 | |
|
| 113 | |
|
| 114 | 0 | Properties properties = getProject().getProperties(); |
| 115 | 0 | properties.setProperty("kuali.site.public.url", publicUrl); |
| 116 | 0 | } |
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
|
| 121 | |
public MavenProject getProject() { |
| 122 | 0 | return project; |
| 123 | |
} |
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
public void setProject(final MavenProject project) { |
| 130 | 0 | this.project = project; |
| 131 | 0 | } |
| 132 | |
|
| 133 | |
|
| 134 | |
|
| 135 | |
|
| 136 | |
@Override |
| 137 | |
public String getBucket() { |
| 138 | 0 | return bucket; |
| 139 | |
} |
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
public void setBucket(final String bucket) { |
| 146 | 0 | this.bucket = bucket; |
| 147 | 0 | } |
| 148 | |
|
| 149 | |
|
| 150 | |
|
| 151 | |
|
| 152 | |
@Override |
| 153 | |
public String getHostname() { |
| 154 | 0 | return hostname; |
| 155 | |
} |
| 156 | |
|
| 157 | |
|
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
public void setHostname(final String hostname) { |
| 162 | 0 | this.hostname = hostname; |
| 163 | 0 | } |
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | |
@Override |
| 169 | |
public String getDownloadPrefix() { |
| 170 | 0 | return downloadPrefix; |
| 171 | |
} |
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | |
|
| 177 | |
public void setDownloadPrefix(final String downloadPrefix) { |
| 178 | 0 | this.downloadPrefix = downloadPrefix; |
| 179 | 0 | } |
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
@Override |
| 185 | |
public String getOrganizationGroupId() { |
| 186 | 0 | return organizationGroupId; |
| 187 | |
} |
| 188 | |
|
| 189 | |
|
| 190 | |
|
| 191 | |
|
| 192 | |
|
| 193 | |
public void setOrganizationGroupId(final String parentGroupId) { |
| 194 | 0 | this.organizationGroupId = parentGroupId; |
| 195 | 0 | } |
| 196 | |
|
| 197 | |
|
| 198 | |
|
| 199 | |
|
| 200 | |
@Override |
| 201 | |
public String getPublishUrlProtocol() { |
| 202 | 0 | return publishUrlProtocol; |
| 203 | |
} |
| 204 | |
|
| 205 | |
|
| 206 | |
|
| 207 | |
|
| 208 | |
|
| 209 | |
public void setPublishUrlProtocol(final String publishUrlProtocol) { |
| 210 | 0 | this.publishUrlProtocol = publishUrlProtocol; |
| 211 | 0 | } |
| 212 | |
|
| 213 | |
|
| 214 | |
|
| 215 | |
|
| 216 | |
@Override |
| 217 | |
public String getPublicUrlProtocol() { |
| 218 | 0 | return publicUrlProtocol; |
| 219 | |
} |
| 220 | |
|
| 221 | |
|
| 222 | |
|
| 223 | |
|
| 224 | |
|
| 225 | |
public void setPublicUrlProtocol(final String publicUrlProtocol) { |
| 226 | 0 | this.publicUrlProtocol = publicUrlProtocol; |
| 227 | 0 | } |
| 228 | |
|
| 229 | |
|
| 230 | |
|
| 231 | |
|
| 232 | |
@Override |
| 233 | |
public String getDownloadSnapshotPrefix() { |
| 234 | 0 | return downloadSnapshotPrefix; |
| 235 | |
} |
| 236 | |
|
| 237 | |
|
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
public void setDownloadSnapshotPrefix(final String downloadSnapshotPrefix) { |
| 242 | 0 | this.downloadSnapshotPrefix = downloadSnapshotPrefix; |
| 243 | 0 | } |
| 244 | |
|
| 245 | |
|
| 246 | |
|
| 247 | |
|
| 248 | |
@Override |
| 249 | |
public String getDownloadReleasePrefix() { |
| 250 | 0 | return downloadReleasePrefix; |
| 251 | |
} |
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
|
| 256 | |
|
| 257 | |
public void setDownloadReleasePrefix(final String downloadReleasePrefix) { |
| 258 | 0 | this.downloadReleasePrefix = downloadReleasePrefix; |
| 259 | 0 | } |
| 260 | |
|
| 261 | |
} |