Issue
I am trying to deploy the first example (hello1) from the Java 7/8 EE tutorial* using Netbeans and I am running into problems. The project compiles without problems but when deploying it gives an error:
Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.2:redeploy (deploy) on project hello1: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.2:redeploy failed: Failed to create deployer with implementation class org.codehaus.cargo.container.glassfish.GlassFish4xInstalledLocalDeployer for the parameters (container [id = [glassfish4x]], deployer type [installed]). InvocationTargetException: The container configuration directory "/home/DeltaLima/glassfish4/glassfish/domains" does not exist. Please configure the container before attempting to perform any local deployment. Read more on: http://cargo.codehaus.org/Local+Configuration -> [Help 1]
Contrary to the tutorial I installed the GlassFish server in /opt/glassfish-v4 instead of /home/DeltaLima/glassfish4. In Netbeans I configured it that way, so I can start, stop and check the status of the server without any problems. The domains folder in the server configuration is set correctly.
It seems that the Maven installation bundled with Netbeans expects the server to be installed in the user's home directory nevertheless.
I am new to Java EE, Netbeans and Maven so I have no experience configuring Netbeans / Maven and neither the tutorial or the link provided in the error message are of much help.
How do you set up the project in Netbeans in such a way that it deploys in the right directory?
Netbeans version 7.3.1
Glassfish version 4.0
OS: Ubuntu
*Answer updated to account for Java 8 EE as well
Solution
After searching through various configuration files I finally found the solution to my problem.
The domains folder used by Maven / Cargo is defined in a pom.xml file that is in the grand-grandparent folder of the project directory.
In tut-install/examples/pom.xml you need to change the <glassfish.home>
property to reflect your glassfish installation directory.
In JAVA 8 EE a property called was introduced to serve the same purpose.
Settings defined in this pom.xml cascade down to all tutorial examples.
Answered By - DeltaLima
Answer Checked By - David Marino (JavaFixing Volunteer)