1 package org.apache.maven.plugins.site;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.maven.artifact.repository.ArtifactRepository;
23 import org.apache.maven.doxia.tools.SiteTool;
24 import org.apache.maven.plugin.AbstractMojo;
25 import org.apache.maven.plugins.annotations.Component;
26 import org.apache.maven.plugins.annotations.Parameter;
27 import org.apache.maven.project.MavenProject;
28 import org.apache.maven.rtinfo.RuntimeInformation;
29 import org.codehaus.plexus.i18n.I18N;
30
31 import java.util.List;
32 import java.util.Locale;
33
34 /**
35 * Base class for site mojos.
36 *
37 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
38 */
39 public abstract class AbstractSiteMojo
40 extends AbstractMojo
41 {
42 /**
43 * A comma separated list of locales to render. The first valid token will be the default Locale
44 * for this site.
45 *
46 * @since 2.3
47 */
48 @Parameter( property = "locales", defaultValue = "en" )
49 private String locales;
50
51 /**
52 * Set this to 'true' to skip site generation and staging.
53 *
54 * @since 3.0
55 */
56 @Parameter( property = "maven.site.skip", defaultValue = "false" )
57 protected boolean skip;
58
59 /**
60 * SiteTool.
61 */
62 @Component
63 protected SiteTool siteTool;
64
65 /**
66 * Internationalization.
67 */
68 @Component
69 protected I18N i18n;
70
71 /**
72 * The Maven project.
73 */
74 @Parameter( defaultValue = "${project}", readonly = true )
75 protected MavenProject project;
76
77 /**
78 * The local repository.
79 */
80 @Parameter( defaultValue = "${localRepository}", readonly = true )
81 protected ArtifactRepository localRepository;
82
83 /**
84 * The reactor projects.
85 */
86 @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
87 protected List<MavenProject> reactorProjects;
88
89 @Component
90 protected RuntimeInformation runtimeInformation;
91
92 @Deprecated
93 protected String getMavenVersion()
94 {
95 return runtimeInformation.getMavenVersion();
96 }
97
98 protected List<Locale> getLocales()
99 {
100 return siteTool.getSiteLocales( locales );
101 }
102 }