为什么Maven不在我的jar中包含JSP文件? [英] Why doesn't maven include the JSP files in my jar?
问题描述
我有一个嵌入式的Jetty(版本8.1.8)Web应用程序,我将其打包为jar,并使用JSP作为其前端.它使用Maven版本3.0.3构建.问题是,当我执行以下操作: mvn package
时,它将包括除我的* .jsp文件之外的所有内容.我试图将它们迁移到许多不同的地方,但是没有运气.
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.
我试图将< include> src/main/java/**/*.jsp</include>
添加到 maven-compiler-plugin
我的pom部分.但这也没有效果.
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.
是否可以确定包含jsp文件?
Is there a way to be certain that jsp files get included?
推荐答案
我的解决方案是将jsp文件添加到src/main/webapp,并在pom文件中添加以下代码段:
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>
这篇关于为什么Maven不在我的jar中包含JSP文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!