Skip to end of metadata
Go to start of metadata

Using maven-glassfish-plugin

Configuration

Add this to your settings.xml file if you want to share glassfish deployment configuration for all your maven projects.

~/.m2/settings.xml

Add this to the project's pom file. You can replace all ${glassfish.....} properties with their actual values if you don't want to have them in your settings.xml.

pom.xml

Deploying

After your pom.xml file is configured. You can deploy your maven project using the following command.

mvn glassfish:deploy
  1. 15-May-2012

    Anonymous

  2. 09-Sep-2012

    Anonymous

    Doesn't work for glassfish 3.1.2.x : 

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.338s
    [INFO] Finished at: Sun Sep 09 12:47:40 NZST 2012
    [INFO] Final Memory: 5M/240M
    [INFO] ------------------------------------------------------------------------
    [ERROR] No plugin found for prefix 'glassfish' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/phiro/.m2/repository), central (http://repo1.maven.org/maven2)] -> [Help 1]

     

     

  3. 14-Nov-2012

    Anonymous

    SAME ERROR..

     

  4. 06-Mar-2013

    Anonymous

    had same error so I changed it to look like this:

    <project>

    ...

    <build>

    <plugins>

    ,,,

    <plugin>

    <groupId>org.glassfish.maven.plugin</groupId>


    <artifactId>maven-glassfish-plugin</artifactId>

    <version>2.1</version>

    <configuration>

    <glassfishDirectory>${local.glassfish.home}</glassfishDirectory>

    <user>${local.glassfish.user}</user>

    <passwordFile>${local.glassfish.passfile}</passwordFile>

    <autoCreate>true</autoCreate>

    <debug>true</debug>

    <echo>false</echo>

    <terse>true</terse>

    <domain>

    <name>${local.glassfish.domain}</name>

    <adminPort>45660</adminPort>

    <httpPort>41852</httpPort>

    <httpsPort>57675</httpsPort>

    <iiopPort>44470</iiopPort>

    <jmsPort>51051</jmsPort>

    <reuse>false</reuse>

    </domain>

    <components>

    <component>

    <name>${project.artifactId}</name>

    <artifact>

    ${project.build.directory}/${project.build.finalName}.war

    </artifact>

    </component>

    </components>

    </configuration>

    </plugin>

    </plugins>

    </build>

    <pluginRepositories>


    <pluginRepository>


    <id>maven.java.net</id>

    <name>Java.net Maven2 Repository</name>


    <url>http://download.java.net/maven/2</url>


    </pluginRepository>


    </pluginRepositories>

    ....

    </project>

    Now it finds the plug in but has problem

    [INFO] --- maven-glassfish-plugin:2.1:redeploy (default-cli) @ **** ---
    Downloading: http://maven.ocean.net.au/external/org/apache/maven/maven-plugin-api/maven-metadata.xml
    Downloading: http://maven.ocean.net.au/snapshot/org/apache/maven/maven-plugin-api/maven-metadata.xml
    Downloading: http://maven.ocean.net.au/release/org/apache/maven/maven-plugin-api/maven-metadata.xml
    [WARNING] Could not transfer metadata org.apache.maven:maven-plugin-api/maven-metadata.xml from/to release.ocean.net.au (http://maven.ocean.net.au/release): null to http://maven.ocean.net.au/release/org/apache/maven/maven-plugin-api/maven-metadata.xml
    [WARNING] Could not transfer metadata org.apache.maven:maven-plugin-api/maven-metadata.xml from/to external.ocean.net.au (http://maven.ocean.net.au/external): null to http://maven.ocean.net.au/external/org/apache/maven/maven-plugin-api/maven-metadata.xml
    [WARNING] Could not transfer metadata org.apache.maven:maven-plugin-api/maven-metadata.xml from/to snapshot.ocean.net.au (http://maven.ocean.net.au/snapshot): null to http://maven.ocean.net.au/snapshot/org/apache/maven/maven-plugin-api/maven-metadata.xml
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 29.294s
    [INFO] Finished at: Wed Mar 06 14:53:30 CET 2013
    [INFO] Final Memory: 25M/252M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:redeploy (default-cli) on project ****: Undeployment of pick failed. IOException: Cannot run program "..../glassfishv3/bin/asadmin": error=2, No such file or directory -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Write a comment…