1 package org.apache.maven.project.artifact;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Collections;
23 import java.util.List;
24
25 import org.apache.maven.artifact.Artifact;
26 import org.apache.maven.artifact.DefaultArtifact;
27 import org.apache.maven.artifact.handler.ArtifactHandler;
28 import org.apache.maven.model.Dependency;
29 import org.apache.maven.model.Plugin;
30
31
32
33
34 public class PluginArtifact
35 extends DefaultArtifact
36 implements ArtifactWithDependencies
37 {
38 private Plugin plugin;
39
40 public PluginArtifact( Plugin plugin, Artifact pluginArtifact )
41 {
42 super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null,
43 new PluginArtifactHandler() );
44 this.plugin = plugin;
45 setFile( pluginArtifact.getFile() );
46 setResolved( true );
47 }
48
49 public List<Dependency> getDependencies()
50 {
51 return plugin.getDependencies();
52 }
53
54 public List<Dependency> getManagedDependencies()
55 {
56 return Collections.emptyList();
57 }
58
59 static class PluginArtifactHandler
60 implements ArtifactHandler
61 {
62 public String getClassifier()
63 {
64 return null;
65 }
66
67 public String getDirectory()
68 {
69 return null;
70 }
71
72 public String getExtension()
73 {
74 return "jar";
75 }
76
77 public String getLanguage()
78 {
79 return "none";
80 }
81
82 public String getPackaging()
83 {
84 return "maven-plugin";
85 }
86
87 public boolean isAddedToClasspath()
88 {
89 return true;
90 }
91
92 public boolean isIncludesDependencies()
93 {
94 return false;
95 }
96 }
97 }