001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.tools.plugin;
020
021import java.net.URI;
022import java.util.List;
023import java.util.Set;
024
025import org.apache.maven.artifact.Artifact;
026import org.apache.maven.artifact.repository.ArtifactRepository;
027import org.apache.maven.plugin.descriptor.PluginDescriptor;
028import org.apache.maven.project.MavenProject;
029import org.apache.maven.settings.Settings;
030
031/**
032 * Request that encapsulates all information relevant to the process of extracting
033 * {@link org.apache.maven.plugin.descriptor.MojoDescriptor MojoDescriptor}
034 * instances from metadata for a certain type of mojo.
035 *
036 * @author jdcasey
037 * @since 2.5
038 */
039public interface PluginToolsRequest {
040
041    /**
042     * @return Return the current {@link MavenProject} instance in use.
043     */
044    MavenProject getProject();
045
046    /**
047     * @param project the current {@link MavenProject}
048     * @see PluginToolsRequest#getProject()
049     * @return This request.
050     */
051    PluginToolsRequest setProject(MavenProject project);
052
053    /**
054     * @return Return the {@link PluginDescriptor} currently being populated as part of the build of the
055     * current plugin project.
056     */
057    PluginDescriptor getPluginDescriptor();
058
059    /**
060     * @see PluginToolsRequest#getPluginDescriptor()
061     * @param pluginDescriptor the {@link PluginDescriptor}
062     * @return This request.
063     */
064    PluginToolsRequest setPluginDescriptor(PluginDescriptor pluginDescriptor);
065
066    /**
067     * Gets the file encoding of the source files.
068     *
069     * @return The file encoding of the source files, never <code>null</code>.
070     */
071    String getEncoding();
072
073    /**
074     * Sets the file encoding of the source files.
075     *
076     * @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
077     *                 default encoding.
078     * @return This request.
079     */
080    PluginToolsRequest setEncoding(String encoding);
081
082    /**
083     * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
084     * descriptor generator mojo is bound to generate-resources phase.
085     * But for annotations, the compiled classes are needed, so skip error
086     * @param skipErrorNoDescriptorsFound <code>true</code> to skip errors because of not found descriptors
087     * @return This request.
088     * @since 3.0
089     */
090    PluginToolsRequest setSkipErrorNoDescriptorsFound(boolean skipErrorNoDescriptorsFound);
091
092    /**
093     * @return <code>true</code> if no descriptor found should not cause a failure
094     * @since 3.0
095     */
096    boolean isSkipErrorNoDescriptorsFound();
097
098    /**
099     * Returns the list of {@link Artifact} used in class path scanning for annotations
100     *
101     * @return the dependencies
102     * @since 3.0
103     */
104    Set<Artifact> getDependencies();
105
106    /**
107     * @param dependencies the dependencies
108     * @return This request.
109     * @since 3.0
110     */
111    PluginToolsRequest setDependencies(Set<Artifact> dependencies);
112
113    /**
114     *
115     * @return the remote repositories
116     * @since 3.0
117     */
118    List<ArtifactRepository> getRemoteRepos();
119
120    /**
121     *
122     * @param remoteRepos the remote repositories
123     * @return This request.
124     * @since 3.0
125     */
126    PluginToolsRequest setRemoteRepos(List<ArtifactRepository> remoteRepos);
127
128    /**
129     *
130     * @return the local artifact repository
131     * @since 3.0
132     */
133    ArtifactRepository getLocal();
134
135    /**
136     *
137     * @param local the local repository
138     * @return This request.
139     * @since 3.0
140     */
141    PluginToolsRequest setLocal(ArtifactRepository local);
142
143    /**
144     *
145     * @param baseUrl may be relative to the current site's root
146     * @return This request.
147     * @since 3.7.0
148     */
149    PluginToolsRequest setInternalJavadocBaseUrl(URI baseUrl);
150
151    /**
152     * @return the javadoc base url for the internal classes
153     * @since 3.7.0
154     */
155    URI getInternalJavadocBaseUrl();
156
157    /**
158     *
159     * @param javadocVersion
160     * @return This request.
161     * @since 3.7.0
162     */
163    PluginToolsRequest setInternalJavadocVersion(String javadocVersion);
164
165    /**
166     * @return the javadoc version used to create the internal javadoc site
167     * @since 3.7.0
168     */
169    String getInternalJavadocVersion();
170
171    /**
172     *
173     * @param javadocLinks
174     * @return This request.
175     * @since 3.7.0
176     */
177    PluginToolsRequest setExternalJavadocBaseUrls(List<URI> javadocLinks);
178
179    /**
180     * @return the list of external javadoc base urls to consider
181     * @since 3.7.0
182     */
183    List<URI> getExternalJavadocBaseUrls();
184
185    /**
186     *
187     * @param settings the Maven settings
188     * @return This request.
189     * @since 3.7.0
190     */
191    PluginToolsRequest setSettings(Settings settings);
192
193    /**
194     * @return the Maven settings
195     * @since 3.7.0
196     */
197    Settings getSettings();
198
199    /**
200     *
201     * @param requiredJavaVersion the required Java version for this plugin or {@code null} if unknown.
202     *  Must be a value according to semantics of {@link org.eclipse.aether.version.VersionConstraint}.
203     * @return This request.
204     * @since 3.8.0
205     */
206    PluginToolsRequest setRequiredJavaVersion(String requiredJavaVersion);
207
208    /**
209     *
210     * @return the required Java version for this plugin or {@code null} if unknown.
211     *  Is a value according to semantics of {@link org.eclipse.aether.version.VersionConstraint}.
212     * @since 3.8.0
213     */
214    String getRequiredJavaVersion();
215
216    /**
217     *
218     * @param mavenApiVersion
219     * @return his request.
220     * @since 3.8.0
221     */
222    PluginToolsRequest setUsedMavenApiVersion(String mavenApiVersion);
223
224    /**
225     *
226     * @return the Maven API version being referenced or {@code null} if unknown
227     * @since 3.8.0
228     */
229    String getUsedMavenApiVersion();
230}