You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Guillaume Boué (JIRA)" <ji...@apache.org> on 2016/08/24 20:49:20 UTC

[jira] [Commented] (MWAR-396) Check the existence of the web.xml based on the existence of particular classes

    [ https://issues.apache.org/jira/browse/MWAR-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15435653#comment-15435653 ] 

Guillaume Boué commented on MWAR-396:
-------------------------------------

It would be possible to check for the presence of [{{javax.servlet.annotation.WebServlet}}|http://docs.oracle.com/javaee/7/api/javax/servlet/annotation/WebServlet.html]. This annotation was introduced in the Servlet 3.0 API and replaces the {{<servlet>}} declaration in the {{web.xml}}. So if that class isn't in the compile classpath of the {{MavenProject}} being built, a {{web.xml}} should be present.

How about the possible solution? Call {{mavenProject.getCompileClasspathElements()}}, create a new {{URLClassLoader}} for the paths of that list and use this classloader to determine if that class can be loaded.

> Check the existence of the web.xml based on the existence of particular classes
> -------------------------------------------------------------------------------
>
>                 Key: MWAR-396
>                 URL: https://issues.apache.org/jira/browse/MWAR-396
>             Project: Maven WAR Plugin
>          Issue Type: New Feature
>    Affects Versions: 3.0.0
>            Reporter: Karl Heinz Marbaise
>             Fix For: 3.1.0
>
>
> Based on MWAR-262 we have changed the default to {{false}} but the existence of the {{web.xml}} should be checked based on the existence of particular classes? But which?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)