001 package 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
022 import org.apache.maven.artifact.Artifact;
023 import org.apache.maven.artifact.repository.ArtifactRepository;
024 import org.apache.maven.plugin.descriptor.MojoDescriptor;
025 import org.apache.maven.plugin.descriptor.PluginDescriptor;
026 import org.apache.maven.project.MavenProject;
027
028 import java.util.List;
029 import java.util.Set;
030
031 /**
032 * Request that encapsulates all information relevant to the process of extracting {@link MojoDescriptor}
033 * instances from metadata for a certain type of mojo.
034 *
035 * @author jdcasey
036 * @since 2.5
037 */
038 public 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
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
097 * @since 3.0
098 */
099 Set<Artifact> getDependencies();
100
101 /**
102 * @param dependencies
103 * @return
104 * @since 3.0
105 */
106 PluginToolsRequest setDependencies( Set<Artifact> dependencies );
107
108 /**
109 *
110 * @return
111 * @since 3.0
112 */
113 List<ArtifactRepository> getRemoteRepos();
114
115 /**
116 *
117 * @param remoteRepos
118 * @return
119 * @since 3.0
120 */
121 PluginToolsRequest setRemoteRepos( List<ArtifactRepository> remoteRepos );
122
123 /**
124 *
125 * @return
126 * @since 3.0
127 */
128 ArtifactRepository getLocal();
129
130 /**
131 *
132 * @param local
133 * @return
134 * @since 3.0
135 */
136 PluginToolsRequest setLocal( ArtifactRepository local );
137
138 }