maven webapp将jsps放在/WEB-INF/jsp中 [英] maven webapp to place jsps in /WEB-INF/jsp
问题描述
我继承了使用NetBean的内部蚂蚁构建的webapp.
I have inherited a webapp built using NetBean's internal ant.
所有jsps都位于:
WEB-INF/jsp
并且web.xml具有到/WEB-INF/jsp/somefile.jsp的硬编码链接
And the web.xml has hardcoded links to /WEB-INF/jsp/somefile.jsp
如何使用Maven War插件将JSP放置在此处,并保持与当前结构的一致性?
How can I use the maven war plugin to place the JSP there, maintaining consistency with the current structure ?
我的pom当前显示为:
My pom currently reads:
<warSourceDirectory>${basedir}/web/WEB-INF</warSourceDirectory>
推荐答案
出了什么问题?让我们看一个标准的战争项目结构:
What the problem? Let's look at a standard war project structure:
$ mvn archetype:create -DgroupId=com.mycompany.app \
> -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
...
$ tree my-webapp/
my-webapp/
|-- pom.xml
`-- src
`-- main
|-- resources
`-- webapp
|-- WEB-INF
| `-- web.xml
`-- index.jsp
5 directories, 3 files
无需配置任何东西,只需将JSP放在src/main/webapp/WEB-INF/jsp
下,就可以了.
No need to configure anything, just put your JSPs under src/main/webapp/WEB-INF/jsp
and there you go.
编辑:我不明白为什么您的maven-war-plugin配置中包含以下行:
I don't understand why you have the following line in your maven-war-plugin configuration:
<warSourceDirectory>${basedir}/web/WEB-INF</warSourceDirectory>
预期的行为是什么?为什么不使用默认值${basedir}/src/main/webapp
?
What is the expected behavior? Why don't you use the default value ${basedir}/src/main/webapp
?
这篇关于maven webapp将jsps放在/WEB-INF/jsp中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!