001package org.apache.maven.tools.plugin;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.net.URI;
023import java.util.List;
024import java.util.Set;
025
026import org.apache.maven.artifact.Artifact;
027import org.apache.maven.artifact.repository.ArtifactRepository;
028import org.apache.maven.plugin.descriptor.PluginDescriptor;
029import org.apache.maven.project.MavenProject;
030import org.apache.maven.settings.Settings;
031
032/**
033 * Request that encapsulates all information relevant to the process of extracting
034 * {@link org.apache.maven.plugin.descriptor.MojoDescriptor MojoDescriptor}
035 * instances from metadata for a certain type of mojo.
036 *
037 * @author jdcasey
038 * @since 2.5
039 */
040public interface PluginToolsRequest
041{
042
043    /**
044     * @return Return the current {@link MavenProject} instance in use.
045     */
046    MavenProject getProject();
047
048    /**
049     * @param project the current {@link MavenProject}
050     * @see PluginToolsRequest#getProject()
051     * @return This request.
052     */
053    PluginToolsRequest setProject( MavenProject project );
054
055    /**
056     * @return Return the {@link PluginDescriptor} currently being populated as part of the build of the
057     * current plugin project.
058     */
059    PluginDescriptor getPluginDescriptor();
060
061    /**
062     * @see PluginToolsRequest#getPluginDescriptor()
063     * @param pluginDescriptor the {@link PluginDescriptor}
064     * @return This request.
065     */
066    PluginToolsRequest setPluginDescriptor( PluginDescriptor pluginDescriptor );
067
068    /**
069     * Gets the file encoding of the source files.
070     *
071     * @return The file encoding of the source files, never <code>null</code>.
072     */
073    String getEncoding();
074
075    /**
076     * Sets the file encoding of the source files.
077     *
078     * @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
079     *                 default encoding.
080     * @return This request.
081     */
082    PluginToolsRequest setEncoding( String encoding );
083
084    /**
085     * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
086     * descriptor generator mojo is bound to generate-resources phase.
087     * But for annotations, the compiled classes are needed, so skip error
088     * @param skipErrorNoDescriptorsFound <code>true</code> to skip errors because of not found descriptors
089     * @return This request.
090     * @since 3.0
091     */
092    PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound );
093
094    /**
095     * @return <code>true</code> if no descriptor found should not cause a failure
096     * @since 3.0
097     */
098    boolean isSkipErrorNoDescriptorsFound();
099
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}