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.DefaultArtifact;
26 import org.apache.maven.artifact.handler.ArtifactHandler;
27 import org.apache.maven.model.Dependency;
28 import org.apache.maven.model.DependencyManagement;
29 import org.apache.maven.project.MavenProject;
30
31
32
33
34 public class ProjectArtifact
35 extends DefaultArtifact
36 implements ArtifactWithDependencies
37 {
38 private MavenProject project;
39
40 public ProjectArtifact( MavenProject project )
41 {
42 super( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, "pom", null,
43 new PomArtifactHandler() );
44 this.project = project;
45 setFile( project.getFile() );
46 setResolved( true );
47 }
48
49 public MavenProject getProject()
50 {
51 return project;
52 }
53
54 public List<Dependency> getDependencies()
55 {
56 return project.getDependencies();
57 }
58
59 public List<Dependency> getManagedDependencies()
60 {
61 DependencyManagement depMngt = project.getDependencyManagement();
62 return ( depMngt != null )
63 ? Collections.unmodifiableList( depMngt.getDependencies() )
64 : Collections.<Dependency>emptyList();
65
66 }
67
68 static class PomArtifactHandler
69 implements ArtifactHandler
70 {
71 public String getClassifier()
72 {
73 return null;
74 }
75
76 public String getDirectory()
77 {
78 return null;
79 }
80
81 public String getExtension()
82 {
83 return "pom";
84 }
85
86 public String getLanguage()
87 {
88 return "none";
89 }
90
91 public String getPackaging()
92 {
93 return "pom";
94 }
95
96 public boolean isAddedToClasspath()
97 {
98 return false;
99 }
100
101 public boolean isIncludesDependencies()
102 {
103 return false;
104 }
105 }
106 }