View Javadoc

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