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 the current {@link MavenProject} instance in use.
043     */
044    MavenProject getProject();
045
046    /**
047     * @see PluginToolsRequest#getProject()
048     */
049    PluginToolsRequest setProject( MavenProject project );
050
051    /**
052     * Return the {@link PluginDescriptor} currently being populated as part of the build of the
053     * current plugin project.
054     */
055    PluginDescriptor getPluginDescriptor();
056
057    /**
058     * @see PluginToolsRequest#getPluginDescriptor()
059     */
060    PluginToolsRequest setPluginDescriptor( PluginDescriptor pluginDescriptor );
061
062    /**
063     * Gets the file encoding of the source files.
064     *
065     * @return The file encoding of the source files, never <code>null</code>.
066     */
067    String getEncoding();
068
069    /**
070     * Sets the file encoding of the source files.
071     *
072     * @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
073     *                 default encoding.
074     * @return This request.
075     */
076    PluginToolsRequest setEncoding( String encoding );
077
078    /**
079     * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
080     * descriptor generator mojo is bound to generate-resources phase.
081     * But for annotations, the compiled classes are needed, so skip error
082     *
083     * @since 3.0
084     */
085    PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound );
086
087    /**
088     * @return <code>true</code> if no descriptor found should not cause a failure
089     * @since 3.0
090     */
091    boolean isSkipErrorNoDescriptorsFound();
092
093    /**
094     * Returns the list of {@link Artifact} used in class path scanning for annotations
095     *
096     * @return the dependencies
097     * @since 3.0
098     */
099    Set<Artifact> getDependencies();
100
101    /**
102     * @param dependencies
103     * @return This request.
104     * @since 3.0
105     */
106    PluginToolsRequest setDependencies( Set<Artifact> dependencies );
107
108    /**
109     *
110     * @return the remote repositories
111     * @since 3.0
112     */
113    List<ArtifactRepository> getRemoteRepos();
114
115    /**
116     *
117     * @param remoteRepos
118     * @return This request.
119     * @since 3.0
120     */
121    PluginToolsRequest setRemoteRepos( List<ArtifactRepository> remoteRepos );
122
123    /**
124     *
125     * @return the local artifact repository
126     * @since 3.0
127     */
128    ArtifactRepository getLocal();
129
130    /**
131     *
132     * @param local
133     * @return This request.
134     * @since 3.0
135     */
136    PluginToolsRequest setLocal( ArtifactRepository local );
137
138}