Clone URL (Committers only): https://cms.apache.org/redirect?new=anonymous;action=diff;uri=http://openejb.apache.org/tomee-and-eclipse.mdtext
twelve.eig...@gmail.com Index: trunk/content/tomee-and-eclipse.mdtext =================================================================== --- trunk/content/tomee-and-eclipse.mdtext (revision 1373171) +++ trunk/content/tomee-and-eclipse.mdtext (working copy) @@ -18,76 +18,116 @@ #TomEE and Eclipse: -Using TomEE in eclipse is pretty simple. There are no special plugins required. +Using TomEE in Eclipse is pretty simple since it uses the existing Tomcat 7 server adaptor that comes +with Eclipse. -The Tomcat 7 server adaptor would do just fine. But remember this little trick: +## Quick Start: -### Method1: +An excellent instructional video with step-by-step instructions on how to install Eclipse, TomEE +and create/deploy your first project is available on YouTube here: [Getting Started with Apache TomEE][1]. - 1. Download and install an Apache TomEE Web Profile server. +1. Download and install both Apache TomEE and Eclipse. - 2. In eclipse, click on the Servers tab, right click and select New->Server. +1. Start Eclipse and from the main menu go to File - New - Dynamic Web Project - 3. Select Apache->Tomcat v7.0 Server and click "Next >" +1. Enter a new project name - 4. Set the "Tomcat installation directory" to the location of your Apache TomEE Web Profile server installation. Click Next. +1. In the **Target Runtime** section click on the **New Runtime** button. - 5. Add your webapp to the server. Click "Finish". +1. Pick **Apache Tomcat v7.0** and click Next - 6. In the Servers tab, double click on your server to open up the "Overview" page. Click on the "modules" tab +1. Change the **Name** field to *TomEE* to indicate that this is a TomEE server rather than a Tomcat server. - 7. Choose the 'Use Tomcat installation' option as shown below: +1. Set the **Tomcat installation directory** by clicking the **Browse** button and selecting the folder +where you extracted TomEE + +1. Click **Finish** to return to the New Project dialog + +1. Click **Finish** to complete creating your new Project + +1. When you're ready to deploy your project, right-click your project and select Run As - Run On Server + +1. Make sure that the *TomEE* environment is selected in the **Server runtime environment** + +1. On the **Run on Server** dialog, click the **Always use this server when running this project** checkbox + +1. Click **Finish** - Eclipse will start TomEE and deploy your project + +## Advanced installation - -<img src="http://people.apache.org/~tveronezi/tomee_eclipse_trick.png" height="90%" width="80%"> +1. In Eclipse, click on the **Servers** tab, right click and select New - Server. -*Though this ensures that the tomee web-app is running, the other apps in your <tomcat>/webapps -are also started up and adds up to the start time* +1. Select **Apache - Tomcat v7.0 Server** and click **Next** -### Method 2: +1. Set the **Tomcat installation directory** by clicking the **Browse** button and selecting the folder +where you extracted TomEE - 1. Download and install an Apache TomEE Web Profile server. +1. Add your webapp to the server. Click **Finish**. - 2. In eclipse, click on the Servers tab, right click and select New->Server. +1. In the **Servers** tab, double click on your server to open up the **Overview** page. +Click on the **Modules** tab - 3. Select Apache->Tomcat v7.0 Server and click "Next >" +1. Click **Add External Web Module**. In the **Add Web Module** dialog, for document base, browse +to `<TomEE>/webapps/tomee`. Set **Path:** to `/tomee`. Uncheck **Auto reloading enabled**. Click OK. - 4. Set the "Tomcat installation directory" to the location of your Apache TomEE Web Profile server installation. Click Next. +1. Return to the **Overview** tab for the server. - 5. Add your webapp to the server. Click "Finish". +1. Deselect the **Modules auto reload by default** checkbox. - 6. In the Servers tab, double click on your server to open up the "Overview" page. Click on the "modules" tab +1. If you do not want Eclipse to take control of your TomEE installation, select **Use Workspace Metadata** +under **Server Locations**. Please review the *Workspace Metadata Installation* section below for additional steps +in this scenario. Otherwise, select **Use Tomcat Installation** - 7. Click "Add External Web Module". In the "Add Web Module" dialog, for document base, browse to <tomeeInstallDir>/webapps/tomee. Set Path: to "/tomee". Uncheck "Auto reloading enabled". Click OK. +1. Click the Save button in Eclipse so the server configuration gets saved. - 8. Click on the <your web app> module and click the "Edit..." button. Uncheck the "Auto reloading enabled" checkbox and click OK. Then click the save button in eclipse so the server configuration gets saved. +1. Click on your webapp project, then select Project - clean. Hit OK. This will cause +Eclipse to clean and rebuild - 9. In eclipse, click on your webapp project, then select "Project->clean". Hit OK. This will cause eclipse to clean and rebuild +1. In the **Servers** tab, right click on the server and select **Publish**. - 10. In the Servers tab, right click on the server and select "Publish". +1. Start the server. - 11. Start the server. - +### Workspace Metadata Installation +If you used **Use Workspace Metadata** in the **Server Locations** definition of the TomEE server, +you will have to add TomEE specific configuration files to your Servers project in your workspace +in case you need to change system properties or add containers / resources and have those reflected in the +server running under Eclipse. + +1. Locate your TomEE server configuration in Workspace / Servers + +1. Right-click the server project and select **Import** + +1. Select General - File System and click **Next** + +1. Browse to your `<TomEE>/conf` folder + +1. Select the following files for import: `logging.properties`, `system.properties` and `tomee.xml` + +1. Click **Finish** to import the files. + +1. In the **Servers** tab, right-click the TomEE server and select **Publish** to publish the files to the +Eclipse metadata folder + +If you need to modify system properties or change your TomEE resources, containers, etc., you now need to make +those changes in the Workspace / Servers / `<`Your Server`>` location and publish them to the server for +the changes to take effect. + +### JSP Hot Deployment + If jsp changes are not being hot deployed then this is because the jsp servlet is set to development=false in the web.xml file. To allow jsp hot deployment alter this value to true and restart Tomee. This is the relevant snippet of the web.xml file. - <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> + .... <init-param> - <param-name>fork</param-name> - <param-value>false</param-value> - </init-param> - <init-param> - <param-name>xpoweredBy</param-name> - <param-value>false</param-value> - </init-param> - <init-param> <param-name>development</param-name> - <param-value>*false*</param-value> + <param-value>true</param-value> </init-param> - <load-on-startup>3</load-on-startup> + .... </servlet> + + [1]: http://www.youtube.com/watch?v=Lr8pxEACVRI "Getting Started with Apache TomEE" \ No newline at end of file