How one can deploy a maven web application to a locally instaled glassfish server using only maven plugins?
In other words, if I have a maven project with packaging=war, it is possible to deploy to a locally installed glassfish using a command like "mvn clean package some-plugin:goal-deploy"?
Yes, it is possible using the Cargo Maven Plugin, as it is self-explained in the following example:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>glassfish4x</containerId>
<type>installed</type>
<!-- Path to directory where glassfish is installed -->
<home>C:/programs/glassfish4</home>
</container>
<configuration>
<type>existing</type>
<!-- Path to domains directory -->
<home>C:/programs/glassfish4/glassfish/domains</home>
<properties>
<!-- Domain name where application will be deployed. -->
<cargo.glassfish.domain.name>domain1</cargo.glassfish.domain.name>
<!-- Glassfish user to authenticate -->
<cargo.remote.username>admin</cargo.remote.username>
<!-- Glassfish password to authenticate -->
<cargo.remote.password></cargo.remote.password>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
The maven commands to deploy using plugin cited above are:
mvn clean package cargo:deploy
or
clean package cargo:redeploy
You need to specify a version of the plugin. Maven version 3 gives me some warnings about this issue.