How to Deploy a J2ee Ear in Glassfish Using Maven
The ff code will explain how a j2ee ear project can be deploy by invoking a maven goal. The plugin: http://maven-glassfish-plugin.java.ne...
https://www.czetsuyatech.com/2012/06/javaee-deploy-jar-on-glassfish-using-maven.html
The ff code will explain how a j2ee ear project can be deploy by invoking a maven goal.
The plugin: http://maven-glassfish-plugin.java.net/deploy-mojo.html
To deploy to a glassfish server using maven, invoke (inside your ear project):
You need to add the ff plugin to your ear's pom.xml
Also by default glassfish:deploy goal is calling asadmin, so it works perfectly on linux but not on windows. To be able to do so simply delete or rename asadmin to asadmin.sh. This way the plugin will read asadmin.bat for windows.
The plugin: http://maven-glassfish-plugin.java.net/deploy-mojo.html
To deploy to a glassfish server using maven, invoke (inside your ear project):
mvn glassfish:deploy
You need to add the ff plugin to your ear's pom.xml
<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>4848</adminPort> <httpPort>8080</httpPort> <httpsPort>8443</httpsPort> <iiopPort>3700</iiopPort> <jmsPort>7676</jmsPort> <reuse>false</reuse> </domain> <components> <component> <name>${project.artifactId}</name> <artifact> ${project.build.directory}/${project.build.finalName}.ear </artifact> </component> </components> </configuration> </plugin>Take note that the plugin reads a password file that can be save anywhere you want as long as you have access to it. I've placed mine inside the glassfish's home directory for easier reference. It contains the glassfish's admin password. If you forgot to set this you'll get authentication error.
AS_ADMIN_PASSWORD=my_glassfish_admin_password
Also by default glassfish:deploy goal is calling asadmin, so it works perfectly on linux but not on windows. To be able to do so simply delete or rename asadmin to asadmin.sh. This way the plugin will read asadmin.bat for windows.
Post a Comment