Search code examples
javamavenjakarta-eejunitstruts2

Why struts2-junit plugin complains about convention plugin in?


I have a running project in Maven, Struts 2. I'm trying to add struts2-junit-plugin for testing.

So I added the plugin for struts2-junit.

<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-junit-plugin</artifactId>
    <version>2.3.20</version>
</dependency>

After I run, I got this error:

java.lang.NoClassDefFoundError: javax/servlet/jsp/PageContext

Then I added the plugin for jsp-api.

<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.2</version>
    <scope>prototype</scope>
</dependency>

When I ran it, I got a different error:

java.io.FileNotFoundException: class path resource [WEB-INF/content/] cannot be resolved to URL because it does not exist

I tried to do the following change to my struts.xml:

<constant name="struts.convention.result.path" value="/src/main/webapp/WEB-INF"

But it also did not work.

When I remove the struts2-convention-plugin from my pom file, it works.

But I need the struts2-convention-plugin. Can any one tell that what is the problem here?


Solution

  • I got solution with help of one of my friend, I did not use this line <constant name="struts.convention.result.path" value="/src/main/webapp/WEB-INF" in struts.xml....

    but i created folder structure WEB_INF/content/user-actions inside src/main/resources and it worked.