瀏覽代碼

LWJGL as TemplateLibrary too, added generics and some cleanups

Toni Helenius 2 年之前
父節點
當前提交
773a7f19ad

+ 5 - 1
jme3-templates/src/com/jme3/gde/templates/files/freemarker/build.gradle.ftl

@@ -38,7 +38,11 @@ dependencies {
   // Core JME
   implementation "org.jmonkeyengine:jme3-core:$jmeVer"
   implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
-  implementation "${lwjglArtifact}:$jmeVer"
+  <#if lwjglLibrary.isCoreJmeLibrary == true>
+  implementation "${lwjglLibrary.groupId}:${lwjglLibrary.artifactId}:$jmeVer"
+  <#else>
+  implementation "${lwjglLibrary.groupId}:${lwjglLibrary.artifactId}:${lwjglLibrary.version}"
+  </#if>
 
   // Suppress errors / warnings building in SDK
   implementation "org.jmonkeyengine:jme3-jogg:$jmeVer"

+ 9 - 9
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameAdditionalLibrariesPanelVisual.java

@@ -33,6 +33,7 @@
 package com.jme3.gde.templates.gradledesktop;
 
 import com.jme3.gde.templates.gradledesktop.options.AdditionalLibrary;
+import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
 import java.awt.Dimension;
 import java.util.ArrayList;
 import java.util.List;
@@ -84,7 +85,7 @@ public class GradleDesktopGameAdditionalLibrariesPanelVisual extends JPanel
         Object[][] tableData = new Object[noRows][2];
 
         int row = 0;
-        for (AdditionalLibrary library : AdditionalLibrary.values()) {
+        for (TemplateLibrary library : AdditionalLibrary.values()) {
             tableData[row][0] = Boolean.FALSE;
             tableData[row][1] = library;
             row++;
@@ -107,8 +108,7 @@ public class GradleDesktopGameAdditionalLibrariesPanelVisual extends JPanel
         if (selectedRow == -1) {
             libraryDescriptionTextArea.setText("");
         } else {
-            AdditionalLibrary selectedLibrary = (AdditionalLibrary)
-                    additionalLibraryTable.getValueAt(selectedRow, 1);
+            TemplateLibrary selectedLibrary = (TemplateLibrary)                    additionalLibraryTable.getValueAt(selectedRow, 1);
             libraryDescriptionTextArea.setText(selectedLibrary
                     .getDescription());
         }
@@ -117,8 +117,8 @@ public class GradleDesktopGameAdditionalLibrariesPanelVisual extends JPanel
     protected void store(WizardDescriptor d) {
         AdditionalLibraryTableModel model = (AdditionalLibraryTableModel)
                 additionalLibraryTable.getModel();
-        List<AdditionalLibrary> selectedLibraries =
-                model.getSelectedLibraries();
+        List<TemplateLibrary> selectedLibraries
+                =                model.getSelectedLibraries();
 
         d.putProperty("additionalLibraries", selectedLibraries);
     }
@@ -202,7 +202,7 @@ public class GradleDesktopGameAdditionalLibrariesPanelVisual extends JPanel
                 case 0:
                     return Boolean.class;
                 case 1:
-                    return String.class;
+                    return TemplateLibrary.class;
                 default:
                     return super.getColumnClass(columnIndex);
             }
@@ -213,11 +213,11 @@ public class GradleDesktopGameAdditionalLibrariesPanelVisual extends JPanel
             return column == 0;
         }
 
-        public List<AdditionalLibrary> getSelectedLibraries() {
-            List<AdditionalLibrary> selectedLibraries = new ArrayList<>();
+        public List<TemplateLibrary> getSelectedLibraries() {
+            List<TemplateLibrary> selectedLibraries = new ArrayList<>();
             for (int i = 0; i < getRowCount(); i++) {
                 if ((Boolean) getValueAt(i, 0)) {
-                    selectedLibraries.add((AdditionalLibrary) getValueAt(i, 1));
+                    selectedLibraries.add((TemplateLibrary) getValueAt(i, 1));
                 }
             }
 

+ 6 - 6
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameGuiPanelVisual.form

@@ -95,14 +95,14 @@
     <Component class="javax.swing.JComboBox" name="guiComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel(GUILibrary.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(GUILibrary.values())" type="code"/>
         </Property>
       </Properties>
       <Events>
         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="guiComboBoxActionPerformed"/>
       </Events>
       <AuxValues>
-        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
+        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
       </AuxValues>
     </Component>
     <Container class="javax.swing.JScrollPane" name="guiDescriptionScrollPane">
@@ -138,14 +138,14 @@
     <Component class="javax.swing.JComboBox" name="physicsEngineComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel(PhysicsLibrary.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(PhysicsLibrary.values())" type="code"/>
         </Property>
       </Properties>
       <Events>
         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="physicsEngineComboBoxActionPerformed"/>
       </Events>
       <AuxValues>
-        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
+        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
       </AuxValues>
     </Component>
     <Container class="javax.swing.JScrollPane" name="physicsEngineDescriptionScrollPane">
@@ -181,14 +181,14 @@
     <Component class="javax.swing.JComboBox" name="networkingComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel(NetworkingLibrary.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(NetworkingLibrary.values())" type="code"/>
         </Property>
       </Properties>
       <Events>
         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="networkingComboBoxActionPerformed"/>
       </Events>
       <AuxValues>
-        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
+        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
       </AuxValues>
     </Component>
     <Container class="javax.swing.JScrollPane" name="networkingDescriptionScrollPane">

+ 14 - 16
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameGuiPanelVisual.java

@@ -34,6 +34,7 @@ package com.jme3.gde.templates.gradledesktop;
 import com.jme3.gde.templates.gradledesktop.options.GUILibrary;
 import com.jme3.gde.templates.gradledesktop.options.NetworkingLibrary;
 import com.jme3.gde.templates.gradledesktop.options.PhysicsLibrary;
+import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import javax.swing.DefaultComboBoxModel;
@@ -56,39 +57,36 @@ import org.openide.util.NbBundle;
  */
 public class GradleDesktopGameGuiPanelVisual extends JPanel {
 
-    private final GradleDesktopGameGuiPanel panel;
-
     /**
      * Creates new form GradleDesktopGameGuiPanelVisual
      */
     public GradleDesktopGameGuiPanelVisual(GradleDesktopGameGuiPanel panel) {
         initComponents();
+
         updateGuiLibraryDescription();
         updatePhysicsLibraryDescription();
         updateNetworkingLibraryDescription();
-
-        this.panel = panel;
     }
 
     private void updateGuiLibraryDescription() {
-        GUILibrary selectedGuiLibrary = (GUILibrary) guiComboBox.getSelectedItem();
+        TemplateLibrary selectedGuiLibrary = guiComboBox.getItemAt(guiComboBox.getSelectedIndex());
         guiDescriptionTextArea.setText(selectedGuiLibrary.getDescription());
     }
 
     private void updatePhysicsLibraryDescription() {
-        PhysicsLibrary selectedPhysicsLibrary = (PhysicsLibrary) physicsEngineComboBox.getSelectedItem();
+        TemplateLibrary selectedPhysicsLibrary = physicsEngineComboBox.getItemAt(physicsEngineComboBox.getSelectedIndex());
         physicsEngineDescriptionTextArea.setText(selectedPhysicsLibrary.getDescription());
     }
 
     private void updateNetworkingLibraryDescription() {
-        NetworkingLibrary selectedNetworkingLibrary = (NetworkingLibrary) networkingComboBox.getSelectedItem();
+        TemplateLibrary selectedNetworkingLibrary = networkingComboBox.getItemAt(networkingComboBox.getSelectedIndex());
         networkingDescriptionTextArea.setText(selectedNetworkingLibrary.getDescription());
     }
 
     protected void store(WizardDescriptor d) {
-        GUILibrary selectedGuiLibrary = (GUILibrary) guiComboBox.getSelectedItem();
-        PhysicsLibrary selectedPhysicsLibrary = (PhysicsLibrary) physicsEngineComboBox.getSelectedItem();
-        NetworkingLibrary selectedNetworkingLibrary = (NetworkingLibrary) networkingComboBox.getSelectedItem();
+        TemplateLibrary selectedGuiLibrary = guiComboBox.getItemAt(guiComboBox.getSelectedIndex());
+        TemplateLibrary selectedPhysicsLibrary = physicsEngineComboBox.getItemAt(physicsEngineComboBox.getSelectedIndex());
+        TemplateLibrary selectedNetworkingLibrary = networkingComboBox.getItemAt(networkingComboBox.getSelectedIndex());
 
         d.putProperty("guiLibrary", selectedGuiLibrary);
         d.putProperty("physicsLibrary", selectedPhysicsLibrary);
@@ -122,7 +120,7 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
         guiLabel.setLabelFor(guiComboBox);
         Mnemonics.setLocalizedText(guiLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.guiLabel.text")); // NOI18N
 
-        guiComboBox.setModel(new DefaultComboBoxModel(GUILibrary.values()));
+        guiComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(GUILibrary.values()));
         guiComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 guiComboBoxActionPerformed(evt);
@@ -139,7 +137,7 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
         physicsEngineLabel.setLabelFor(physicsEngineComboBox);
         Mnemonics.setLocalizedText(physicsEngineLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.physicsEngineLabel.text")); // NOI18N
 
-        physicsEngineComboBox.setModel(new DefaultComboBoxModel(PhysicsLibrary.values()));
+        physicsEngineComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(PhysicsLibrary.values()));
         physicsEngineComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 physicsEngineComboBoxActionPerformed(evt);
@@ -156,7 +154,7 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
         networkingLabel.setLabelFor(networkingComboBox);
         Mnemonics.setLocalizedText(networkingLabel, NbBundle.getMessage(GradleDesktopGameGuiPanelVisual.class, "GradleDesktopGameGuiPanelVisual.networkingLabel.text")); // NOI18N
 
-        networkingComboBox.setModel(new DefaultComboBoxModel(NetworkingLibrary.values()));
+        networkingComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(NetworkingLibrary.values()));
         networkingComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
                 networkingComboBoxActionPerformed(evt);
@@ -239,17 +237,17 @@ public class GradleDesktopGameGuiPanelVisual extends JPanel {
 
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
-    private JComboBox<String> guiComboBox;
+    private JComboBox<TemplateLibrary> guiComboBox;
     private JScrollPane guiDescriptionScrollPane;
     private JTextArea guiDescriptionTextArea;
     private JLabel guiLabel;
     private JSeparator jSeparator1;
     private JSeparator jSeparator2;
-    private JComboBox<String> networkingComboBox;
+    private JComboBox<TemplateLibrary> networkingComboBox;
     private JScrollPane networkingDescriptionScrollPane;
     private JTextArea networkingDescriptionTextArea;
     private JLabel networkingLabel;
-    private JComboBox<String> physicsEngineComboBox;
+    private JComboBox<TemplateLibrary> physicsEngineComboBox;
     private JScrollPane physicsEngineDescriptionScrollPane;
     private JTextArea physicsEngineDescriptionTextArea;
     private JLabel physicsEngineLabel;

+ 2 - 2
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameJMEVersionPanelVisual.form

@@ -140,7 +140,7 @@
     <Component class="javax.swing.JComboBox" name="lwjglComboBox">
       <Properties>
         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
-          <Connection code="new DefaultComboBoxModel(LWJGLVersion.values())" type="code"/>
+          <Connection code="new DefaultComboBoxModel&lt;TemplateLibrary&gt;(com.jme3.gde.templates.gradledesktop.options.LWJGLLibrary.values())" type="code"/>
         </Property>
         <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
           <Dimension value="[100, 25]"/>
@@ -150,7 +150,7 @@
         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lwjglComboBoxActionPerformed"/>
       </Events>
       <AuxValues>
-        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
+        <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;TemplateLibrary&gt;"/>
       </AuxValues>
     </Component>
     <Container class="javax.swing.JScrollPane" name="lwjglDescriptionScrollPane">

+ 7 - 9
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameJMEVersionPanelVisual.java

@@ -33,7 +33,8 @@
 package com.jme3.gde.templates.gradledesktop;
 
 import com.jme3.gde.templates.gradledesktop.options.JMEVersion;
-import com.jme3.gde.templates.gradledesktop.options.LWJGLVersion;
+import com.jme3.gde.templates.gradledesktop.options.LWJGLLibrary;
+import com.jme3.gde.templates.gradledesktop.options.TemplateLibrary;
 import java.awt.Desktop;
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
@@ -124,19 +125,16 @@ public class GradleDesktopGameJMEVersionPanelVisual extends JPanel {
     }
 
     private void updateLWJGLdescription() {
-        LWJGLVersion lwjglVersion = (LWJGLVersion) lwjglComboBox
-                .getSelectedItem();
+        TemplateLibrary lwjglVersion = lwjglComboBox.getItemAt(lwjglComboBox.getSelectedIndex());
         lwjglTextArea.setText(lwjglVersion.getDescription());
     }
 
     protected void store(WizardDescriptor d) {
         String jmeVersion = jmeVersionComboBox.getSelectedItem().toString();
-        LWJGLVersion lwjglVersion = (LWJGLVersion) lwjglComboBox
-                .getSelectedItem();
-        String lwjglArtifact = lwjglVersion.getArtifact();
+        TemplateLibrary lwjglLibrary = lwjglComboBox.getItemAt(lwjglComboBox.getSelectedIndex());
 
         d.putProperty("jmeVersion", jmeVersion);
-        d.putProperty("lwjglArtifact", lwjglArtifact);
+        d.putProperty("lwjglLibrary", lwjglLibrary);
     }
 
     /**
@@ -184,7 +182,7 @@ public class GradleDesktopGameJMEVersionPanelVisual extends JPanel {
         lwjglVersionLabel.setLabelFor(lwjglComboBox);
         Mnemonics.setLocalizedText(lwjglVersionLabel, NbBundle.getMessage(GradleDesktopGameJMEVersionPanelVisual.class, "GradleDesktopGameJMEVersionPanelVisual.lwjglVersionLabel.text")); // NOI18N
 
-        lwjglComboBox.setModel(new DefaultComboBoxModel(LWJGLVersion.values()));
+        lwjglComboBox.setModel(new DefaultComboBoxModel<TemplateLibrary>(LWJGLLibrary.values()));
         lwjglComboBox.setMaximumSize(new Dimension(100, 25));
         lwjglComboBox.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
@@ -257,7 +255,7 @@ public class GradleDesktopGameJMEVersionPanelVisual extends JPanel {
     JScrollPane jmeVersionDescriptionScrollPane;
     JTextPane jmeVersionDescriptionTextPane;
     JLabel jmeVersionLabel;
-    JComboBox<String> lwjglComboBox;
+    JComboBox<TemplateLibrary> lwjglComboBox;
     JScrollPane lwjglDescriptionScrollPane;
     JTextArea lwjglTextArea;
     JLabel lwjglVersionLabel;

+ 8 - 9
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardIterator.java

@@ -32,6 +32,8 @@
 package com.jme3.gde.templates.gradledesktop;
 
 import java.awt.Component;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -42,7 +44,7 @@ import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -127,7 +129,7 @@ public class GradleDesktopGameWizardIterator implements WizardDescriptor./*Progr
         File gradleBuildFile = new File(dirF, "build.gradle");
         Map<String, Object> buildFileBindings = new HashMap<>();
         buildFileBindings.put("jmeVersion", wiz.getProperty("jmeVersion"));
-        buildFileBindings.put("lwjglArtifact", wiz.getProperty("lwjglArtifact"));
+        buildFileBindings.put("lwjglLibrary", wiz.getProperty("lwjglLibrary"));
         buildFileBindings.put("guiLibrary", wiz.getProperty("guiLibrary"));
         buildFileBindings.put("physicsLibrary", wiz.getProperty("physicsLibrary"));
         buildFileBindings.put("networkingLibrary", wiz.getProperty("networkingLibrary"));
@@ -245,13 +247,10 @@ public class GradleDesktopGameWizardIterator implements WizardDescriptor./*Progr
         // Process template           
         try {
             FileObject targetFO = FileUtil.toFileObject(target);
-            Writer os = new OutputStreamWriter(targetFO.getOutputStream(), Charset.forName("UTF-8"));
-            engine.getContext().setWriter(os);
-            Reader is = new InputStreamReader(GradleDesktopGameWizardIterator.class.getResourceAsStream("/" + templateResourcePath));
-            engine.eval(is);
-            
-            os.close();
-            is.close();
+            try (Writer os = new BufferedWriter(new OutputStreamWriter(targetFO.getOutputStream(), StandardCharsets.UTF_8)); Reader is = new BufferedReader(new InputStreamReader(GradleDesktopGameWizardIterator.class.getResourceAsStream("/" + templateResourcePath)));) {
+                engine.getContext().setWriter(os);
+                engine.eval(is);
+            }
         } catch (IOException | ScriptException ex) {
                 throw new IOException(ex.getMessage(), ex);
         }

+ 11 - 2
jme3-templates/src/com/jme3/gde/templates/gradledesktop/GradleDesktopGameWizardPanel.java

@@ -54,6 +54,7 @@ public class GradleDesktopGameWizardPanel implements WizardDescriptor.Panel,
     public GradleDesktopGameWizardPanel() {
     }
 
+    @Override
     public Component getComponent() {
         if (component == null) {
             component = new GradleDesktopGamePanelVisual(this);
@@ -62,22 +63,26 @@ public class GradleDesktopGameWizardPanel implements WizardDescriptor.Panel,
         return component;
     }
 
+    @Override
     public HelpCtx getHelp() {
         return new HelpCtx("sdk.project_creation");
     }
 
+    @Override
     public boolean isValid() {
         getComponent();
         return component.valid(wizardDescriptor);
     }
-    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
+    private final Set<ChangeListener> listeners = new HashSet<>(1); // or can use ChangeSupport in NB 6.0
 
+    @Override
     public final void addChangeListener(ChangeListener l) {
         synchronized (listeners) {
             listeners.add(l);
         }
     }
 
+    @Override
     public final void removeChangeListener(ChangeListener l) {
         synchronized (listeners) {
             listeners.remove(l);
@@ -87,7 +92,7 @@ public class GradleDesktopGameWizardPanel implements WizardDescriptor.Panel,
     protected final void fireChangeEvent() {
         Set<ChangeListener> ls;
         synchronized (listeners) {
-            ls = new HashSet<ChangeListener>(listeners);
+            ls = new HashSet<>(listeners);
         }
         ChangeEvent ev = new ChangeEvent(this);
         for (ChangeListener l : ls) {
@@ -95,20 +100,24 @@ public class GradleDesktopGameWizardPanel implements WizardDescriptor.Panel,
         }
     }
 
+    @Override
     public void readSettings(Object settings) {
         wizardDescriptor = (WizardDescriptor) settings;
         component.read(wizardDescriptor);
     }
 
+    @Override
     public void storeSettings(Object settings) {
         WizardDescriptor d = (WizardDescriptor) settings;
         component.store(d);
     }
 
+    @Override
     public boolean isFinishPanel() {
         return false;
     }
 
+    @Override
     public void validate() throws WizardValidationException {
         getComponent();
         component.validate(wizardDescriptor);

+ 5 - 5
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/AdditionalLibrary.java

@@ -70,22 +70,22 @@ public enum AdditionalLibrary implements TemplateLibrary {
     JME3_EFFECTS("jMonkeyEngine Effects (jme3-effects)",
             NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.jme3-effects.description"),
-            "org.jmonkeyengine", "jme3-effects",
+            null, "jme3-effects",
             null, true),
     JME3_TERRAIN("jMonkeyEngine TerraMonkey (jme3-terrain)",
             NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.jme3-terrain.description"),
-            "org.jmonkeyengine", "jme3-terrain",
+            null, "jme3-terrain",
             null, true),
     JME3_TESTDATA("jMonkeyEngine Test Data (jme3-testdata)",
             NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.jme3-testdata.description"),
-            "org.jmonkeyengine", "jme3-testdata",
+            null, "jme3-testdata",
             null, true),
     JME3_VR("jMonkeyEngine Virtual Reality (jme3-vr)",
             NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.jme3-vr.description"),
-            "org.jmonkeyengine", "jme3-vr",
+            null, "jme3-vr",
             null, true),
     HEART("Heart Library", NbBundle.getMessage(AdditionalLibrary.class,
             "additionalLibrary.heart.description"),
@@ -189,7 +189,7 @@ public enum AdditionalLibrary implements TemplateLibrary {
 
     @Override
     public String getGroupId() {
-        return groupId;
+        return isCoreJmeLibrary ? JME_GROUP_ID : groupId;
     }
 
     @Override

+ 2 - 2
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/GUILibrary.java

@@ -71,7 +71,7 @@ public enum GUILibrary implements TemplateLibrary {
             null, false),
     NIFTY("Nifty", NbBundle.getMessage(GUILibrary.class, 
             "guilibrary.nifty.description"),
-            "org.jmonkeyengine", "jme3-niftygui",
+            null, "jme3-niftygui",
             null, true),
     LEMUR("Lemur", NbBundle.getMessage(GUILibrary.class,
             "guilibrary.lemur.description"),
@@ -150,7 +150,7 @@ public enum GUILibrary implements TemplateLibrary {
 
     @Override
     public String getGroupId() {
-        return groupId;
+        return isCoreJmeLibrary ? JME_GROUP_ID : groupId;
     }
 
     @Override

+ 39 - 32
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/LWJGLVersion.java → jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/LWJGLLibrary.java

@@ -59,12 +59,12 @@ import org.openide.util.NbBundle;
  *
  * @author peedeeboy
  */
-public enum LWJGLVersion {
+public enum LWJGLLibrary implements TemplateLibrary {
 
-    LWJGL_3("LWJGL 3.x", NbBundle.getMessage(LWJGLVersion.class,
-            "lwjgl.lwjgl3.description"), "org.jmonkeyengine:jme3-lwjgl3"),
-    LWJGL_2("LWJGL 2.x", NbBundle.getMessage(LWJGLVersion.class,
-            "lwjgl.lwjgl2.description"), "org.jmonkeyengine:jme3-lwjgl");
+    LWJGL_3("LWJGL 3.x", NbBundle.getMessage(LWJGLLibrary.class,
+            "lwjgl.lwjgl3.description"), "jme3-lwjgl3"),
+    LWJGL_2("LWJGL 2.x", NbBundle.getMessage(LWJGLLibrary.class,
+            "lwjgl.lwjgl2.description"), "jme3-lwjgl");
 
     /**
      * The name of the LWJGL library. This will be displayed in the jComboBox in
@@ -77,51 +77,38 @@ public enum LWJGLVersion {
      */
     private final String description;
     /**
-     * Gradle artifact string. This should exclude the jMonkeyEngine version, as
-     * this will be added by the template.
+     * Maven artifact ID
      */
-    private final String artifact;
+    private final String artifactId;
 
+    /**
     /**
      * Private constructor to create an instance of this enum.
      *
-     * @param label The name of the LWJGL library.
-     * @param description Long description of the LWJGL version.
-     * @param artifact Gradle artifact string.
+     * @param label The name of the library.
+     * @param description Long description of the library.
+     * @param groupId Maven group ID.
+     * @param artifactId Maven artifact ID.
+     * @param defaultVersion Default version is used if no version info is found
+     * from Maven
      */
-    LWJGLVersion(String label, String description, String artifact) {
+    LWJGLLibrary(String label, String description,
+            String artifactId) {
         this.label = label;
         this.description = description;
-        this.artifact = artifact;
+        this.artifactId = artifactId;
     }
 
-    /**
-     * Get the label for this LWJGL version.
-     *
-     * @return the label for this LWJGL version.
-     */
+    @Override
     public String getLabel() {
         return label;
     }
 
-    /**
-     * Get the long description for this LWJGL version.
-     *
-     * @return the long description for this LWJGL version.
-     */
+    @Override
     public String getDescription() {
         return description;
     }
 
-    /**
-     * Get the Gradle artifact string.
-     *
-     * @return the Gradle artifact string.
-     */
-    public String getArtifact() {
-        return artifact;
-    }
-
     /**
      * Override the <code>toString()</code> method to return the label, so that
      * this enum will display nicely in a jComboBox.
@@ -132,4 +119,24 @@ public enum LWJGLVersion {
     public String toString() {
         return this.label;
     }
+
+    @Override
+    public boolean getIsCoreJmeLibrary() {
+        return true;
+    }
+
+    @Override
+    public String getGroupId() {
+        return JME_GROUP_ID;
+    }
+
+    @Override
+    public String getArtifactId() {
+        return artifactId;
+    }
+
+    @Override
+    public String getVersion() {
+        return null;
+    }
 }

+ 2 - 0
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/MavenArtifact.java

@@ -36,6 +36,8 @@ package com.jme3.gde.templates.gradledesktop.options;
  */
 public interface MavenArtifact {
 
+    String JME_GROUP_ID = "org.jmonkeyengine";
+
     /**
      * Get the Maven group ID
      *

+ 2 - 2
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/NetworkingLibrary.java

@@ -70,7 +70,7 @@ public enum NetworkingLibrary implements TemplateLibrary {
             null, false),
     SPIDERMONKEY("SpiderMonkey", NbBundle.getMessage(NetworkingLibrary.class,
             "networkinglibrary.spidermonkey.description"),
-            "org.jmonkeyengine", "jme3-networking",
+            null, "jme3-networking",
             null, true),
     MONKEYNETTY("MonkeyNetty", NbBundle.getMessage(NetworkingLibrary.class,
             "networkinglibrary.monkeynetty.description"),
@@ -153,7 +153,7 @@ public enum NetworkingLibrary implements TemplateLibrary {
 
     @Override
     public String getGroupId() {
-        return groupId;
+        return isCoreJmeLibrary ? JME_GROUP_ID : groupId;
     }
 
     @Override

+ 2 - 2
jme3-templates/src/com/jme3/gde/templates/gradledesktop/options/PhysicsLibrary.java

@@ -70,7 +70,7 @@ public enum PhysicsLibrary implements TemplateLibrary {
             null, false),
     JBULLET("jBullet", NbBundle.getMessage(GUILibrary.class,
             "physicslibrary.jbullet.description"),
-            "org.jmonkeyengine", "jme3-jbullet",
+            null, "jme3-jbullet",
             null, true),
     MINIE("Minie", NbBundle.getMessage(PhysicsLibrary.class,
             "physicslibrary.minie.description"),
@@ -149,7 +149,7 @@ public enum PhysicsLibrary implements TemplateLibrary {
 
     @Override
     public String getGroupId() {
-        return groupId;
+        return isCoreJmeLibrary ? JME_GROUP_ID : groupId;
     }
 
     @Override