|
26 | 26 | import org.apache.maven.plugin.MojoExecutionException; |
27 | 27 | import org.apache.maven.plugins.annotations.Mojo; |
28 | 28 | import org.apache.maven.plugins.annotations.Parameter; |
| 29 | +import org.apache.maven.scm.CommandParameter; |
| 30 | +import org.apache.maven.scm.CommandParameters; |
29 | 31 | import org.apache.maven.scm.ScmException; |
30 | 32 | import org.apache.maven.scm.ScmFileSet; |
31 | 33 | import org.apache.maven.scm.ScmResult; |
@@ -71,6 +73,14 @@ public class CheckoutMojo extends AbstractScmMojo { |
71 | 73 | @Parameter(property = "scmVersion") |
72 | 74 | private String scmVersion; |
73 | 75 |
|
| 76 | + /** |
| 77 | + * Currently only implemented with Git Executable. Perform a shallow checkout. |
| 78 | + * |
| 79 | + * @since 2.1.1 |
| 80 | + */ |
| 81 | + @Parameter(property = "shallow", defaultValue = "false") |
| 82 | + private boolean shallow = false; |
| 83 | + |
74 | 84 | /** |
75 | 85 | * allow extended mojo (ie BootStrap ) to see checkout result |
76 | 86 | */ |
@@ -116,7 +126,12 @@ protected ScmResult checkout() throws MojoExecutionException { |
116 | 126 | if (useExport) { |
117 | 127 | result = getScmManager().export(repository, fileSet, getScmVersion(scmVersionType, scmVersion)); |
118 | 128 | } else { |
119 | | - result = getScmManager().checkOut(repository, fileSet, getScmVersion(scmVersionType, scmVersion)); |
| 129 | + CommandParameters parameters = new CommandParameters(); |
| 130 | + parameters.setString(CommandParameter.RECURSIVE, Boolean.toString(true)); |
| 131 | + parameters.setString(CommandParameter.SHALLOW, Boolean.toString(shallow)); |
| 132 | + result = getScmManager() |
| 133 | + .getProviderByRepository(repository) |
| 134 | + .checkOut(repository, fileSet, getScmVersion(scmVersionType, scmVersion), parameters); |
120 | 135 | } |
121 | 136 |
|
122 | 137 | checkResult(result); |
|
0 commit comments