Maven 插件构建但由于 java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory 无法执行

发布于 2024-12-26 00:39:33 字数 1063 浏览 3 评论 0原文

我在 pom.xml 中使用 maven-jspc-plugin。

当我尝试执行 jsp-compile 目标(执行插件)时,我得到:

Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory 
at org.apache.juli.logging.Slf4jLog.<init>(Slf4jLog.java:29) 
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:54)    
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:35) 
at org.apache.sling.scripting.jsp.jasper.compiler.OriginalTldLocationsCache.<init>(OriginalTldLocationsCache.java:81) 
at org.apache.sling.maven.jspc.JspcMojo.initServletContext(JspcMojo.java:426) 

我已经尝试下载 maven-jspc-plugin 的(开放)源代码,并且我能够轻松地“mvn install” - 我不知道没有遇到任何构建问题,但是当我在项目 pom 中使用该构建时,它仍然崩溃并告诉我它找不到 LoggerFactory。

我已经记录了 Apache Sling 项目的问题,但没有取得太大进展。 https://issues.apache.org/jira/browse/SLING-2350 此链接包含更多故障排除信息以及使用 Maven 插件的简单 Maven 项目。下载 jspc-test.zip 和“mvn install”将导致我提到的错误。

另外,我查看了 org.apache.juli pom.xml,它似乎根本没有列出任何依赖项。

任何关于如何解决的想法将不胜感激。

谢谢!

I am using the maven-jspc-plugin in my pom.xml.

When i try to execute the jsp-compile goal (which executes the plugin) I get:

Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory 
at org.apache.juli.logging.Slf4jLog.<init>(Slf4jLog.java:29) 
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:54)    
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:35) 
at org.apache.sling.scripting.jsp.jasper.compiler.OriginalTldLocationsCache.<init>(OriginalTldLocationsCache.java:81) 
at org.apache.sling.maven.jspc.JspcMojo.initServletContext(JspcMojo.java:426) 

I've tried downloading the (open) source for the maven-jspc-plugin and i am able to easily "mvn install" -- I don't get any build issues, however when i use that build in my project pom it still crashes and tells me it can't find LoggerFactory.

I've logged an issue with the Apache Sling project but am not making much headway.
https://issues.apache.org/jira/browse/SLING-2350
This link includes some more troubleshooting info as well as a simple maven project that uses the maven plugin. downloading the jspc-test.zip and "mvn install"ing will result in the error I've mentioned.

Also, i took a peak at the org.apache.juli pom.xml and it doesnt appear to list any dependencies at all.

Any thoughts on how to resolve would be appreciated.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪歌 2025-01-02 00:39:33

插件依赖项是在 POM 的不同部分中提供的:

<project>
    <dependencies>
         <!-- dependencies defined here don't get included for plugins -->
    ... 
    </dependencies>
    <build>
         <plugins>
              <plugin>
                .... jspc plugin section ....
                 <dependencies>
                      <dependency>  
                      <!-- Try adding slf4j here --->

尽管听起来如果它们的 POM 尚未指定 slf4j,则它是无效的。

Plugin dependencies are supplied in a different part of the POM:

<project>
    <dependencies>
         <!-- dependencies defined here don't get included for plugins -->
    ... 
    </dependencies>
    <build>
         <plugins>
              <plugin>
                .... jspc plugin section ....
                 <dependencies>
                      <dependency>  
                      <!-- Try adding slf4j here --->

Though it does sounds like their POM is invalid if it doesn't already specify slf4j.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文