Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CheckinMojo |
|
| 5.0;5 |
1 | package org.apache.maven.scm.plugin; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one | |
5 | * or more contributor license agreements. See the NOTICE file | |
6 | * distributed with this work for additional information | |
7 | * regarding copyright ownership. The ASF licenses this file | |
8 | * to you under the Apache License, Version 2.0 (the | |
9 | * "License"); you may not use this file except in compliance | |
10 | * with the License. You may obtain a copy of the License at | |
11 | * | |
12 | * http://www.apache.org/licenses/LICENSE-2.0 | |
13 | * | |
14 | * Unless required by applicable law or agreed to in writing, | |
15 | * software distributed under the License is distributed on an | |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
17 | * KIND, either express or implied. See the License for the | |
18 | * specific language governing permissions and limitations | |
19 | * under the License. | |
20 | */ | |
21 | ||
22 | import org.apache.maven.plugin.MojoExecutionException; | |
23 | import org.apache.maven.scm.ScmException; | |
24 | import org.apache.maven.scm.command.checkin.CheckInScmResult; | |
25 | import org.apache.maven.scm.repository.ScmRepository; | |
26 | ||
27 | import java.io.IOException; | |
28 | ||
29 | /** | |
30 | * Commit changes to the configured scm url. | |
31 | * | |
32 | * @author <a href="evenisse@apache.org">Emmanuel Venisse</a> | |
33 | * @version $Id: CheckinMojo.java 685670 2008-08-13 20:25:56Z vsiveton $ | |
34 | * @goal checkin | |
35 | * @aggregator | |
36 | */ | |
37 | 0 | public class CheckinMojo |
38 | extends AbstractScmMojo | |
39 | { | |
40 | /** | |
41 | * Commit log. | |
42 | * | |
43 | * @parameter expression="${message}" | |
44 | */ | |
45 | private String message; | |
46 | ||
47 | /** | |
48 | * The configured scm url to use. | |
49 | * | |
50 | * @parameter expression="${connectionType}" default-value="developerConnection" | |
51 | */ | |
52 | private String connectionType; | |
53 | ||
54 | /** | |
55 | * The version type (branch/tag/revision) of scmVersion. | |
56 | * | |
57 | * @parameter expression="${scmVersionType}" | |
58 | */ | |
59 | private String scmVersionType; | |
60 | ||
61 | /** | |
62 | * The version (revision number/branch name/tag name). | |
63 | * | |
64 | * @parameter expression="${scmVersion}" | |
65 | */ | |
66 | private String scmVersion; | |
67 | ||
68 | /** {@inheritDoc} */ | |
69 | public void execute() | |
70 | throws MojoExecutionException | |
71 | { | |
72 | 0 | super.execute(); |
73 | ||
74 | 0 | setConnectionType( connectionType ); |
75 | ||
76 | try | |
77 | { | |
78 | 0 | ScmRepository repository = getScmRepository(); |
79 | ||
80 | 0 | CheckInScmResult result = getScmManager().checkIn( repository, getFileSet(), |
81 | getScmVersion( scmVersionType, scmVersion ), message ); | |
82 | ||
83 | 0 | checkResult( result ); |
84 | } | |
85 | 0 | catch ( IOException e ) |
86 | { | |
87 | 0 | throw new MojoExecutionException( "Cannot run checkin command : ", e ); |
88 | } | |
89 | 0 | catch ( ScmException e ) |
90 | { | |
91 | 0 | throw new MojoExecutionException( "Cannot run checkin command : ", e ); |
92 | 0 | } |
93 | 0 | } |
94 | } |