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 public class PluginArtifact
32 extends DefaultArtifact
33 implements ArtifactWithDependencies
34 {
35 private Plugin plugin;
36
37 public PluginArtifact( Plugin plugin, Artifact pluginArtifact )
38 {
39 super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null,
40 new PluginArtifactHandler() );
41 this.plugin = plugin;
42 setFile( pluginArtifact.getFile() );
43 setResolved( true );
44 }
45
46 public List<Dependency> getDependencies()
47 {
48 return plugin.getDependencies();
49 }
50
51 public List<Dependency> getManagedDependencies()
52 {
53 return Collections.emptyList();
54 }
55
56 static class PluginArtifactHandler
57 implements ArtifactHandler
58 {
59 public String getClassifier()
60 {
61 return null;
62 }
63
64 public String getDirectory()
65 {
66 return null;
67 }
68
69 public String getExtension()
70 {
71 return "jar";
72 }
73
74 public String getLanguage()
75 {
76 return "none";
77 }
78
79 public String getPackaging()
80 {
81 return "maven-plugin";
82 }
83
84 public boolean isAddedToClasspath()
85 {
86 return true;
87 }
88
89 public boolean isIncludesDependencies()
90 {
91 return false;
92 }
93 }
94 }