Eclipse + Tomcat - Serve webapp directly from workspace

后端 未结 9 678
旧时难觅i
旧时难觅i 2021-02-04 10:13

What is the ideal way to configure Tomcat to serve directly from my project\'s directory inside of my workspace? (related)

I want my static web resources

9条回答
  •  误落风尘
    2021-02-04 10:57

    I am pretty sure that Maven can do this kind of stuff. Maybe there are even Archetypes for Tomcat which have this kind of behaviour already configured.

    I am using a Maven Archetype together with JBoss AS. When I change my .css or .xhtml file or any other static resources and save it in Eclipse, the resources are immediatally synchronzied with my deployment.

    Edit:

    Here is a quick tutorial for my solution:

    What I am using:

    • JBoss AS 7.1.1
    • Eclipse Juno for Java EE developers

    Older or newer versions should also do the work.

    1. Install JBoss Tools Plug-In over the Eclipse Marketplace in Eclipse IDE
      This will install several Plug-Ins to your IDE, like the JBoss AS Server Connector or Maven.
    2. Add JBoss Repositories to your Maven configuration
      Window -> Preferences -> Maven -> User Settings -> open file
      Add the repositories from JBoss Maven Getting started
    3. Add a JBoss Server Runtime
      Window -> Preferences -> Servers -> Runtime Environments
      Follow the Wizard, pretty standard
    4. Add a Serverinstance from the Eclipse Servers Tab
    5. Create a new Maven Project
      Take care that the checkbox Create a simple project(skip archetype) is NOT checked
      Choose the Archetype jboss-javaee6-webapp-blank-archetype 7.1.3.CR7

    Archetype

    Now your Project is ready to go:)

提交回复
热议问题