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.model.resolution;
20  
21  /**
22   * Signals an error when resolving the path to an external model.
23   *
24   * @deprecated use {@link org.apache.maven.api.services.ModelBuilder} instead
25   */
26  @Deprecated(since = "4.0.0")
27  public class UnresolvableModelException extends Exception {
28  
29      /**
30       * The group id of the unresolvable model.
31       */
32      private final String groupId;
33  
34      /**
35       * The artifact id of the unresolvable model.
36       */
37      private final String artifactId;
38  
39      /**
40       * The version of the unresolvable model.
41       */
42      private final String version;
43  
44      /**
45       * Creates a new exception with specified detail message and cause.
46       *
47       * @param message The detail message, may be {@code null}.
48       * @param groupId The group id of the unresolvable model, may be {@code null}.
49       * @param artifactId The artifact id of the unresolvable model, may be {@code null}.
50       * @param version The version of the unresolvable model, may be {@code null}.
51       * @param cause The cause, may be {@code null}.
52       */
53      public UnresolvableModelException(
54              String message, String groupId, String artifactId, String version, Throwable cause) {
55          super(message, cause);
56          this.groupId = (groupId != null) ? groupId : "";
57          this.artifactId = (artifactId != null) ? artifactId : "";
58          this.version = (version != null) ? version : "";
59      }
60  
61      /**
62       * Creates a new exception with specified detail message.
63       *
64       * @param message The detail message, may be {@code null}.
65       * @param groupId The group id of the unresolvable model, may be {@code null}.
66       * @param artifactId The artifact id of the unresolvable model, may be {@code null}.
67       * @param version The version of the unresolvable model, may be {@code null}.
68       */
69      public UnresolvableModelException(String message, String groupId, String artifactId, String version) {
70          super(message);
71          this.groupId = (groupId != null) ? groupId : "";
72          this.artifactId = (artifactId != null) ? artifactId : "";
73          this.version = (version != null) ? version : "";
74      }
75  
76      /**
77       * Creates a new exception with specified cause
78       *
79       * @param cause
80       * @param groupId
81       * @param artifactId
82       * @param version
83       */
84      public UnresolvableModelException(Throwable cause, String groupId, String artifactId, String version) {
85          super(cause);
86          this.groupId = groupId;
87          this.artifactId = artifactId;
88          this.version = version;
89      }
90  
91      /**
92       * Gets the group id of the unresolvable model.
93       *
94       * @return The group id of the unresolvable model, can be empty but never {@code null}.
95       */
96      public String getGroupId() {
97          return groupId;
98      }
99  
100     /**
101      * Gets the artifact id of the unresolvable model.
102      *
103      * @return The artifact id of the unresolvable model, can be empty but never {@code null}.
104      */
105     public String getArtifactId() {
106         return artifactId;
107     }
108 
109     /**
110      * Gets the version of the unresolvable model.
111      *
112      * @return The version of the unresolvable model, can be empty but never {@code null}.
113      */
114     public String getVersion() {
115         return version;
116     }
117 }