View Javadoc
1   package org.apache.maven.tools.plugin;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.repository.ArtifactRepository;
24  import org.apache.maven.plugin.descriptor.PluginDescriptor;
25  import org.apache.maven.project.MavenProject;
26  
27  import java.util.List;
28  import java.util.Set;
29  
30  /**
31   * Request that encapsulates all information relevant to the process of extracting
32   * {@link org.apache.maven.plugin.descriptor.MojoDescriptor MojoDescriptor}
33   * instances from metadata for a certain type of mojo.
34   *
35   * @author jdcasey
36   * @since 2.5
37   */
38  public interface PluginToolsRequest
39  {
40  
41      /**
42       * @return Return the current {@link MavenProject} instance in use.
43       */
44      MavenProject getProject();
45  
46      /**
47       * @param project the current {@link MavenProject}
48       * @see PluginToolsRequest#getProject()
49       * @return This request.
50       */
51      PluginToolsRequest setProject( MavenProject project );
52  
53      /**
54       * @return Return the {@link PluginDescriptor} currently being populated as part of the build of the
55       * current plugin project.
56       */
57      PluginDescriptor getPluginDescriptor();
58  
59      /**
60       * @see PluginToolsRequest#getPluginDescriptor()
61       * @param pluginDescriptor the {@link PluginDescriptor}
62       * @return This request.
63       */
64      PluginToolsRequest setPluginDescriptor( PluginDescriptor pluginDescriptor );
65  
66      /**
67       * Gets the file encoding of the source files.
68       *
69       * @return The file encoding of the source files, never <code>null</code>.
70       */
71      String getEncoding();
72  
73      /**
74       * Sets the file encoding of the source files.
75       *
76       * @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
77       *                 default encoding.
78       * @return This request.
79       */
80      PluginToolsRequest setEncoding( String encoding );
81  
82      /**
83       * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
84       * descriptor generator mojo is bound to generate-resources phase.
85       * But for annotations, the compiled classes are needed, so skip error
86       * @param skipErrorNoDescriptorsFound <code>true</code> to skip errors because of not found descriptors
87       * @return This request.
88       * @since 3.0
89       */
90      PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound );
91  
92      /**
93       * @return <code>true</code> if no descriptor found should not cause a failure
94       * @since 3.0
95       */
96      boolean isSkipErrorNoDescriptorsFound();
97  
98      /**
99       * 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 }