Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't maven include the JSP files in my jar?

I have an embedded jetty (version 8.1.8) web app I am packaging as a jar and which uses JSP for its frontend. It is built with maven version 3.0.3. The problem is that when I do: mvn package it is including everything except my *.jsp files. I've tried to relocate them many different places but no luck.

I've tried to add <include>src/main/java/**/*.jsp</include> to the maven-compiler-plugin section of my pom. But that had no effect either.

Is there a way to be certain that jsp files get included?

like image 578
klactose Avatar asked Mar 28 '13 04:03

klactose


2 Answers

My solution was to add the jsp files to src/main/webapp and to add the following snippet in the pom file:

<build>
    <resources>
      ...
      <resource>
        <directory>src/main/webapp</directory>
      </resource>
      ...
    </resources>
    ...
</build>
like image 181
klactose Avatar answered Nov 12 '22 04:11

klactose


Try to place .jsp into src/main/resources, Maven ignores all but .java files in src/main/java

like image 35
Evgeniy Dorofeev Avatar answered Nov 12 '22 05:11

Evgeniy Dorofeev