File tree Expand file tree Collapse file tree 23 files changed +201
-9
lines changed
main/java/org/apache/maven/scm/plugin
test/java/org/apache/maven/scm/plugin Expand file tree Collapse file tree 23 files changed +201
-9
lines changed Original file line number Diff line number Diff line change 129129 <artifactId >maven-plugin-annotations</artifactId >
130130 <scope >provided</scope >
131131 </dependency >
132+ <dependency >
133+ <groupId >javax.inject</groupId >
134+ <artifactId >javax.inject</artifactId >
135+ <version >1</version >
136+ <scope >provided</scope >
137+ </dependency >
132138
133139 <!-- Test -->
134140 <dependency >
Original file line number Diff line number Diff line change 3131import org .apache .commons .lang3 .StringUtils ;
3232import org .apache .maven .plugin .AbstractMojo ;
3333import org .apache .maven .plugin .MojoExecutionException ;
34- import org .apache .maven .plugins .annotations .Component ;
3534import org .apache .maven .plugins .annotations .Parameter ;
3635import org .apache .maven .scm .ScmBranch ;
3736import org .apache .maven .scm .ScmException ;
@@ -138,12 +137,6 @@ public abstract class AbstractScmMojo extends AbstractMojo {
138137 @ Parameter (property = "excludes" )
139138 private String excludes ;
140139
141- @ Component
142- private ScmManager manager ;
143-
144- @ Component
145- private SettingsDecrypter settingsDecrypter ;
146-
147140 /**
148141 * The base directory.
149142 */
@@ -186,6 +179,15 @@ public abstract class AbstractScmMojo extends AbstractMojo {
186179 @ Deprecated
187180 private String workItem ;
188181
182+ private final ScmManager manager ;
183+
184+ private final SettingsDecrypter settingsDecrypter ;
185+
186+ protected AbstractScmMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
187+ this .manager = manager ;
188+ this .settingsDecrypter = settingsDecrypter ;
189+ }
190+
189191 /** {@inheritDoc} */
190192 public void execute () throws MojoExecutionException {
191193 if (systemProperties != null ) {
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .IOException ;
2224
2325import org .apache .maven .plugin .MojoExecutionException ;
2426import org .apache .maven .plugins .annotations .Mojo ;
2527import org .apache .maven .scm .ScmException ;
2628import org .apache .maven .scm .command .add .AddScmResult ;
29+ import org .apache .maven .scm .manager .ScmManager ;
2730import org .apache .maven .scm .repository .ScmRepository ;
31+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
2832
2933/**
3034 * Add a file set to the project.
3337 */
3438@ Mojo (name = "add" , aggregator = true )
3539public class AddMojo extends AbstractScmMojo {
40+
41+ @ Inject
42+ public AddMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
43+ super (manager , settingsDecrypter );
44+ }
45+
3646 /** {@inheritDoc} */
3747 public void execute () throws MojoExecutionException {
3848 super .execute ();
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .File ;
2224
2325import org .apache .commons .lang3 .StringUtils ;
2628import org .apache .maven .plugins .annotations .Parameter ;
2729import org .apache .maven .scm .ScmResult ;
2830import org .apache .maven .scm .command .checkout .CheckOutScmResult ;
31+ import org .apache .maven .scm .manager .ScmManager ;
32+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
2933import org .codehaus .plexus .util .Os ;
3034import org .codehaus .plexus .util .cli .CommandLineException ;
3135import org .codehaus .plexus .util .cli .CommandLineUtils ;
4044 */
4145@ Mojo (name = "bootstrap" , requiresProject = false )
4246public class BootstrapMojo extends CheckoutMojo {
47+
4348 /**
4449 * The goals to run on the clean checkout of a project for the bootstrap goal.
4550 * If none are specified, then the default goal for the project is executed.
@@ -69,6 +74,11 @@ public class BootstrapMojo extends CheckoutMojo {
6974 @ Parameter (property = "mavenHome" , defaultValue = "${maven.home}" )
7075 private File mavenHome ;
7176
77+ @ Inject
78+ public BootstrapMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
79+ super (manager , settingsDecrypter );
80+ }
81+
7282 /** {@inheritDoc} */
7383 public void execute () throws MojoExecutionException {
7484 super .execute ();
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .IOException ;
2224
2325import org .apache .maven .plugin .MojoExecutionException ;
2628import org .apache .maven .scm .ScmBranchParameters ;
2729import org .apache .maven .scm .ScmException ;
2830import org .apache .maven .scm .command .branch .BranchScmResult ;
31+ import org .apache .maven .scm .manager .ScmManager ;
2932import org .apache .maven .scm .provider .ScmProvider ;
3033import org .apache .maven .scm .repository .ScmRepository ;
34+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
3135
3236/**
3337 * Branch the project.
@@ -68,6 +72,11 @@ public class BranchMojo extends AbstractScmMojo {
6872 @ Parameter (property = "pinExternals" , defaultValue = "false" )
6973 private boolean pinExternals ;
7074
75+ @ Inject
76+ public BranchMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
77+ super (manager , settingsDecrypter );
78+ }
79+
7180 /** {@inheritDoc} */
7281 public void execute () throws MojoExecutionException {
7382 super .execute ();
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .IOException ;
2224import java .text .ParseException ;
2325import java .text .SimpleDateFormat ;
3335import org .apache .maven .scm .command .changelog .ChangeLogScmRequest ;
3436import org .apache .maven .scm .command .changelog .ChangeLogScmResult ;
3537import org .apache .maven .scm .command .changelog .ChangeLogSet ;
38+ import org .apache .maven .scm .manager .ScmManager ;
3639import org .apache .maven .scm .provider .ScmProvider ;
3740import org .apache .maven .scm .repository .ScmRepository ;
41+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
3842
3943/**
4044 * Dump changelog contents to console. It is mainly used to test maven-scm-api's changelog command.
@@ -125,6 +129,11 @@ public class ChangeLogMojo extends AbstractScmMojo {
125129 @ Parameter (property = "numDays" )
126130 private Integer numDays ;
127131
132+ @ Inject
133+ public ChangeLogMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
134+ super (manager , settingsDecrypter );
135+ }
136+
128137 /**
129138 * {@inheritDoc}
130139 */
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .IOException ;
2224
2325import org .apache .maven .plugin .MojoExecutionException ;
2426import org .apache .maven .plugins .annotations .Mojo ;
2527import org .apache .maven .plugins .annotations .Parameter ;
2628import org .apache .maven .scm .ScmException ;
2729import org .apache .maven .scm .command .status .StatusScmResult ;
30+ import org .apache .maven .scm .manager .ScmManager ;
2831import org .apache .maven .scm .repository .ScmRepository ;
32+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
2933
3034/**
3135 * This mojo will fail the build if there is any local modifications
@@ -50,6 +54,11 @@ public class CheckLocalModificationsMojo extends AbstractScmMojo {
5054 @ Parameter (property = "scm.checkLocalModification.skip" , defaultValue = "false" )
5155 private boolean skip ;
5256
57+ @ Inject
58+ public CheckLocalModificationsMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
59+ super (manager , settingsDecrypter );
60+ }
61+
5362 public void execute () throws MojoExecutionException {
5463 if (skip ) {
5564 getLog ().info ("check-local-modification execution has been skipped" );
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .IOException ;
2224
2325import org .apache .maven .plugin .MojoExecutionException ;
2426import org .apache .maven .plugins .annotations .Mojo ;
2527import org .apache .maven .plugins .annotations .Parameter ;
2628import org .apache .maven .scm .ScmException ;
2729import org .apache .maven .scm .command .checkin .CheckInScmResult ;
30+ import org .apache .maven .scm .manager .ScmManager ;
2831import org .apache .maven .scm .repository .ScmRepository ;
32+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
2933
3034/**
3135 * Commit changes to the configured scm url.
@@ -58,6 +62,11 @@ public class CheckinMojo extends AbstractScmMojo {
5862 @ Parameter (property = "scmVersion" )
5963 private String scmVersion ;
6064
65+ @ Inject
66+ public CheckinMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
67+ super (manager , settingsDecrypter );
68+ }
69+
6170 /** {@inheritDoc} */
6271 public void execute () throws MojoExecutionException {
6372 super .execute ();
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .File ;
2224import java .io .IOException ;
2325
2729import org .apache .maven .scm .ScmException ;
2830import org .apache .maven .scm .ScmFileSet ;
2931import org .apache .maven .scm .ScmResult ;
32+ import org .apache .maven .scm .manager .ScmManager ;
3033import org .apache .maven .scm .repository .ScmRepository ;
34+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
3135import org .codehaus .plexus .util .FileUtils ;
3236
3337/**
@@ -72,6 +76,11 @@ public class CheckoutMojo extends AbstractScmMojo {
7276 */
7377 private ScmResult checkoutResult ;
7478
79+ @ Inject
80+ public CheckoutMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
81+ super (manager , settingsDecrypter );
82+ }
83+
7584 /** {@inheritDoc} */
7685 public void execute () throws MojoExecutionException {
7786 super .execute ();
Original file line number Diff line number Diff line change 1818 */
1919package org .apache .maven .scm .plugin ;
2020
21+ import javax .inject .Inject ;
22+
2123import java .io .File ;
2224import java .io .IOException ;
2325
2628import org .apache .maven .plugins .annotations .Parameter ;
2729import org .apache .maven .scm .ScmException ;
2830import org .apache .maven .scm .command .diff .DiffScmResult ;
31+ import org .apache .maven .scm .manager .ScmManager ;
2932import org .apache .maven .scm .repository .ScmRepository ;
33+ import org .apache .maven .settings .crypto .SettingsDecrypter ;
3034import org .codehaus .plexus .util .FileUtils ;
3135
3236/**
@@ -66,6 +70,11 @@ public class DiffMojo extends AbstractScmMojo {
6670 @ Parameter (property = "outputFile" , defaultValue = "${project.artifactId}.diff" )
6771 private File outputFile ;
6872
73+ @ Inject
74+ public DiffMojo (ScmManager manager , SettingsDecrypter settingsDecrypter ) {
75+ super (manager , settingsDecrypter );
76+ }
77+
6978 /** {@inheritDoc} */
7079 public void execute () throws MojoExecutionException {
7180 super .execute ();
You can’t perform that action at this time.
0 commit comments