1 package org.apache.maven.scm.plugin;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugin.MojoExecutionException;
23 import org.apache.maven.scm.ScmException;
24 import org.apache.maven.scm.ScmFile;
25 import org.apache.maven.scm.command.remove.RemoveScmResult;
26 import org.apache.maven.scm.repository.ScmRepository;
27
28 import java.io.IOException;
29
30
31
32
33
34
35
36
37 public class RemoveMojo extends AbstractScmMojo {
38
39
40
41
42
43
44 private String message;
45
46
47
48
49 public void execute() throws MojoExecutionException {
50 super.execute();
51 try {
52 ScmRepository repository = getScmRepository();
53 RemoveScmResult result = getScmManager().remove(repository, getFileSet(), message);
54 checkResult(result);
55 for (ScmFile removedFile : result.getRemovedFiles()) {
56 getLog().info("Removed " + removedFile.getPath());
57 }
58 } catch (IOException e) {
59 throw new MojoExecutionException("Cannot run remove command : " + e.getMessage(), e);
60 } catch (ScmException e) {
61 throw new MojoExecutionException("Cannot run remove command : " + e.getMessage(), e);
62 }
63 }
64 }