View Javadoc
1   package org.apache.maven.artifact.resolver;
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  
23  import java.util.List;
24  
25  import org.apache.maven.artifact.Artifact;
26  import org.apache.maven.artifact.repository.ArtifactRepository;
27  
28  /**
29   * @author Jason van Zyl
30   */
31  public class ArtifactNotFoundException
32      extends AbstractArtifactResolutionException
33  {
34      private String downloadUrl;
35  
36      protected ArtifactNotFoundException( String message, Artifact artifact,
37                                           List<ArtifactRepository> remoteRepositories )
38      {
39          super( message, artifact, remoteRepositories );
40      }
41  
42      public ArtifactNotFoundException( String message, Artifact artifact )
43      {
44          this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
45                artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() );
46      }
47  
48      protected ArtifactNotFoundException( String message, Artifact artifact,
49                                           List<ArtifactRepository> remoteRepositories, Throwable cause )
50      {
51          this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
52                artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(),
53                cause );
54      }
55  
56      @SuppressWarnings( "checkstyle:parameternumber" )
57      public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
58                                        String classifier, List<ArtifactRepository> remoteRepositories,
59                                        String downloadUrl, List<String> path, Throwable cause )
60      {
61          super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
62                                                  downloadUrl, path ), groupId, artifactId, version, type, classifier,
63                 remoteRepositories, null, cause );
64  
65          this.downloadUrl = downloadUrl;
66      }
67  
68      @SuppressWarnings( "checkstyle:parameternumber" )
69      private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
70                                         String classifier, List<ArtifactRepository> remoteRepositories,
71                                         String downloadUrl, List<String> path )
72      {
73          super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
74                                                  downloadUrl, path ), groupId, artifactId, version, type, classifier,
75                 remoteRepositories, null );
76  
77          this.downloadUrl = downloadUrl;
78      }
79  
80      public String getDownloadUrl()
81      {
82          return downloadUrl;
83      }
84  
85  }