【发布时间】:2016-01-05 09:15:03
【问题描述】:
我在 Maven 中有一个正在运行的项目,Struts 2。我正在尝试添加 struts2-junit-plugin 进行测试。
所以我添加了struts2-junit的插件。
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>2.3.20</version>
</dependency>
运行后,我得到了这个错误:
java.lang.NoClassDefFoundError: javax/servlet/jsp/PageContext
然后我添加了jsp-api的插件。
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>prototype</scope>
</dependency>
当我运行它时,我得到了一个不同的错误:
java.io.FileNotFoundException: class path resource [WEB-INF/content/] cannot be resolved to URL because it does not exist
我尝试对我的struts.xml 进行以下更改:
<constant name="struts.convention.result.path" value="/src/main/webapp/WEB-INF"
但它也没有工作。
当我从我的 pom 文件中删除 struts2-convention-plugin 时,它可以工作。
但我需要 struts2-convention-plugin。谁能告诉我这里有什么问题?
【问题讨论】:
标签: java maven jakarta-ee junit struts2