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 org.apache.maven.artifact.Artifact;
023import org.apache.maven.artifact.repository.ArtifactRepository;
024import org.apache.maven.plugin.descriptor.PluginDescriptor;
025import org.apache.maven.project.MavenProject;
026
027import java.util.List;
028import java.util.Set;
029
030/**
031 * Request that encapsulates all information relevant to the process of extracting
032 * {@link org.apache.maven.plugin.descriptor.MojoDescriptor MojoDescriptor}
033 * instances from metadata for a certain type of mojo.
034 *
035 * @author jdcasey
036 * @since 2.5
037 */
038public interface PluginToolsRequest
039{
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}