1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.resolution
;
13 import org
.eclipse
.aether
.RepositoryException
;
16 * Thrown in case of a unresolvable dependencies.
18 public class DependencyResolutionException
19 extends RepositoryException
22 private final transient DependencyResult result
;
25 * Creates a new exception with the specified result and cause.
27 * @param result The dependency result at the point the exception occurred, may be {@code null}.
28 * @param cause The exception that caused this one, may be {@code null}.
30 public DependencyResolutionException( DependencyResult result
, Throwable cause
)
32 super( getMessage( cause
), cause
);
37 * Creates a new exception with the specified result, detail message and cause.
39 * @param result The dependency result at the point the exception occurred, may be {@code null}.
40 * @param message The detail message, may be {@code null}.
41 * @param cause The exception that caused this one, may be {@code null}.
43 public DependencyResolutionException( DependencyResult result
, String message
, Throwable cause
)
45 super( message
, cause
);
49 private static String
getMessage( Throwable cause
)
54 msg
= cause
.getMessage();
56 if ( msg
== null || msg
.length() <= 0 )
58 msg
= "Could not resolve transitive dependencies";
64 * Gets the dependency result at the point the exception occurred. Despite being incomplete, callers might want to
65 * use this result to fail gracefully and continue their operation with whatever interim data has been gathered.
67 * @return The dependency result or {@code null} if unknown.
69 public DependencyResult
getResult()