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   * @author Benjamin Bentmann
32   */
33  public interface PluginVersionRequest {
34  
35      /**
36       * Gets the group id of the plugin.
37       *
38       * @return The group id of the plugin.
39       */
40      String getGroupId();
41  
42      /**
43       * Sets the group id of the plugin.
44       *
45       * @param groupId The group id of the plugin.
46       * @return This request, never {@code null}.
47       */
48      PluginVersionRequest setGroupId(String groupId);
49  
50      /**
51       * Gets the artifact id of the plugin.
52       *
53       * @return The artifact id of the plugin.
54       */
55      String getArtifactId();
56  
57      /**
58       * Sets the artifact id of the plugin.
59       *
60       * @param artifactId The artifact id of the plugin.
61       * @return This request, never {@code null}.
62       */
63      PluginVersionRequest setArtifactId(String artifactId);
64  
65      /**
66       * Gets the POM whose build plugins are to be scanned for the version.
67       *
68       * @return The POM whose build plugins are to be scanned for the version or {@code null} to only search the plugin
69       *         repositories.
70       */
71      Model getPom();
72  
73      /**
74       * Sets the POM whose build plugins are to be scanned for the version.
75       *
76       * @param pom The POM whose build plugins are to be scanned for the version, may be {@code null} to only search the
77       *            plugin repositories.
78       * @return This request, never {@code null}.
79       */
80      PluginVersionRequest setPom(Model pom);
81  
82      /**
83       * Gets the remote repositories to use.
84       *
85       * @return The remote repositories to use, never {@code null}.
86       */
87      List<RemoteRepository> getRepositories();
88  
89      /**
90       * Sets the remote repositories to use. <em>Note:</em> When creating a request from a project, be sure to use the
91       * plugin repositories and not the regular project repositories.
92       *
93       * @param repositories The remote repositories to use.
94       * @return This request, never {@code null}.
95       */
96      PluginVersionRequest setRepositories(List<RemoteRepository> repositories);
97  
98      /**
99       * Gets the session to use for repository access.
100      *
101      * @return The repository session or {@code null} if not set.
102      */
103     RepositorySystemSession getRepositorySession();
104 
105     /**
106      * Sets the session to use for repository access.
107      *
108      * @param repositorySession The repository session to use.
109      * @return This request, never {@code null}.
110      */
111     PluginVersionRequest setRepositorySession(RepositorySystemSession repositorySession);
112 }