Using jetty:run with multiple webapp directories?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using jetty:run with multiple webapp directories?

Francesco Vivoli
Hi all

We've been happily using the maven jetty plugin for quite some time now.
Recently we've added Jasper reports to the webapp

We are managing to compile them through maven, and to have them working
when assembling a full war (using jetty:run-war or deploying the war externally works).

What I can't sort out is how to have also jetty:run to pick the reports.
My objective is to have the compiled reports be accessible from the Servlet
context as "/reports/AnyReport.jasper".

With the above setup (assembling a war) I can access succesfully the
following directory
localhost:8080/app-context/reports/

Instead when using jetty:run the above URL gives a 404, and when trying
to generate the report I get the following:

org.springframework.context.ApplicationContextException: Could not load JasperReports report for URL [/reports/ScanReport.jasper]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/reports/ScanReport.jasper]

I've setup my pom so that the jasper plugins is as follows


            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jasperreports-maven-plugin</artifactId>
                <configuration>
                    <outputDirectory>${project.build.directory}/reports</outputDirectory>
                    <sourceDirectory>src/main/reports</sourceDirectory>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile-reports</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

The war plugin is configured so that
<webResources>
 <resource>
  <directory>${project.build.directory}/reports/</directory>
  <targetPath>reports</targetPath>
 </resource>
</webResources>

While the jetty plugin is like the following

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.6</version>
                <configuration>

                    <scanIntervalSeconds>5</scanIntervalSeconds>
                    <scanTargets>

                        <scanTarget>src/main/resources</scanTarget>
                        <scanTarget>src/main/webapp</scanTarget>
                       
                    </scanTargets>
                </configuration>
...
</plugin>

As you can note I have also tried adding a further scan target,
${project.build.directory}/other

and having the jasper plugin compile reports under <outputDirectory>${project.build.directory}/other/reports</outputDirectory>

but the result is the same.

Does somebody have an idea of what I could do? After almost an year
of happy jetty:run I'm not really keen on letting it go

Thanks a lot, cheers
Francesco