开发者

How do I create a jetty 6 and jetty 7 compatible jetty-web.xml file in the same war file?

In Jetty 6 I need to create a WEB-INF/jetty-web.xml file which contains this:

<Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">

But in Jetty 7 I need the same exact file WEB-INF/jetty-web.xml to contain this:

<Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">

Both files differ (org.mortbay vs org.eclipse). How do I crea开发者_开发知识库te 1 war file which is compatible with both jetty 6 and jetty 7?


I don't know if this can be done in one file, but you could use an ANT build script to create two version-specific WARs (my bad if you're already doing this)

Before calling the war build, have ANT copy your Jetty 6 or 7 WEB-INF/jetty-web.xml file in your war basedir and then call something like:

<target name="buildwar">
        <buildnumber />
    <war basedir="dist/web" destfile="${warName}-jetty${jettyVersion}.war"
     webxml="dist/WEB-INF/web.xml">         
        <webinf dir="dist/WEB-INF/">
            <include name="**/*.jar" />
        </webinf>
        <manifest>
            <attribute name="displayName" value="${warDisplayName} for Jetty ${jettyVersion}" />
            <attribute name="Implementation-Version" value="${build.number}" />            
        </manifest>         
    </war>
</target>


Poor man's solution: build 2 wars for Jetty.

I am thinking about using maven assembly scripts to build multiple wars, However, I need to completely duplicate the jetty-web.xml file for both versions in my sources.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜