Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MGPG-113] SignAndDeployFileMojo results in 401 #82

Merged
merged 2 commits into from Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -258,8 +258,6 @@ public abstract class AbstractGpgMojo extends AbstractMojo {
@Component
protected MavenSession session;

// === Deprecated stuff

/**
* Switch to improve plugin enforcement of "best practices". If set to {@code false}, plugin retains all the
* backward compatibility regarding getting secrets (but will warn). If set to {@code true}, plugin will fail
Expand All @@ -280,7 +278,7 @@ public abstract class AbstractGpgMojo extends AbstractMojo {
* @since 1.6
*/
@Parameter(defaultValue = "${settings}", readonly = true, required = true)
private Settings settings;
protected Settings settings;

/**
* Maven Security Dispatcher.
Expand Down
Expand Up @@ -72,12 +72,6 @@ public class SignAndDeployFileMojo extends AbstractGpgMojo {
@Parameter(property = "gpg.ascDirectory")
private File ascDirectory;

/**
* Flag whether Maven is currently in online/offline mode.
*/
@Parameter(defaultValue = "${settings.offline}", readonly = true)
private boolean offline;

/**
* GroupId of the artifact to be deployed. Retrieved from POM file if specified.
*/
Expand Down Expand Up @@ -149,7 +143,10 @@ public class SignAndDeployFileMojo extends AbstractGpgMojo {

/**
* The type of remote repository layout to deploy to. Try <i>legacy</i> for a Maven 1.x-style repository layout.
*
* @deprecated Maven3 does not support "legacy" (Maven1) layout anymore. This parameter is unused.
*/
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to remove such parameters.

With deprecated - we will have warning about it - the similar will be than we remove it and someone will use it - warning will be emitted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@Parameter(property = "repositoryLayout", defaultValue = "default")
private String repositoryLayout;

Expand Down Expand Up @@ -241,7 +238,7 @@ private void initProperties() throws MojoExecutionException {

@Override
protected void doExecute() throws MojoExecutionException, MojoFailureException {
if (offline) {
if (settings.isOffline()) {
throw new MojoFailureException("Cannot deploy artifacts when Maven is in offline mode");
}

Expand All @@ -253,8 +250,6 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
throw new MojoFailureException(file.getPath() + " not found.");
}

RemoteRepository deploymentRepository = new RemoteRepository.Builder(repositoryId, "default", url).build();

// create artifacts
List<Artifact> artifacts = new ArrayList<>();

Expand Down Expand Up @@ -369,6 +364,8 @@ protected void doExecute() throws MojoExecutionException, MojoFailureException {
artifacts.addAll(signatures);

// deploy all
RemoteRepository deploymentRepository = repositorySystem.newDeploymentRepository(
session.getRepositorySession(), new RemoteRepository.Builder(repositoryId, "default", url).build());
try {
deploy(deploymentRepository, artifacts);
} catch (DeploymentException e) {
Expand Down