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 all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ -147,12 +141,6 @@ public class SignAndDeployFileMojo extends AbstractGpgMojo {
@Parameter(property = "repositoryId", defaultValue = "remote-repository", required = true)
private String repositoryId;

/**
* The type of remote repository layout to deploy to. Try <i>legacy</i> for a Maven 1.x-style repository layout.
*/
@Parameter(property = "repositoryLayout", defaultValue = "default")
private String repositoryLayout;

/**
* The bundled API docs for the artifact.
*
Expand Down Expand Up @@ -241,7 +229,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 +241,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 +355,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