1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.project.collector;
20
21 import javax.inject.Inject;
22 import javax.inject.Named;
23 import javax.inject.Singleton;
24
25 import java.io.File;
26 import java.util.Collections;
27 import java.util.List;
28
29 import org.apache.maven.execution.MavenExecutionRequest;
30 import org.apache.maven.project.MavenProject;
31 import org.apache.maven.project.ProjectBuildingException;
32
33
34
35
36 @Named("RequestPomCollectionStrategy")
37 @Singleton
38 public class RequestPomCollectionStrategy implements ProjectCollectionStrategy {
39 private final ProjectsSelector projectsSelector;
40
41 @Inject
42 public RequestPomCollectionStrategy(ProjectsSelector projectsSelector) {
43 this.projectsSelector = projectsSelector;
44 }
45
46 @Override
47 public List<MavenProject> collectProjects(MavenExecutionRequest request) throws ProjectBuildingException {
48 List<File> files = Collections.singletonList(request.getPom().getAbsoluteFile());
49 return projectsSelector.selectProjects(files, request);
50 }
51 }