Maven Dependency "not found"
已回答
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-configuration2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.11</version>
</dependency>
What the heck is wrong?
请先登录再写评论。
Hello, Donpwinston. In the link you shared, I see that the correct dependency version should be
2.11.0
; please try to change it in yourpom.xml
.Ok. I figured out I have to reload Maven periodically and these flagged dependency “not found” errors clear up. I do not think it should be necessary to do that.
But another problem I have is that IntelliJ is validating my logback.xml and telling me the level attribute of the root element is not allowed and wants me to use a level element instead. This has been deprecated in the most recent versions of logback for a while now. The <root level="debug"> is indeed the proper way to specify a level in the logback.xml file. How do I get IntelliJ to use the proper xml schema? I do not see a schema for logback anywhere. Logback's documentation doesn't mention a schema or DTD. I don't see how to turn it off in IntelliJ via the inspection settings.
Satch Are you referring to
section of the
logback.xml
?I've tested this in my environment and IDEA does not seem to report any issues with this configuration.
Could you please let me know which version of
logback
and IDEA you're using and share yourlogback.xml
file along with a screenshot showing the error message?IDEA: IntelliJ IDEA 2024.3 EAP (Ultimate Edition)
logback: 1.5.10
Satch Thank you for sharing the details!
I've replicated your setup as shown on the screenshot with the same versions of
logback
and IDEA, but the error message does not come up in my environment.Would you be able to share the affected Project or the
logback-test.xml
file from it for further investigation?Which options does it give you under “
More actions…
” link?More actions… shows “Convert attribute to child tag” and “remove attribute”, and use AI.
The child tag <level> is deprecated.
Here's my logback.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date %5level [%file:%line] - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>mail.log</file> <!-- Specify the file name here -->
<encoder>
<pattern>%date %5level [%file:%line] - %msg%n</pattern>
</encoder>
<append>true</append>
</appender>
<root level="info">
<appender-ref ref="FILE"/>
</root>
</configuration>
I'm using a Mac if that matters. Maybe it is picking up and old version of logback in my .m2 directory? I'll try deleting them.
I can do this to avoid the issue:
Hi Satch , I've created an issue for this: https://youtrack.jetbrains.com/issue/IJPL-164814/False-positive-on-log4j.xml-with-DOCTYPE-configuration
Please check if it covers all the points here. Feel free to vote and watch the YouTrack item to be notified when it has updates. If you need to become more familiar with YouTrack, see [this article](https://intellij-support.jetbrains.com/hc/articles/207241135).