1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package io.earcam.maven.plugin.sitemap;
20
21 import java.io.File;
22 import java.net.URI;
23 import java.util.regex.Pattern;
24
25 import org.apache.maven.plugin.AbstractMojo;
26 import org.apache.maven.plugins.annotations.Parameter;
27 import org.apache.maven.project.MavenProject;
28
29 import io.earcam.utilitarian.site.sitemap.SitemapParameters;
30
31 public abstract class AbstractSitemapMojo extends AbstractMojo {
32
33 @Parameter(defaultValue = "${project}", readonly = true, required = true)
34 protected MavenProject project;
35
36
37
38
39 @Parameter(property = "sitemap.gzip", defaultValue = "false")
40 protected boolean gzip;
41
42
43
44
45 @Parameter(property = "sitemap.include.regex", defaultValue = ".*\\.html?$")
46 protected String include;
47
48
49
50
51 @Parameter(property = "sitemap.url.base", defaultValue = "${project.distributionManagement.site.url}")
52 protected URI baseUrl;
53
54
55
56
57 @Parameter(property = "sitemap.dir.source", defaultValue = "${project.reporting.outputDirectory}")
58 protected File sourceDir;
59
60
61
62
63 @Parameter(property = "sitemap.dir.target", defaultValue = "${project.reporting.outputDirectory}")
64 protected File targetDir;
65
66
67
68
69 @Parameter(property = "sitemap.skip", defaultValue = "false")
70 protected boolean skip;
71
72
73 protected SitemapParameters parameters()
74 {
75 SitemapParameters parameters = new SitemapParameters(baseUrl, sourceDir.toPath(), targetDir.toPath());
76 parameters.options().setGzip(gzip);
77 parameters.options().setInclude(Pattern.compile(include));
78 return parameters;
79 }
80 }