1 package org.apache.maven.tools.plugin;
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 java.net.URI;
23 import java.util.List;
24 import java.util.Set;
25
26 import org.apache.maven.artifact.Artifact;
27 import org.apache.maven.artifact.repository.ArtifactRepository;
28 import org.apache.maven.plugin.descriptor.PluginDescriptor;
29 import org.apache.maven.project.MavenProject;
30 import org.apache.maven.settings.Settings;
31
32 /**
33 * Request that encapsulates all information relevant to the process of extracting
34 * {@link org.apache.maven.plugin.descriptor.MojoDescriptor MojoDescriptor}
35 * instances from metadata for a certain type of mojo.
36 *
37 * @author jdcasey
38 * @since 2.5
39 */
40 public interface PluginToolsRequest
41 {
42
43 /**
44 * @return Return the current {@link MavenProject} instance in use.
45 */
46 MavenProject getProject();
47
48 /**
49 * @param project the current {@link MavenProject}
50 * @see PluginToolsRequest#getProject()
51 * @return This request.
52 */
53 PluginToolsRequest setProject( MavenProject project );
54
55 /**
56 * @return Return the {@link PluginDescriptor} currently being populated as part of the build of the
57 * current plugin project.
58 */
59 PluginDescriptor getPluginDescriptor();
60
61 /**
62 * @see PluginToolsRequest#getPluginDescriptor()
63 * @param pluginDescriptor the {@link PluginDescriptor}
64 * @return This request.
65 */
66 PluginToolsRequest setPluginDescriptor( PluginDescriptor pluginDescriptor );
67
68 /**
69 * Gets the file encoding of the source files.
70 *
71 * @return The file encoding of the source files, never <code>null</code>.
72 */
73 String getEncoding();
74
75 /**
76 * Sets the file encoding of the source files.
77 *
78 * @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
79 * default encoding.
80 * @return This request.
81 */
82 PluginToolsRequest setEncoding( String encoding );
83
84 /**
85 * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
86 * descriptor generator mojo is bound to generate-resources phase.
87 * But for annotations, the compiled classes are needed, so skip error
88 * @param skipErrorNoDescriptorsFound <code>true</code> to skip errors because of not found descriptors
89 * @return This request.
90 * @since 3.0
91 */
92 PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound );
93
94 /**
95 * @return <code>true</code> if no descriptor found should not cause a failure
96 * @since 3.0
97 */
98 boolean isSkipErrorNoDescriptorsFound();
99
100 /**
101 * Returns the list of {@link Artifact} used in class path scanning for annotations
102 *
103 * @return the dependencies
104 * @since 3.0
105 */
106 Set<Artifact> getDependencies();
107
108 /**
109 * @param dependencies the dependencies
110 * @return This request.
111 * @since 3.0
112 */
113 PluginToolsRequest setDependencies( Set<Artifact> dependencies );
114
115 /**
116 *
117 * @return the remote repositories
118 * @since 3.0
119 */
120 List<ArtifactRepository> getRemoteRepos();
121
122 /**
123 *
124 * @param remoteRepos the remote repositories
125 * @return This request.
126 * @since 3.0
127 */
128 PluginToolsRequest setRemoteRepos( List<ArtifactRepository> remoteRepos );
129
130 /**
131 *
132 * @return the local artifact repository
133 * @since 3.0
134 */
135 ArtifactRepository getLocal();
136
137 /**
138 *
139 * @param local the local repository
140 * @return This request.
141 * @since 3.0
142 */
143 PluginToolsRequest setLocal( ArtifactRepository local );
144
145 /**
146 *
147 * @param baseUrl may be relative to the current site's root
148 * @return This request.
149 * @since 3.7.0
150 */
151 PluginToolsRequest setInternalJavadocBaseUrl( URI baseUrl );
152
153 /**
154 * @return the javadoc base url for the internal classes
155 * @since 3.7.0
156 */
157 URI getInternalJavadocBaseUrl();
158
159 /**
160 *
161 * @param javadocVersion
162 * @return This request.
163 * @since 3.7.0
164 */
165 PluginToolsRequest setInternalJavadocVersion( String javadocVersion );
166
167 /**
168 * @return the javadoc version used to create the internal javadoc site
169 * @since 3.7.0
170 */
171 String getInternalJavadocVersion();
172
173 /**
174 *
175 * @param javadocLinks
176 * @return This request.
177 * @since 3.7.0
178 */
179 PluginToolsRequest setExternalJavadocBaseUrls( List<URI> javadocLinks );
180
181 /**
182 * @return the list of external javadoc base urls to consider
183 * @since 3.7.0
184 */
185 List<URI> getExternalJavadocBaseUrls();
186
187 /**
188 *
189 * @param settings the Maven settings
190 * @return This request.
191 * @since 3.7.0
192 */
193 PluginToolsRequest setSettings( Settings settings );
194
195 /**
196 * @return the Maven settings
197 * @since 3.7.0
198 */
199 Settings getSettings();
200 }