我有一个maven项目,它使用slf4j和logback作为记录器.我可以看到这两个工件都在我的maven依赖项树项目中.但每当我尝试运行我的项目时,我都会提示:
SLF4J:无法加载类"org.slf4j.impl.StaticLoggerBinder".SLF4J:默认为无操作(NOP)记录器实现SLF4J:有关更多详细信息,请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder.
我检查链接,有人说:
在类路径上放置一个(并且只有一个)slf4j-nop.jar,slf4j-simple.jar,slf4j-log4j12.jar,slf4j-jdk14.jar或logback-classic.jar应该可以解决问题.
我已经将logback-classic添加到我的项目中(我使用的是1.0.9),但我仍然提示该消息并且我的日志没有运行.
任何人都可以帮我解决这个问题吗?谢谢.
更新:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.employee.scheduler</groupId>
<artifactId>rostering</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>nurserostering</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- or whatever version you use -->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!-- Needed for runExamples.sh and runExamples.bat -->
<addClasspath>true</addClasspath>
<classpathPrefix>../../binaries/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<classpathScope>runtime</classpathScope>
<arguments>
<argument>-Xms256m</argument>
<argument>-Xmx1024m</argument>
<argument>-server</argument>
<argument>-cp</argument>
<classpath />
<argument>com.employee.scheduler.nurserostering.app.NurseRosteringApp</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId> …Run Code Online (Sandbox Code Playgroud) 我只是对我的Eclipse项目感到困惑,Java代码文件看起来像这样奇怪:

它应该看起来像这样:

有谁知道那些java文件有什么区别?我该如何解决这个问题?谢谢并恭祝安康。