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.plugins.annotations.Mojo;
24 import org.apache.maven.plugins.annotations.Parameter;
25 import org.apache.maven.scm.ScmException;
26 import org.apache.maven.scm.command.checkin.CheckInScmResult;
27 import org.apache.maven.scm.repository.ScmRepository;
28
29 import java.io.IOException;
30
31
32
33
34
35
36 @Mojo( name = "checkin", aggregator = true )
37 public class CheckinMojo
38 extends AbstractScmMojo
39 {
40
41
42
43 @Parameter( property = "message" )
44 private String message;
45
46
47
48
49 @Parameter( property = "connectionType", defaultValue = "developerConnection" )
50 private String connectionType;
51
52
53
54
55 @Parameter( property = "scmVersionType" )
56 private String scmVersionType;
57
58
59
60
61 @Parameter( property = "scmVersion" )
62 private String scmVersion;
63
64
65 public void execute()
66 throws MojoExecutionException
67 {
68 super.execute();
69
70 setConnectionType( connectionType );
71
72 try
73 {
74 ScmRepository repository = getScmRepository();
75
76 CheckInScmResult result = getScmManager().checkIn( repository, getFileSet(),
77 getScmVersion( scmVersionType, scmVersion ), message );
78
79 checkResult( result );
80 }
81 catch ( IOException e )
82 {
83 throw new MojoExecutionException( "Cannot run checkin command : ", e );
84 }
85 catch ( ScmException e )
86 {
87 throw new MojoExecutionException( "Cannot run checkin command : ", e );
88 }
89 }
90 }