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 the current {@link MavenProject} instance in use.
43       */
44      MavenProject getProject();
45  
46      /**
47       * @see PluginToolsRequest#getProject()
48       */
49      PluginToolsRequest setProject( MavenProject project );
50  
51      /**
52       * Return the {@link PluginDescriptor} currently being populated as part of the build of the
53       * current plugin project.
54       */
55      PluginDescriptor getPluginDescriptor();
56  
57      /**
58       * @see PluginToolsRequest#getPluginDescriptor()
59       */
60      PluginToolsRequest setPluginDescriptor( PluginDescriptor pluginDescriptor );
61  
62      /**
63       * Gets the file encoding of the source files.
64       *
65       * @return The file encoding of the source files, never <code>null</code>.
66       */
67      String getEncoding();
68  
69      /**
70       * Sets the file encoding of the source files.
71       *
72       * @param encoding The file encoding of the source files, may be empty or <code>null</code> to use the platform's
73       *                 default encoding.
74       * @return This request.
75       */
76      PluginToolsRequest setEncoding( String encoding );
77  
78      /**
79       * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
80       * descriptor generator mojo is bound to generate-resources phase.
81       * But for annotations, the compiled classes are needed, so skip error
82       *
83       * @since 3.0
84       */
85      PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound );
86  
87      /**
88       * @return <code>true</code> if no descriptor found should not cause a failure
89       * @since 3.0
90       */
91      boolean isSkipErrorNoDescriptorsFound();
92  
93      /**
94       * Returns the list of {@link Artifact} used in class path scanning for annotations
95       *
96       * @return the dependencies
97       * @since 3.0
98       */
99      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 }