Skip to content

Commit

Permalink
Replace old @component with @Inject
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Mar 12, 2023
1 parent b54efd4 commit 6af220b
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
import org.apache.maven.shared.release.util.ReleaseUtil;
import org.apache.maven.shared.release.versions.VersionParseException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.components.interactivity.Prompter;
import org.codehaus.plexus.components.interactivity.PrompterException;
import org.codehaus.plexus.util.StringUtils;
Expand Down Expand Up @@ -75,15 +73,13 @@
* @author <a href="mailto:[email protected]">Brett Porter</a>
* @author Robert Scholte
*/
@Component( role = ReleasePhase.class, hint = "map-release-versions" )
public abstract class AbstractMapVersionsPhase
extends AbstractReleasePhase
{
/**
* Tool that gets a configured SCM repository from release configuration.
*/
@Requirement
private ScmRepositoryConfigurator scmRepositoryConfigurator;
private final ScmRepositoryConfigurator scmRepositoryConfigurator;

/**
* Component used to prompt for input.
Expand All @@ -105,9 +101,11 @@ public abstract class AbstractMapVersionsPhase
*/
private final boolean convertToBranch;

public AbstractMapVersionsPhase( Prompter prompter, Map<String, VersionPolicy> versionPolicies,
public AbstractMapVersionsPhase( ScmRepositoryConfigurator scmRepositoryConfigurator,
Prompter prompter, Map<String, VersionPolicy> versionPolicies,
boolean convertToSnapshot, boolean convertToBranch )
{
this.scmRepositoryConfigurator = requireNonNull( scmRepositoryConfigurator );
this.prompter = requireNonNull( prompter );
this.versionPolicies = requireNonNull( versionPolicies );
this.convertToSnapshot = convertToSnapshot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;

import org.apache.maven.shared.release.policy.version.VersionPolicy;
import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
import org.codehaus.plexus.components.interactivity.Prompter;

/**
Expand Down Expand Up @@ -61,8 +62,9 @@ public class MapBranchVersionsPhase
extends AbstractMapVersionsPhase
{
@Inject
public MapBranchVersionsPhase( Prompter prompter, Map<String, VersionPolicy> versionPolicies )
public MapBranchVersionsPhase( ScmRepositoryConfigurator scmRepositoryConfigurator,
Prompter prompter, Map<String, VersionPolicy> versionPolicies )
{
super( prompter, versionPolicies, true, true );
super( scmRepositoryConfigurator, prompter, versionPolicies, true, true );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;

import org.apache.maven.shared.release.policy.version.VersionPolicy;
import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
import org.codehaus.plexus.components.interactivity.Prompter;

/**
Expand Down Expand Up @@ -61,8 +62,9 @@ public class MapDevelopmentVersionsPhase
extends AbstractMapVersionsPhase
{
@Inject
public MapDevelopmentVersionsPhase( Prompter prompter, Map<String, VersionPolicy> versionPolicies )
public MapDevelopmentVersionsPhase( ScmRepositoryConfigurator scmRepositoryConfigurator,
Prompter prompter, Map<String, VersionPolicy> versionPolicies )
{
super( prompter, versionPolicies, true, false );
super( scmRepositoryConfigurator, prompter, versionPolicies, true, false );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;

import org.apache.maven.shared.release.policy.version.VersionPolicy;
import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator;
import org.codehaus.plexus.components.interactivity.Prompter;

/**
Expand Down Expand Up @@ -61,8 +62,9 @@ public class MapReleaseVersionsPhase
extends AbstractMapVersionsPhase
{
@Inject
public MapReleaseVersionsPhase( Prompter prompter, Map<String, VersionPolicy> versionPolicies )
public MapReleaseVersionsPhase( ScmRepositoryConfigurator scmRepositoryConfigurator,
Prompter prompter, Map<String, VersionPolicy> versionPolicies )
{
super( prompter, versionPolicies, false, false );
super( scmRepositoryConfigurator, prompter, versionPolicies, false, false );
}
}
Loading

0 comments on commit 6af220b

Please sign in to comment.