View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.version;
20  
21  import java.util.List;
22  
23  import org.apache.maven.model.Model;
24  import org.eclipse.aether.RepositorySystemSession;
25  import org.eclipse.aether.repository.RemoteRepository;
26  
27  /**
28   * Collects settings required to resolve the version for a plugin.
29   *
30   * @since 3.0
31   */
32  public interface PluginVersionRequest {
33  
34      /**
35       * Gets the group id of the plugin.
36       *
37       * @return The group id of the plugin.
38       */
39      String getGroupId();
40  
41      /**
42       * Sets the group id of the plugin.
43       *
44       * @param groupId The group id of the plugin.
45       * @return This request, never {@code null}.
46       */
47      PluginVersionRequest setGroupId(String groupId);
48  
49      /**
50       * Gets the artifact id of the plugin.
51       *
52       * @return The artifact id of the plugin.
53       */
54      String getArtifactId();
55  
56      /**
57       * Sets the artifact id of the plugin.
58       *
59       * @param artifactId The artifact id of the plugin.
60       * @return This request, never {@code null}.
61       */
62      PluginVersionRequest setArtifactId(String artifactId);
63  
64      /**
65       * Gets the POM whose build plugins are to be scanned for the version.
66       *
67       * @return The POM whose build plugins are to be scanned for the version or {@code null} to only search the plugin
68       *         repositories.
69       */
70      Model getPom();
71  
72      /**
73       * Sets the POM whose build plugins are to be scanned for the version.
74       *
75       * @param pom The POM whose build plugins are to be scanned for the version, may be {@code null} to only search the
76       *            plugin repositories.
77       * @return This request, never {@code null}.
78       */
79      PluginVersionRequest setPom(Model pom);
80  
81      /**
82       * Gets the remote repositories to use.
83       *
84       * @return The remote repositories to use, never {@code null}.
85       */
86      List<RemoteRepository> getRepositories();
87  
88      /**
89       * Sets the remote repositories to use. <em>Note:</em> When creating a request from a project, be sure to use the
90       * plugin repositories and not the regular project repositories.
91       *
92       * @param repositories The remote repositories to use.
93       * @return This request, never {@code null}.
94       */
95      PluginVersionRequest setRepositories(List<RemoteRepository> repositories);
96  
97      /**
98       * Gets the session to use for repository access.
99       *
100      * @return The repository session or {@code null} if not set.
101      */
102     RepositorySystemSession getRepositorySession();
103 
104     /**
105      * Sets the session to use for repository access.
106      *
107      * @param repositorySession The repository session to use.
108      * @return This request, never {@code null}.
109      */
110     PluginVersionRequest setRepositorySession(RepositorySystemSession repositorySession);
111 }