Index: src/test/java/org/codehaus/mojo/webstart/generator/GeneratorTest.java
===================================================================
--- src/test/java/org/codehaus/mojo/webstart/generator/GeneratorTest.java	(revision 6924)
+++ src/test/java/org/codehaus/mojo/webstart/generator/GeneratorTest.java	(working copy)
@@ -78,21 +78,22 @@
                 return artifact == artifact1;
             }
         };
+        NativeLibResourcesGenerator nlrg = new NativeLibResourcesGenerator(mojo);
         
-        assertEquals("", Generator.getDependenciesText(mojo));
+        assertEquals("", Generator.getDependenciesText(mojo, nlrg));
 
         artifacts.add(artifact1);
         artifacts.add(artifact2);
 
         assertEquals("\n<jar href=\"artifact1-1.0.jar\" main=\"true\"/>"
                    + "\n<jar href=\"artifact2-1.5.jar\"/>\n",
-                Generator.getDependenciesText(mojo));
+                Generator.getDependenciesText(mojo, nlrg));
 
         mojo.setOutputJarVersions(true);
         
         assertEquals("\n<jar href=\"artifact1-1.0.jar\" version=\"1.0\" main=\"true\"/>"
                      + "\n<jar href=\"artifact2-1.5.jar\" version=\"1.5\"/>\n",
-                     Generator.getDependenciesText(mojo));
+                     Generator.getDependenciesText(mojo, nlrg));
 
         
     }
@@ -121,21 +122,22 @@
                 return "lib";
             }
         };
+        NativeLibResourcesGenerator nlrg = new NativeLibResourcesGenerator(mojo);
         
-        assertEquals("", Generator.getDependenciesText(mojo));
+        assertEquals("", Generator.getDependenciesText(mojo, nlrg));
 
         artifacts.add(artifact1);
         artifacts.add(artifact2);
 
         assertEquals("\n<jar href=\"lib/artifact1-1.0.jar\" main=\"true\"/>"
                    + "\n<jar href=\"lib/artifact2-1.5.jar\"/>\n",
-                Generator.getDependenciesText(mojo));
+                Generator.getDependenciesText(mojo, nlrg));
 
         mojo.setOutputJarVersions(true);
         
         assertEquals("\n<jar href=\"lib/artifact1-1.0.jar\" version=\"1.0\" main=\"true\"/>"
                      + "\n<jar href=\"lib/artifact2-1.5.jar\" version=\"1.5\"/>\n",
-                     Generator.getDependenciesText(mojo));
+                     Generator.getDependenciesText(mojo, nlrg));
 
         
     }
Index: src/main/java/org/codehaus/mojo/webstart/generator/NativeLibResourcesGenerator.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/generator/NativeLibResourcesGenerator.java	(revision 0)
+++ src/main/java/org/codehaus/mojo/webstart/generator/NativeLibResourcesGenerator.java	(revision 0)
@@ -0,0 +1,188 @@
+package org.codehaus.mojo.webstart.generator;
+
+/*
+ * Copyright 2005 Nick C
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.mojo.webstart.AbstractJnlpMojo;
+import org.codehaus.mojo.webstart.NativeLib;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Generates the nativelib for JNLP deployment descriptor.
+ *
+ * @author David Bernard
+ * @author Trey Sleeper
+ */
+public class NativeLibResourcesGenerator {
+
+    //private Collection nativeLibResources;
+    private AbstractJnlpMojo config;
+    private List nativeLibs;
+
+    /**
+     * Creates a new {@code JarResources}.
+     *
+     * @param mavenProject
+     *            The Maven project that this generator is being run within.
+     * @param resourceLoaderPath
+     *            used to find the template in conjunction to
+     *            inputFileTemplatePath
+     * @param outputFile
+     * @param templateFile
+     *            relative to resourceLoaderPath
+     * @param jarResources
+     *            The collection of JarResources that will be output in the JNLP
+     *            file.
+     * @param mainClass
+     *            The fully qualified name of the application's main class.
+     */
+    public NativeLibResourcesGenerator(AbstractJnlpMojo config) {
+        this.config = config;
+        nativeLibs = config.getNativeLibs();
+        config.verboseLog("initialize NativeLibResourcesGenerator");
+    }
+
+    public boolean isNativeJar(Artifact thisArtifact) {
+        NativeLib lib = getNativeLibSettings(thisArtifact);
+        boolean back = (lib != null);
+        config.verboseLog("is nativeLib '" + thisArtifact.toString() +"' : " + back );
+        return back;
+    }
+
+    private NativeLib getNativeLibSettings(Artifact thisArtifact) {
+        for (Iterator iter = nativeLibs.iterator(); iter.hasNext();) {
+            NativeLib nativeLib = (NativeLib) iter.next();
+            if (thisArtifact.getGroupId().equalsIgnoreCase(nativeLib.groupId) && thisArtifact.getArtifactId().equalsIgnoreCase(nativeLib.artifactId)) {
+                if ((nativeLib.classifier == null) || nativeLib.classifier.equalsIgnoreCase(thisArtifact.getClassifier())) {
+                    return nativeLib;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getNativeDependenciesText() {
+        StringBuffer buffer = new StringBuffer();
+        Map libsByOsArch = new HashMap();
+
+        List artifacts = config.getPackagedJnlpArtifacts();
+
+        String jarLibPath = getLibPath();
+
+        for (Iterator itr = artifacts.iterator(); itr.hasNext();) {
+            Artifact jarResource = (Artifact) itr.next();
+            NativeLib nativeLibSettings = getNativeLibSettings(jarResource);
+
+            // This is not a native artifact
+            if (nativeLibSettings == null) {
+                continue;
+            }
+
+            OSArchKey key = new OSArchKey(nativeLibSettings.os, nativeLibSettings.arch, nativeLibSettings.locale);
+            List osArchJars = (List) libsByOsArch.get(key);
+
+            if (osArchJars == null) {
+                osArchJars = new ArrayList();
+                libsByOsArch.put(key, osArchJars);
+            }
+            osArchJars.add(jarResource);
+        }
+
+        if (!libsByOsArch.isEmpty()) {
+            config.verboseLog("Start writing nativeLib");
+            buffer.append("\n");
+
+            for (Iterator itr = libsByOsArch.keySet().iterator(); itr.hasNext();) {
+                OSArchKey key = (OSArchKey) itr.next();
+                List jars = (List) libsByOsArch.get(key);
+                buffer.append("<resources ");
+
+                if (StringUtils.isNotEmpty(key.os)) {
+                    buffer.append("os=\"").append(key.os).append("\" ");
+                }
+
+                if (StringUtils.isNotEmpty(key.arch)) {
+                    buffer.append("arch=\"").append(key.arch).append("\" ");
+                }
+
+                if (StringUtils.isNotEmpty(key.locale)) {
+                    buffer.append("locale=\"").append(key.locale).append("\" ");
+                }
+                buffer.append(">\n");
+
+                for (Iterator listItr = jars.iterator(); listItr.hasNext();) {
+                    Artifact jarResource = (Artifact) listItr.next();
+                    buffer.append("<nativelib href=\"").append(jarLibPath);
+                    buffer.append(jarResource.getFile().getName()).append("\"");
+
+                    if (config.isOutputJarVersions()) {
+                        buffer.append(" version=\"").append(jarResource.getVersion()).append("\"");
+                    }
+
+                    buffer.append("/>\n");
+                }
+                buffer.append("</resources>\n");
+            }
+        }
+
+        return buffer.toString();
+
+    }
+
+    private String getLibPath() {
+        String jarLibPath = "";
+
+        if (config.getLibPath() != null) {
+            jarLibPath = config.getLibPath().trim();
+            if (jarLibPath.length() > 0)
+                jarLibPath += "/";
+        }
+
+        return jarLibPath;
+    }
+
+    static class OSArchKey {
+        public static final String[] osKnown = {"Windows", "Linux", "SunOs", "Mac OS X", "Mac OS", "Solaris"};
+
+        String os;
+        String arch;
+        String locale;
+
+        public OSArchKey(String os, String arch, String locale) {
+            this.os = formatOs(os);
+            this.arch = arch;
+            this.locale = locale;
+
+        }
+
+        public String formatOs(String os) {
+            for(int i =0; i< osKnown.length; i++) {
+                if (osKnown[i].equalsIgnoreCase(os)) {
+                    return osKnown[i];
+                }
+            }
+            return os;
+        }
+
+    }
+}
Index: src/main/java/org/codehaus/mojo/webstart/generator/Generator.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/generator/Generator.java	(revision 6924)
+++ src/main/java/org/codehaus/mojo/webstart/generator/Generator.java	(working copy)
@@ -17,7 +17,6 @@
  */
 
 import java.io.File;
-import java.net.URL;
 import java.util.List;
 
 import org.apache.maven.artifact.Artifact;
@@ -29,11 +28,13 @@
  *
  * @author ngc
  * @author <a href="jerome@coffeebreaks.org">Jerome Lacoste</a>
+ * @author David Bernard
  */
 public class Generator extends AbstractGenerator
 {
 
     private AbstractJnlpMojo config;
+    private NativeLibResourcesGenerator nativeLibGen;
 
     /**
      * @param task
@@ -54,7 +55,7 @@
         super(mavenProject, resourceLoaderPath, defaultTemplateResourceName, outputFile, inputFileTemplatePath, mainClass, webstartJarURL );
         
         this.config = task;
-
+        nativeLibGen = new NativeLibResourcesGenerator(config);
     }
 
     /**
@@ -62,10 +63,13 @@
      */
     protected String getDependenciesText()
     {
-        return getDependenciesText( config );
+        return getDependenciesText(config, nativeLibGen);
     }
 
-    static String getDependenciesText( AbstractJnlpMojo config )
+    /**
+     * {@inheritDoc}
+     */
+    public static String getDependenciesText(AbstractJnlpMojo config, NativeLibResourcesGenerator nativeLibGen)
     {
         String dependenciesText = "";
         List artifacts = config.getPackagedJnlpArtifacts();
@@ -82,6 +86,9 @@
 
             for (int i = 0; i < artifacts.size(); i++) {
                 Artifact artifact = (Artifact)artifacts.get(i);
+                if (nativeLibGen.isNativeJar(artifact)) {
+                    continue;
+                }
                 buffer.append("<jar href=\"");
                 if (jarLibPath != null) {
                     buffer.append(jarLibPath).append("/");
@@ -104,4 +111,12 @@
         return dependenciesText;
     }
     
+    /**
+     * {@inheritDoc}
+     */
+    protected String getNativeLibDependenciesText()
+    {
+        return nativeLibGen.getNativeDependenciesText();
 }
+
+}
Index: src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java	(revision 6924)
+++ src/main/java/org/codehaus/mojo/webstart/generator/AbstractGenerator.java	(working copy)
@@ -17,7 +17,6 @@
 
 import java.io.File;
 import java.io.FileWriter;
-import java.net.URL;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -37,7 +36,7 @@
  *
  * @author Kevin Stembridge
  * @since 30 Aug 2007
- * @version $Revision:$
+ * @version $Revision$
  *
  */
 public abstract class AbstractGenerator {
@@ -203,6 +202,15 @@
     protected abstract String getDependenciesText( );
     
     /**
+     * Subclasses could (optional) implement this method to return the text that should
+     * replace the $nativeLibs placeholder in the JNLP template.
+     * @return The native libs dependencies text, never null (empty string by default).
+     */
+    protected String getNativeLibDependenciesText() {
+        return "";
+    }
+
+    /**
      * Creates a Velocity context and populates it with replacement values
      * for our pre-defined placeholders.
      * 
@@ -212,6 +220,7 @@
         VelocityContext context = new VelocityContext();
 
         context.put( "dependencies", getDependenciesText( ) );
+        context.put( "nativeLibs", getNativeLibDependenciesText());
 
         // Note: properties that contain dots will not be properly parsed by Velocity. Should we replace dots with underscores ?        
         addPropertiesToContext( System.getProperties(), context );
Index: src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java	(revision 6924)
+++ src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java	(working copy)
@@ -1024,7 +1024,7 @@
     /**
      * Log as info when verbose or info is enabled, as debug otherwise.
      */
-    protected void verboseLog( String msg )
+    public void verboseLog( String msg )
     {
         infoOrDebug( isVerbose() || getLog().isInfoEnabled(), msg );
     }
Index: src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java	(revision 6924)
+++ src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java	(working copy)
@@ -691,5 +691,12 @@
         this.outputJarVersions = outputJarVersions;
     }
     
+    public List getNativeLibs() {
+        if ((jnlp == null) || (jnlp.getNativeLibs() == null)){
+            return new ArrayList(0);
 }
+        return jnlp.getNativeLibs();
+    }
 
+}
+
Index: src/main/java/org/codehaus/mojo/webstart/NativeLib.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/NativeLib.java	(revision 0)
+++ src/main/java/org/codehaus/mojo/webstart/NativeLib.java	(revision 0)
@@ -0,0 +1,19 @@
+package org.codehaus.mojo.webstart;
+
+
+/**
+ * Describe individual dependencies that should be treated as native libraries.
+ *
+ * @author Trey Sleeper
+ *
+ */
+public class NativeLib
+{
+    public String groupId;
+    public String artifactId;
+    public String classifier;
+    public String os;
+    public String arch;
+    public String locale;
+
+}
Index: src/main/java/org/codehaus/mojo/webstart/JnlpConfig.java
===================================================================
--- src/main/java/org/codehaus/mojo/webstart/JnlpConfig.java	(revision 6924)
+++ src/main/java/org/codehaus/mojo/webstart/JnlpConfig.java	(working copy)
@@ -17,6 +17,7 @@
  */
 
 import java.io.File;
+import java.util.List;
 
 /**
  * Bean to host part of the JnlpMojo configuration.
@@ -55,6 +56,8 @@
      */
     private File resources;
 
+    private List nativeLibs;
+
     public void setInputTemplateResourcePath( String inputTemplateResourcePath )
     {
         this.inputTemplateResourcePath = inputTemplateResourcePath;
@@ -176,4 +179,14 @@
     {
         return mainClass;
     }
+
+    public List getNativeLibs()
+    {
+        return nativeLibs;
 }
+
+    public void setNativeLibs(List nativeLibs)
+    {
+        this.nativeLibs = nativeLibs;
+    }
+}

