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.building;
20  
21  /**
22   * Describes a problem that was encountered during model building. A problem can either be an exception that was thrown
23   * or a simple string message. In addition, a problem carries a hint about its source, e.g. the POM file that exhibits
24   * the problem.
25   *
26   * @deprecated use {@link org.apache.maven.api.services.ModelBuilder} instead
27   */
28  @Deprecated(since = "4.0.0")
29  public interface ModelProblem {
30  
31      /**
32       * The different severity levels for a problem, in decreasing order.
33       */
34      enum Severity {
35          FATAL, //
36          ERROR, //
37          WARNING //
38      }
39  
40      /**
41       * Version
42       */
43      enum Version {
44          // based on ModeBuildingResult.validationLevel
45          BASE,
46          V20,
47          V30,
48          V31,
49          V40,
50          V41
51      }
52  
53      /**
54       * Gets the identifier of the model from which the problem originated. The identifier is derived from the
55       * information that is available at the point the problem occurs and as such merely serves as best effort
56       * to provide information to the user to track the problem back to its origin.
57       *
58       * @return The hint about the source of the problem or an empty string if unknown, never {@code null}.
59       */
60      String getSource();
61  
62      /**
63       * Gets the one-based index of the line containing the problem. The line number should refer to some text file that
64       * is given by {@link #getSource()}.
65       *
66       * @return The one-based index of the line containing the problem or a non-positive value if unknown.
67       */
68      int getLineNumber();
69  
70      /**
71       * Gets the one-based index of the column containing the problem. The column number should refer to some text file
72       * that is given by {@link #getSource()}.
73       *
74       * @return The one-based index of the column containing the problem or non-positive value if unknown.
75       */
76      int getColumnNumber();
77  
78      /**
79       * Gets the identifier of the model from which the problem originated. While the general form of this identifier is
80       * <code>groupId:artifactId:version</code> the returned identifier need not be complete. The identifier is derived
81       * from the information that is available at the point the problem occurs and as such merely serves as a best effort
82       * to provide information to the user to track the problem back to its origin.
83       *
84       * @return The identifier of the model from which the problem originated or an empty string if unknown, never
85       *         {@code null}.
86       */
87      String getModelId();
88  
89      /**
90       * Gets the exception that caused this problem (if any).
91       *
92       * @return The exception that caused this problem or {@code null} if not applicable.
93       */
94      Exception getException();
95  
96      /**
97       * Gets the message that describes this problem.
98       *
99       * @return The message describing this problem, never {@code null}.
100      */
101     String getMessage();
102 
103     /**
104      * Gets the severity level of this problem.
105      *
106      * @return The severity level of this problem, never {@code null}.
107      */
108     Severity getSeverity();
109 
110     /**
111      * Gets the applicable maven version/validation level of this problem
112      * @return The version, never {@code null}.
113      */
114     Version getVersion();
115 }