Projects setup using maven car-maven-plugin can be imported into Eclipse IDE, so that you can develop, test or debug them with GEP.
We start with the Geronimo sample application calculator and demonstrate how to import those appplications built with car-maven-plugin into eclipse IDE, and make them run on GEP.
- Ensure that you have a Geronimo server defined in Eclipse, and specify it as the tartget runtime. See Defining Geronimo server runtimes and servers for how to define Geronimo servers and server runtimes in Eclipse.
- Build the samples in maven using this command:
mvn eclipse:eclipse. See Maven Guide to using Eclipse with Maven 2.x for more information about this command.
- In Eclipse, import the resulting EAR file from the last step, that is,
calculator-ear-2.1.2.ear. This will create three projects in Eclipse: calculator-ear-2.1.2, calculator-ejb-2.1.2, calculator-war-2.1.2.
- Ensure that the imported EAR file can be deployed to your Geronimo server by deploying it and invoke the WAR file http://localhost:8080/calculator-war-2.1.2/. After that, undeploy the EAR file and stop the server.
- Copy the three java files in SVN, that is, in
\samples\tags\samples-parent-2.1.2\samples\calculator\calculator-ejb\src\main\java\org\apache\geronimo\samples\slsb\calculatorinto the Eclipse package
org.apache.geronimo.samples.slsb.calculatorfor the calculator-ejb-2.1.2 project. This package should have been created for you during the import; if not, create it yourself prior to copying java files.
- For the calculator-war-2.1.2 project create this package:
- Copy the single java file in SVN, that is,
\samples\tags\samples-parent-2.1.2\samples\calculator\calculator-war\src\main\java\org\apache\geronimo\samples\calculator\CalculatorServlet.javainto the package
- In Eclipse, add the calculator-ejb-2.1.2 project to the build path for the calculator-war-2.1.2 project to ensure that everything builds.
Now you can test and debug your applpication in Eclipse.
This turotial aims at importing existing Java EE artifacts into Eclipse. It does not work if you want your Java EE artifacts to build successfully in both maven and Eclipse.