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

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


The following commit(s) were added to refs/heads/master by this push:
     new 11e1f14  SLING-9994 Allow configuring extra jvm options
11e1f14 is described below

commit 11e1f14c0a4dc5a2e29e7b12d30a4152812ceb08
Author: Eric Norman <[email protected]>
AuthorDate: Thu Dec 10 17:28:42 2020 -0800

    SLING-9994 Allow configuring extra jvm options
---
 README.md                                                     |  7 +++++++
 src/it/simple-it/pom.xml                                      |  7 +++++++
 .../sling/maven/feature/launcher/LauncherArguments.java       | 11 ++++++++++-
 .../org/apache/sling/maven/feature/launcher/StartMojo.java    |  9 +++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 8aabd0c..577f8ac 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,13 @@ Configure the plugin as follows:
                     <type>slingosgifeature</type>
                 </feature>
                 <launcherArguments>
+                    <!-- optionally uncomment to pass any required extra vm 
options -->
+                    <!--
+                    <vmOptions>
+                        <value>-Xmx512m</value>
+                        
<value>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5000</value>
+                    </vmOptions>
+                    -->
                     <frameworkProperties>
                         
<org.osgi.service.http.port>8080</org.osgi.service.http.port>
                     </frameworkProperties>
diff --git a/src/it/simple-it/pom.xml b/src/it/simple-it/pom.xml
index 7dad8f7..44990a0 100644
--- a/src/it/simple-it/pom.xml
+++ b/src/it/simple-it/pom.xml
@@ -112,6 +112,13 @@
                                 <type>slingosgifeature</type>
                             </feature>
                             <launcherArguments>
+                                           <!-- optionally uncomment to pass 
any required extra vm options -->
+                                           <!--
+                                           <vmOptions>
+                                               <value>-Xmx512m</value>
+                                               
<value>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5000</value>
+                                           </vmOptions>
+                                           -->                 
                                 <frameworkProperties>
                                     
<org.osgi.service.http.port>${http.port}</org.osgi.service.http.port>
                                 </frameworkProperties>
diff --git 
a/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java 
b/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java
index c96958f..c617849 100644
--- 
a/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java
+++ 
b/src/main/java/org/apache/sling/maven/feature/launcher/LauncherArguments.java
@@ -23,9 +23,18 @@ import java.util.Map;
 
 public class LauncherArguments {
 
+       private String[] vmOptions = null;
     private Map<String, String> frameworkProperties = new HashMap<>();
     
-    public Map<String, String> getFrameworkProperties() {
+       public String[] getVmOptions() {
+               return vmOptions;
+       }
+
+       public void setVmOptions(String[] vmOptions) {
+               this.vmOptions = vmOptions;
+       }
+
+       public Map<String, String> getFrameworkProperties() {
         return frameworkProperties;
     }
     
diff --git 
a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java 
b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
index b39c7ab..afa4d64 100644
--- a/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/feature/launcher/StartMojo.java
@@ -123,6 +123,15 @@ public class StartMojo extends AbstractMojo {
                        javahome = System.getProperty("java.home");
                 }
                                args.add(javahome + File.separatorChar + "bin" 
+ File.separatorChar + "java");
+                               // SLING-9994 - if any extra vm options were 
supplied, apply them here
+                               String[] vmOptions = 
launch.getLauncherArguments().getVmOptions();
+                               if (vmOptions != null) {
+                                       for (String vmOption : vmOptions) {
+                                               if (vmOption != null && 
!vmOption.isEmpty()) {
+                                                       args.add(vmOption);
+                                               }
+                                       }
+                               }
                 args.add("-jar");
                 args.add(launcher.getAbsolutePath());
                 args.add("-f");

Reply via email to