Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have to first tell Maven to build the WAR, check out this plugin for that: <a href="http://maven.apache.org/plugins/maven-war-plugin/" rel="nofollow noreferrer">http://maven.apache.org/plugins/maven-war-plugin/</a>.</p> <p>Then you need to tell maven how to deploy to glassfish, you can either configure a Maven execution plugin to do this (see here: <a href="http://mojo.codehaus.org/exec-maven-plugin/" rel="nofollow noreferrer">http://mojo.codehaus.org/exec-maven-plugin/</a>). Or you can look around for a custom plugin devoted to integrating maven with glassfish. This one looks promising, but I have not used it: <a href="http://maven-glassfish-plugin.java.net/" rel="nofollow noreferrer">http://maven-glassfish-plugin.java.net/</a>.</p> <p>Maven provides a lot of basic functionality out of the box, but most of the cooler stuff with build automation is done through plugins.</p> <p><strong>Update</strong></p> <p>Just updating to add a very simple Pom that will do a auto-deployment. Note: if you just run a "mvn clean install", with the packaging set to 'war', maven will build the .war file for you and place it in the target/ folder. You can take this and deploy it to glassfish manually if you just want to get started. </p> <p>Below is part of a very simple pom that uses the Maven execution plugin to auto-deploy to glassfish as a function of the build:</p> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;exec&lt;/goal&gt; &lt;/goals&gt; &lt;phase&gt;install&lt;/phase&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;executable&gt;${path-to-asadmin-util}&lt;/executable&gt; &lt;arguments&gt; &lt;argument&gt;deploy&lt;/argument&gt; &lt;argument&gt;--user=${username}]&lt;/argument&gt; &lt;argument&gt;--passwordfile=${password-file}&lt;/argument&gt; &lt;argument&gt;--host=localhost&lt;/argument&gt; &lt;argument&gt;--port=4848&lt;/argument&gt; &lt;argument&gt;target/${project.name}&lt;/argument&gt; &lt;/arguments&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p>This basically just calls the deploy command on the glassfish asadmin utility[1]. You need to fill in the following variables:</p> <ul> <li><code>${path-to-asadmin-util}</code> --> this is the path to your asadmin utility (normally in the glassfish_home/bin)</li> <li><code>${username}</code> --> glassfish admin username</li> <li><code>${password-file}</code> --> password file for logging into glassfish admin[2]</li> <li><code>${project.name}</code> --> name of your war</li> </ul> <p>If you want to get more complicated I suggest taking a look at this thread: <a href="https://stackoverflow.com/questions/1935137/glassfish-v3-and-glassfish-maven-plugin-mac">GlassFish v3 and glassfish-maven-plugin (Mac)</a>.</p> <p>[1] - <a href="http://docs.oracle.com/cd/E18930_01/html/821-2433/deploy-1.html#SJSASEEREFMANdeploy-1" rel="nofollow noreferrer">http://docs.oracle.com/cd/E18930_01/html/821-2433/deploy-1.html#SJSASEEREFMANdeploy-1</a></p> <p>[2] - <a href="http://docs.oracle.com/cd/E18930_01/html/821-2435/ghgrp.html#ghytn" rel="nofollow noreferrer">http://docs.oracle.com/cd/E18930_01/html/821-2435/ghgrp.html#ghytn</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload