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