1

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 create 1 war file which is compatible with both jetty 6 and jetty 7?

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120

2 Answers2

2

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>
user981
  • 413
  • 2
  • 8
  • That would give me 2 wars for Jetty, I need 1. But I am afraid you're right that that's the only way. I 've added my maven way too. – Geoffrey De Smet Dec 22 '11 at 08:32
0

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.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120