diff --git a/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java b/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java index 9e159d0..c87ecf0 100644 --- a/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java +++ b/src/main/java/org/apache/maven/plugins/gpg/AbstractGpgMojo.java @@ -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 @@ -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. diff --git a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java index 2d2c699..a276e13 100644 --- a/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java +++ b/src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java @@ -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. */ @@ -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 legacy for a Maven 1.x-style repository layout. - */ - @Parameter(property = "repositoryLayout", defaultValue = "default") - private String repositoryLayout; - /** * The bundled API docs for the artifact. * @@ -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"); } @@ -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 artifacts = new ArrayList<>(); @@ -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) {