001package org.apache.maven.model.resolution; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022/** 023 * Signals an error when resolving the path to an external model. 024 * 025 * @author Benjamin Bentmann 026 */ 027public class UnresolvableModelException 028 extends Exception 029{ 030 031 /** 032 * The group id of the unresolvable model. 033 */ 034 private final String groupId; 035 036 /** 037 * The artifact id of the unresolvable model. 038 */ 039 private final String artifactId; 040 041 /** 042 * The version of the unresolvable model. 043 */ 044 private final String version; 045 046 /** 047 * Creates a new exception with specified detail message and cause. 048 * 049 * @param message The detail message, may be {@code null}. 050 * @param groupId The group id of the unresolvable model, may be {@code null}. 051 * @param artifactId The artifact id of the unresolvable model, may be {@code null}. 052 * @param version The version of the unresolvable model, may be {@code null}. 053 * @param cause The cause, may be {@code null}. 054 */ 055 public UnresolvableModelException( String message, String groupId, String artifactId, String version, 056 Throwable cause ) 057 { 058 super( message, cause ); 059 this.groupId = ( groupId != null ) ? groupId : ""; 060 this.artifactId = ( artifactId != null ) ? artifactId : ""; 061 this.version = ( version != null ) ? version : ""; 062 } 063 064 /** 065 * Creates a new exception with specified detail message. 066 * 067 * @param message The detail message, may be {@code null}. 068 * @param groupId The group id of the unresolvable model, may be {@code null}. 069 * @param artifactId The artifact id of the unresolvable model, may be {@code null}. 070 * @param version The version of the unresolvable model, may be {@code null}. 071 */ 072 public UnresolvableModelException( String message, String groupId, String artifactId, String version ) 073 { 074 super( message ); 075 this.groupId = ( groupId != null ) ? groupId : ""; 076 this.artifactId = ( artifactId != null ) ? artifactId : ""; 077 this.version = ( version != null ) ? version : ""; 078 } 079 080 /** 081 * Creates a new exception with specified cause 082 * 083 * @param cause 084 * @param groupId 085 * @param artifactId 086 * @param version 087 */ 088 public UnresolvableModelException( Throwable cause, String groupId, String artifactId, String version ) 089 { 090 super( cause ); 091 this.groupId = groupId; 092 this.artifactId = artifactId; 093 this.version = version; 094 } 095 096 /** 097 * Gets the group id of the unresolvable model. 098 * 099 * @return The group id of the unresolvable model, can be empty but never {@code null}. 100 */ 101 public String getGroupId() 102 { 103 return groupId; 104 } 105 106 /** 107 * Gets the artifact id of the unresolvable model. 108 * 109 * @return The artifact id of the unresolvable model, can be empty but never {@code null}. 110 */ 111 public String getArtifactId() 112 { 113 return artifactId; 114 } 115 116 /** 117 * Gets the version of the unresolvable model. 118 * 119 * @return The version of the unresolvable model, can be empty but never {@code null}. 120 */ 121 public String getVersion() 122 { 123 return version; 124 } 125 126}