You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2020/06/04 16:35:45 UTC
[maven-war-plugin] 04/04: [MWAR-430] Check for Jakarta annotation
as well
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch pzygielo-mwar-430
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git
commit fcb57d57d036e2582515cf7487022c276c82cd7c
Author: Piotrek Żygieło <pz...@users.noreply.github.com>
AuthorDate: Thu Jun 4 18:18:54 2020 +0200
[MWAR-430] Check for Jakarta annotation as well
---
src/main/java/org/apache/maven/plugins/war/WarMojo.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/war/WarMojo.java b/src/main/java/org/apache/maven/plugins/war/WarMojo.java
index e731a39..0df35ef 100644
--- a/src/main/java/org/apache/maven/plugins/war/WarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/war/WarMojo.java
@@ -301,13 +301,16 @@ public class WarMojo
}
/**
- * Determines if the current Maven project being built uses the Servlet 3.0 API (JSR 315). If it does then the
- * <code>web.xml</code> file can be omitted.
+ * Determines if the current Maven project being built uses the Servlet 3.0 API (JSR 315)
+ * or Jakarta Servlet API.
+ * If it does then the <code>web.xml</code> file can be omitted.
* <p>
- * This is done by checking if the interface <code>javax.servlet.annotation.WebServlet</code> is in the compile-time
+ * This is done by checking if the interface <code>javax.servlet.annotation.WebServlet</code>
+ * or <code>jakarta.servlet.annotation.WebServlet</code> is in the compile-time
* dependencies (which includes provided dependencies) of the Maven project.
*
- * @return <code>true</code> if the project being built depends on Servlet 3.0 API, <code>false</code> otherwise.
+ * @return <code>true</code> if the project being built depends on Servlet 3.0 API or Jakarta Servlet API,
+ * <code>false</code> otherwise.
* @throws DependencyResolutionRequiredException if the compile elements can't be resolved.
* @throws MalformedURLException if the path to a dependency file can't be transformed to a URL.
*/
@@ -327,7 +330,8 @@ public class WarMojo
private static boolean hasWebServletAnnotationClassInClasspath( ClassLoader loader )
{
- return hasClassInClasspath( loader, "javax.servlet.annotation.WebServlet" );
+ return hasClassInClasspath( loader, "javax.servlet.annotation.WebServlet" )
+ || hasClassInClasspath( loader, "jakarta.servlet.annotation.WebServlet" );
}
private static boolean hasClassInClasspath( ClassLoader loader, String clazz )