2

Say I have a simple j2EE ear:

foo.ear
- foo.war

I would like to deploy the same ear twice so I rename the ear:

bar.ear
- foo.war

The META-INF\application.xml file looks like this:

<application>
    <module>
        <web>
            <web-uri>foo.war</web-uri>
            <context-root>/baz</context-root>
        </web>
    </module>
</application>

When I deploy there is a collison, both apps will try to mount at http://localhost:8080/baz. Is there a way to prefix the ear name to the context-root to get foo/baz and bar/baz?

4

1 回答 1

3

如何在构建时通过生成application.xml来设置它?Ant 可以通过过滤器轻松做到这一点,在

<context-root>@context.root@</context-root>

在 Ant 构建脚本中,执行以下操作:

<copy todir="${ear.dir}/META-INF" file="${ear}/META-INF/application.xml" overwrite="true">
    <filterset>
        <filter token="context.root" value="${context.root}" />
    </filterset>
</copy>
于 2008-10-23T14:42:56.573 回答