2
votes

I have a standalone gwt project with RPC built with Maven. I also have java servlet 3.0 project. Both the servlet and gwt projects have war packaging but I want to have only one war file so I changed the packaging of the gwt project to jar and included it in my servlet project.

Now I have a problem understanding how to wire everything together.

Do I need to migrate gwt project's web.xml into the main project web.xml file ? How do I redirect to my gwt project entry index.html ?

Thanks.

1
the other way around seem more reasonable (including the servlet 3 project inside the GWT project as a jar / GWT module), have you tried it? - Eliran Malka
@EliranMalka I need to integrage my gwt project into an existing project. The existing project is the main one and is related to several other projects. Therefor I can't do what you've suggested - Michael
web.xml is optional at sevlet 3.0, so you can just introduce one to your project, of course conforming to servlet 3.0 DTD, and use it to describe the GWT RPC servlet. I think you don't need to do anything else for servlets in your 3.0 project, as annotations and deployment descriptors may co-exist and will be merged by container. - Kurtcebe Eroglu
@kurtcebe I can add the RPC servlet to the web.xml but i'm confused about how I redirect urls to my gwt landing html page. I'm relatively new to Java servlets and gwt. - Michael

1 Answers

0
votes

You can use uberwar packaging and cargo-maven2-plugin to merge two *.war

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.4</version>
            <extensions>true</extensions>
            <configuration>
                <descriptor>src/assemble/merge.xml</descriptor>
            </configuration>
        </plugin>
    </plugins>
</build>