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, List<ArtifactRepository> remoteRepositories )
37      {
38          super( message, artifact, remoteRepositories );
39      }
40  
41      public ArtifactNotFoundException( String message, Artifact artifact )
42      {
43          this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
44                artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() );
45      }
46  
47      protected ArtifactNotFoundException( String message, Artifact artifact,
48                                           List<ArtifactRepository> remoteRepositories, Throwable cause )
49      {
50          this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
51                artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(),
52                cause );
53      }
54  
55      public ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
56                                        String classifier, List<ArtifactRepository> remoteRepositories,
57                                        String downloadUrl, List<String> path, Throwable cause )
58      {
59          super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
60                                                  downloadUrl, path ), groupId, artifactId, version, type, classifier,
61                 remoteRepositories, null, cause );
62  
63          this.downloadUrl = downloadUrl;
64      }
65  
66      private ArtifactNotFoundException( String message, String groupId, String artifactId, String version, String type,
67                                         String classifier, List<ArtifactRepository> remoteRepositories,
68                                         String downloadUrl, List<String> path )
69      {
70          super( constructMissingArtifactMessage( message, "", groupId, artifactId, version, type, classifier,
71                                                  downloadUrl, path ), groupId, artifactId, version, type, classifier,
72                 remoteRepositories, null );
73  
74          this.downloadUrl = downloadUrl;
75      }
76  
77      public String getDownloadUrl()
78      {
79          return downloadUrl;
80      }
81  
82  }