ERROR RESOLVING

오류 Log4j - org.apache.log4j.Logger cannot be resolved to a type

Adev 2023. 2. 5. 00:01

 

해결

pom.xml의 log4j라이브러리 <scope> runtime을 주석처리 한다.

 

<dependency>

<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<!--  <scope>runtime</scope> -->

</dependency>

 


Maven Dependency Scope

: compile, provided, runtime, test, system, import의 6개 scope가 존재한다. 

: dependency의 이행을 제한하고 언제 classpath에 포함될지를 결정한다. 

 

  • runtime
    This scope indicates that the dependency is not required for compilation, but is for execution. Maven includes a dependency with this scope in the runtime and test classpaths, but not the compile classpath.

 

출처

Maven – Introduction to the Dependency Mechanism (apache.org)