klactose
klactose

Reputation: 1222

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?

Upvotes: 9

Views: 13070

Answers (2)

klactose
klactose

Reputation: 1222

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>

Upvotes: 17

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136162

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

Upvotes: 4

Related Questions