Maven插件可以构建,但由于java.lang.NoClassDefFoundError而无法执行:org/slf4j/LoggerFactory [英] Maven plugin builds but can't execute due to java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

查看:1198
本文介绍了Maven插件可以构建,但由于java.lang.NoClassDefFoundError而无法执行:org/slf4j/LoggerFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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) 

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

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.

我已经记录了Apache Sling项目的问题,但是进展不大. https://issues.apache.org/jira/browse/SLING-2350 该链接包括更多故障排除信息以及使用maven插件的简单maven项目.下载jspc-test.zip并执行"mvn install"将导致我提到的错误.

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.

此外,我在org.apache.juli pom.xml达到了顶峰,它似乎根本没有列出任何依赖项.

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.

谢谢!

推荐答案

插件依赖关系在POM的不同部分中提供:

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 --->

尽管听起来确实好像他们的POM无效(如果尚未指定slf4j的话).

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

这篇关于Maven插件可以构建,但由于java.lang.NoClassDefFoundError而无法执行:org/slf4j/LoggerFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆