Skip to content

vpro/magnolia-jetty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

magnolia-jetty

Build Status Maven Central snapshots

Class loader for jetty. We use this to run magnolia via mvn jetty:run.

There is no actual dependency on magnolia, this may be generalized to something like 'jetty-classloader'

Create a Contex.xml for jetty with something like this:

Context.xml
<Configure id="context" class="org.eclipse.jetty.webapp.WebAppContext">

  <Set name="classLoader">
    <New class="nl.vpro.jetty.MagnoliaWebAppClassLoader">
      <Arg>
        <Ref id="context"/>
      </Arg>
     <!-- Which jars need to be touched in case some change in resources is detected.
          Usefull when adding decorations
      -->
      <Set name="touchJars">^magnolia(?!\-lang).*$</Set>
    </New>
  </Set>

</Configure>

And configure the jetty plugin something like so:

pom.xml
....
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <configuration>
          <systemProperties>
          </systemProperties>
          <scanIntervalSeconds>0</scanIntervalSeconds>
          <httpConnector>
            <port>${public.port}</port>
          </httpConnector>
          <webAppConfig>
            <contextPath>/${public.context}</contextPath>
            <descriptor>${project.build.directory}/jetty-webxmls/web-public.xml</descriptor>
          </webAppConfig>
          <contextXml>${basedir}/Context.xml</contextXml>
          <jettyXml>${basedir}/jetty.xml,${basedir}/jetty-ssl-context.xml,${basedir}/jetty-ssl.xml</jettyXml>
        </configuration>