1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.scm.plugin;
20
21 import java.io.IOException;
22
23 import org.apache.maven.plugin.MojoExecutionException;
24 import org.apache.maven.plugins.annotations.Mojo;
25 import org.apache.maven.plugins.annotations.Parameter;
26 import org.apache.maven.scm.ScmException;
27 import org.apache.maven.scm.ScmFile;
28 import org.apache.maven.scm.command.list.ListScmResult;
29 import org.apache.maven.scm.repository.ScmRepository;
30
31
32
33
34
35
36 @Mojo(name = "list", aggregator = true)
37 public class ListMojo extends AbstractScmMojo {
38
39
40
41 @Parameter(property = "scmVersionType")
42 private String scmVersionType;
43
44
45
46
47 @Parameter(property = "scmVersion")
48 private String scmVersion;
49
50
51
52
53 @Parameter(property = "recursive", defaultValue = "true")
54 private boolean recursive = true;
55
56
57 public void execute() throws MojoExecutionException {
58 super.execute();
59
60 try {
61 ScmRepository repository = getScmRepository();
62 ListScmResult result = getScmManager()
63 .list(repository, getFileSet(), recursive, getScmVersion(scmVersionType, scmVersion));
64
65 checkResult(result);
66
67 if (result.getFiles() != null) {
68 for (ScmFile scmFile : result.getFiles()) {
69 getLog().info(scmFile.getPath());
70 }
71 }
72 } catch (ScmException | IOException e) {
73 throw new MojoExecutionException("Cannot run list command : ", e);
74 }
75 }
76 }