1 package org.apache.maven.plugin.prefix;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.List;
23
24 import org.eclipse.aether.repository.LocalRepository;
25 import org.eclipse.aether.repository.RemoteRepository;
26
27
28
29
30 public class NoPluginFoundForPrefixException
31 extends Exception
32 {
33
34 public NoPluginFoundForPrefixException( String prefix, List<String> pluginGroups, LocalRepository localRepository,
35 List<RemoteRepository> remoteRepositories )
36 {
37 super( "No plugin found for prefix '" + prefix + "' in the current project and in the plugin groups "
38 + pluginGroups + " available from the repositories " + format( localRepository, remoteRepositories ) );
39 }
40
41 private static String format( LocalRepository localRepository, List<RemoteRepository> remoteRepositories )
42 {
43 String repos = "[";
44
45 if ( localRepository != null )
46 {
47 repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
48 }
49
50 if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
51 {
52 for ( RemoteRepository repository : remoteRepositories )
53 {
54 repos += ", ";
55
56 if ( repository != null )
57 {
58 repos += repository.getId() + " (" + repository.getUrl() + ")";
59 }
60 }
61 }
62
63 repos += "]";
64
65 return repos;
66 }
67
68 }