1 | |
package org.apache.maven.artifact.ant; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.artifact.Artifact; |
23 | |
import org.apache.maven.artifact.resolver.ResolutionListener; |
24 | |
import org.apache.maven.artifact.versioning.VersionRange; |
25 | |
import org.apache.tools.ant.Project; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public class AntResolutionListener |
34 | |
implements ResolutionListener |
35 | |
{ |
36 | 0 | private String indent = " "; |
37 | |
|
38 | |
private final Project project; |
39 | |
|
40 | |
public AntResolutionListener( Project project ) |
41 | 0 | { |
42 | 0 | this.project = project; |
43 | 0 | } |
44 | |
|
45 | |
public void testArtifact( Artifact node ) |
46 | |
{ |
47 | 0 | } |
48 | |
|
49 | |
public void startProcessChildren( Artifact artifact ) |
50 | |
{ |
51 | 0 | indent += " "; |
52 | 0 | } |
53 | |
|
54 | |
public void endProcessChildren( Artifact artifact ) |
55 | |
{ |
56 | 0 | indent = indent.substring( 2 ); |
57 | 0 | } |
58 | |
|
59 | |
public void includeArtifact( Artifact artifact ) |
60 | |
{ |
61 | 0 | project.log( indent + artifact + " (selected)", Project.MSG_VERBOSE ); |
62 | 0 | } |
63 | |
|
64 | |
public void omitForNearer( Artifact omitted, Artifact kept ) |
65 | |
{ |
66 | 0 | project.log( indent + omitted + " (removed - nearer found: " + kept.getVersion() + ")", Project.MSG_VERBOSE ); |
67 | 0 | } |
68 | |
|
69 | |
public void omitForCycle( Artifact omitted ) |
70 | |
{ |
71 | 0 | project.log( indent + omitted + " (removed - causes a cycle in the graph)", Project.MSG_VERBOSE ); |
72 | 0 | } |
73 | |
|
74 | |
public void updateScope( Artifact artifact, String scope ) |
75 | |
{ |
76 | 0 | project.log( indent + artifact + " (setting scope to: " + scope + ")", Project.MSG_VERBOSE ); |
77 | 0 | } |
78 | |
|
79 | |
public void updateScopeCurrentPom( Artifact artifact, String scope ) |
80 | |
{ |
81 | 0 | project.log( indent + artifact + " (not setting scope to: " + scope + "; local scope " + artifact.getScope() |
82 | |
+ " wins)", Project.MSG_VERBOSE ); |
83 | 0 | } |
84 | |
|
85 | |
public void selectVersionFromRange( Artifact artifact ) |
86 | |
{ |
87 | 0 | project.log( indent + artifact + " (setting version to: " + artifact.getVersion() + " from range: " |
88 | |
+ artifact.getVersionRange() + ")", Project.MSG_VERBOSE ); |
89 | 0 | } |
90 | |
|
91 | |
public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange ) |
92 | |
{ |
93 | 0 | project.log( indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: " |
94 | |
+ replacement.getVersionRange() + " to: " + newRange + " )", Project.MSG_VERBOSE ); |
95 | 0 | } |
96 | |
|
97 | |
public void manageArtifact( Artifact artifact, Artifact replacement ) |
98 | |
{ |
99 | 0 | String msg = indent + artifact; |
100 | 0 | msg += " ("; |
101 | 0 | if ( replacement.getVersion() != null ) |
102 | |
{ |
103 | 0 | msg += "applying version: " + replacement.getVersion() + ";"; |
104 | |
} |
105 | 0 | if ( replacement.getScope() != null ) |
106 | |
{ |
107 | 0 | msg += "applying scope: " + replacement.getScope(); |
108 | |
} |
109 | 0 | msg += ")"; |
110 | 0 | project.log( msg, Project.MSG_VERBOSE ); |
111 | 0 | } |
112 | |
} |