You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2022/08/15 06:28:04 UTC

[sling-maven-plugin] branch master updated: releng: javadoc fixes

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 97a65d1  releng: javadoc fixes
97a65d1 is described below

commit 97a65d19be984ce236900c70dc65cf4477f38560
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Aug 15 08:28:00 2022 +0200

    releng: javadoc fixes
    
    no longer mark parameters with default values as required
---
 .../maven/bundlesupport/AbstractBundleDeployMojo.java  |  4 ++++
 .../maven/bundlesupport/AbstractBundleInstallMojo.java | 13 +++++++------
 .../maven/bundlesupport/AbstractBundleRequestMojo.java |  6 +++---
 .../sling/maven/bundlesupport/AbstractFsMountMojo.java |  6 +++---
 .../sling/maven/bundlesupport/BundleInstallMojo.java   |  2 +-
 .../apache/sling/maven/bundlesupport/FsMountMojo.java  |  4 ++--
 .../sling/maven/bundlesupport/FsUnMountMojo.java       |  4 ++--
 .../bundlesupport/GenerateAdapterMetadataMojo.java     |  8 ++++----
 .../sling/maven/bundlesupport/ValidationMojo.java      |  6 +++---
 .../fsresource/SlingInitialContentMounter.java         | 18 +++---------------
 10 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
index 5e0960c..2102845 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
@@ -39,6 +39,10 @@ import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.osgi.framework.Constants;
 
+/**
+ * Common super class of all OBR related goal classes.
+ * @deprecated Use the OBR goals from the <a href="https://felix.apache.org/documentation/_attachments/components/bundle-plugin/index.html">maven-bundle-plugin</a> instead.
+ */
 @Deprecated
 abstract class AbstractBundleDeployMojo extends AbstractBundleRequestMojo {
 
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
index 385bd67..0fb788b 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
@@ -39,6 +39,7 @@ abstract class AbstractBundleInstallMojo extends AbstractBundleRequestMojo {
      * 
      * @deprecated Use {@link #deploymentMethod} instead.
      */
+    @Deprecated
     @Parameter(property="sling.usePut", defaultValue = "false")
     protected boolean usePut;
 
@@ -59,13 +60,13 @@ abstract class AbstractBundleInstallMojo extends AbstractBundleRequestMojo {
      * This has precedence over the deprecated parameter {@link #usePut}.
      * If nothing is set the default is either {@code WebConsole} or {@code WebDAV} (when {@link #usePut} is {@code true}).
      */
-    @Parameter(property="sling.deploy.method", required = false)
+    @Parameter(property="sling.deploy.method")
     protected BundleDeploymentMethod deploymentMethod;
 
     /**
      * The content type / mime type used for WebDAV or Sling POST deployment.
      */
-    @Parameter(property="sling.mimeType", defaultValue = "application/java-archive", required = true)
+    @Parameter(property="sling.mimeType", defaultValue = "application/java-archive")
     protected String mimeType;
 
     /**
@@ -73,21 +74,21 @@ abstract class AbstractBundleInstallMojo extends AbstractBundleRequestMojo {
      * updated this parameter is ignored. The parameter is also ignored if the running Sling instance has no 
      * StartLevel service (which is unusual actually). Only applies when POSTing to Felix Web Console.
      */
-    @Parameter(property="sling.bundle.startlevel", defaultValue = "20", required = true)
+    @Parameter(property="sling.bundle.startlevel", defaultValue = "20")
     private String bundleStartLevel;
 
     /**
      * Whether to start the uploaded bundle or not. Only applies when POSTing
      * to Felix Web Console
      */
-    @Parameter(property="sling.bundle.start", defaultValue = "true", required = true)
+    @Parameter(property="sling.bundle.start", defaultValue = "true")
     private boolean bundleStart;
 
     /**
      * Whether to refresh the packages after installing the uploaded bundle.
      * Only applies when POSTing to Felix Web Console
      */
-    @Parameter(property="sling.refreshPackages", defaultValue = "true", required = true)
+    @Parameter(property="sling.refreshPackages", defaultValue = "true")
     private boolean refreshPackages;
 
     /**
@@ -96,7 +97,7 @@ abstract class AbstractBundleInstallMojo extends AbstractBundleRequestMojo {
      * for the <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading">bundle's initial content</a>.
      * This parameter must not be {@code true} with bundles resolved from the Maven repository.
      */
-    @Parameter(property="sling.mountByFS", defaultValue = "false", required = true)
+    @Parameter(property="sling.mountByFS", defaultValue = "false")
     boolean mountByFS;
 
     /**
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleRequestMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleRequestMojo.java
index b54d2c9..e0f28e9 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleRequestMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleRequestMojo.java
@@ -87,20 +87,20 @@ abstract class AbstractBundleRequestMojo extends AbstractMojo {
     /**
      * The user name to authenticate at the running Sling instance.
      */
-    @Parameter(property="sling.user", defaultValue = "admin", required = true)
+    @Parameter(property="sling.user", defaultValue = "admin")
     private String user;
 
     /**
      * The password to authenticate at the running Sling instance.
      */
-    @Parameter(property="sling.password", defaultValue = "admin", required = true)
+    @Parameter(property="sling.password", defaultValue = "admin")
     private String password;
     
     /**
      * Determines whether or not to fail the build if
      * the HTTP POST or PUT returns an non-OK response code.
      */
-    @Parameter(property = "sling.failOnError", defaultValue = "true", required = true)
+    @Parameter(property = "sling.failOnError", defaultValue = "true")
     protected boolean failOnError;
 
     /**
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
index 133615b..e3abdd7 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
@@ -44,7 +44,7 @@ abstract class AbstractFsMountMojo extends AbstractBundleRequestMojo {
     /**
      * The path of the bundle file whose Sling Initial Content should be mounted.
      */
-    @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar", required = true)
+    @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar")
     private String bundleFileName;
 
     /**
@@ -63,13 +63,13 @@ abstract class AbstractFsMountMojo extends AbstractBundleRequestMojo {
     /**
      * If set to <code>true</code> Sling File System Resource mount/unmount commands are ignored.
      */
-    @Parameter(property = "sling.fsmount.skip", defaultValue = "false", required = true)
+    @Parameter(property = "sling.fsmount.skip", defaultValue = "false")
     private boolean skip;
     
     /**
      * The Maven project.
      */
-    @Parameter(defaultValue = "${project}", required = true, readonly = true)
+    @Parameter(defaultValue = "${project}", readonly = true)
     protected MavenProject project;
 
     @Override
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java
index 2a27d41..256879e 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java
@@ -38,7 +38,7 @@ public class BundleInstallMojo extends AbstractBundleInstallMojo {
      * Whether to skip this step even though it has been configured in the
      * project to be executed.
      */
-    @Parameter(property = "sling.install.skip", defaultValue = "false", required = true)
+    @Parameter(property = "sling.install.skip", defaultValue = "false")
     private boolean skip;
 
     @Override
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
index 434c5ca..2753387 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
@@ -48,8 +48,8 @@ import org.eclipse.aether.artifact.DefaultArtifact;
 /**
  * Create OSGi configurations for the
  * <a href="https://sling.apache.org/documentation/bundles/accessing-filesystem-resources-extensions-fsresource.html">Apache Sling File System Resource Provider</a>.
- * In case a bundle file is provided via {@link AbstractFsMountMojo#bundleFileName} the configuration for its <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading">initial content</a> is created.
- * Otherwise it tries to detect a FileVault XML layout within {@link AbstractFsMountMojo#fileVaultJcrRootFile} or the project's base directory and potentially creates a configuration for each path in the package's {@code filter.xml}. 
+ * In case a bundle file is supplied via {@link AbstractFsMountMojo#bundleFileName} the configuration for its <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading">initial content</a> is created.
+ * Otherwise it tries to detect a FileVault content package layout starting at {@link AbstractFsMountMojo#fileVaultJcrRootFile} or the project's resource directories and potentially creates a configuration for each path in the package's {@code filter.xml}. 
  * @since 2.2.0
  */
 @Mojo(name = "fsmount", requiresProject = true)
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java
index 2d5aae5..215ed2d 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java
@@ -29,8 +29,8 @@ import org.apache.sling.maven.bundlesupport.fsresource.SlingInitialContentMounte
 /**
  * Remove OSGi configurations for the 
  * <a href="https://sling.apache.org/documentation/bundles/accessing-filesystem-resources-extensions-fsresource.html">Apache Sling File System Resource Provider</a>.
- * In case a bundle file is provided via {@link AbstractFsMountMojo#bundleFileName} the configuration for its <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading">initial content</a> is removed.
- * Otherwise it tries to detect a FileVault XML layout within {@link AbstractFsMountMojo#fileVaultJcrRootFile} or the project's base directory and potentially removes the configurations for each path in the package's {@code filter.xml}. 
+ * In case a bundle file is supplied via {@link AbstractFsMountMojo#bundleFileName} the configuration for its <a href="https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading">initial content</a> is created.
+ * Otherwise it tries to detect a FileVault content package layout starting at {@link AbstractFsMountMojo#fileVaultJcrRootFile} or the project's resource directories and potentially creates a configuration for each path in the package's {@code filter.xml}. 
  * @since 2.2.0
  */
 @Mojo(name = "fsunmount", requiresProject = true)
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
index c02c26a..eecfabc 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
@@ -61,19 +61,19 @@ public class GenerateAdapterMetadataMojo extends AbstractMojo {
 
 
     /** The directory which to check for classes with adapter metadata annotations. */
-    @Parameter(defaultValue = "${project.build.outputDirectory}")
+    @Parameter(property = "adapter.build.output.directory", defaultValue = "${project.build.outputDirectory}")
     File buildOutputDirectory;
 
     /**
-     * Name of the generated descriptor file.
+     * Name of the generated descriptor file (relative to {@link #outputDirectory}).
      */
     @Parameter(property = "adapter.descriptor.name", defaultValue = "SLING-INF/adapters.json")
     String fileName;
 
     /**
-     * The output directory in which to emit the descriptor file with name {@link GenerateAdapterMetadataMojo#fileName}.
+     * The output directory in which to emit the descriptor file with name {@link #fileName}.
      */
-    @Parameter(defaultValue = "${project.build.outputDirectory}", required = true)
+    @Parameter(property = "adapter.output.directory", defaultValue = "${project.build.outputDirectory}")
     File outputDirectory;
 
     /**
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java b/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
index f3edfe1..e1845bf 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
@@ -64,20 +64,20 @@ public class ValidationMojo extends AbstractMojo {
     /**
      * Whether to skip the validation. 
      */
-    @Parameter(property = "sling.validation.skip", defaultValue = "false", required = true)
+    @Parameter(property = "sling.validation.skip", defaultValue = "false")
     private boolean skip;
 
     /**
      * Whether to skip the json validation.
      * At the time, there's no difference between <code>skip</code> and <code>skipJson</code> because only JSON files will be validated by now.
      */
-    @Parameter(property = "sling.validation.skipJson", defaultValue = "false", required = true)
+    @Parameter(property = "sling.validation.skipJson", defaultValue = "false")
     private boolean skipJson;
 
     /**
      * Whether to accept quote ticks in JSON files or not. 
      */
-    @Parameter(property = "sling.validation.jsonQuoteTick", defaultValue = "false", required = false)
+    @Parameter(property = "sling.validation.jsonQuoteTick", defaultValue = "false")
     private boolean jsonQuoteTick;
 
     @Component
diff --git a/src/main/java/org/apache/sling/maven/bundlesupport/fsresource/SlingInitialContentMounter.java b/src/main/java/org/apache/sling/maven/bundlesupport/fsresource/SlingInitialContentMounter.java
index a8f6a7f..0312a4e 100644
--- a/src/main/java/org/apache/sling/maven/bundlesupport/fsresource/SlingInitialContentMounter.java
+++ b/src/main/java/org/apache/sling/maven/bundlesupport/fsresource/SlingInitialContentMounter.java
@@ -84,7 +84,7 @@ public final class SlingInitialContentMounter {
         log.info("Trying to configure file system provider for Sling initial content...");
         // quick check if resources are configured
         final List<Resource> resources = project.getResources();
-        if ( resources == null || resources.size() == 0 ) {
+        if (resources == null || resources.isEmpty()) {
             throw new MojoExecutionException("No resources configured for this project.");
         }
 
@@ -110,7 +110,7 @@ public final class SlingInitialContentMounter {
             File dir = null;
             final Iterator<Resource> i = resources.iterator();
             while ( dir == null && i.hasNext() ) {
-                final Resource rsrc = (Resource)i.next();
+                final Resource rsrc = i.next();
                 String child = path;
                 // if resource mapping defines a target path: remove target path from checked resource path
                 String targetPath = rsrc.getTargetPath();
@@ -180,21 +180,9 @@ public final class SlingInitialContentMounter {
      * @throws IOException Exception
      */
     private Manifest getManifest(final File bundleFile) throws IOException {
-        JarFile file = null;
-        try {
-            file = new JarFile(bundleFile);
+        try (JarFile file = new JarFile(bundleFile)){
             return file.getManifest();
         }
-        finally {
-            if (file != null) {
-                try {
-                    file.close();
-                }
-                catch (IOException ex) {
-                    // ignore
-                }
-            }
-        }
     }
 
 }