java - java - 不能在eclipse的项目资源管理器中使用log4j
问题描述
我将 eclipse 版本更新为 4.9.0
我的项目在 maven 中使用了 log4j 库。
但是 Maven 构建引发错误,该错误会阻止 Eclipse 项目资源管理器中的 Maven 依赖项。
请教我如何解决这个问题。
谢谢。
[截图] https://i.stack.imgur.com/8MjfC.jpg
我在 pom.xml 中使用了下面的代码
<org.slf4j-version>1.7.5</org.slf4j-version>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
解决方案
我将 Eclipse 版本移至 Neon 4.6.3。
所以我将显示的块解析为log4j。
但在下面引发错误:
请问这个错误怎么解决,
谢谢回复。
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.joins::war:1.0.0-BUILD-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.mybatis:mybatis:jar -> duplicate declaration of version 3.2.2 @ line 249, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ---
[INFO] Deleting joongangClickCountDashboard\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 188 source files to D:\sean-workspace-neon\ClickCountDashboard\target\classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] ClickCountDashboard/src/main/java/com/joins/innovation/campaign/excel/InnovationCampaignDataExcelBuilder.java:[10,17] jxl.write.Font in jxl.write has been deprecated
[WARNING] ClickCountDashboard/src/main/java/com/joins//facebook/service/impl/FacebookServiceImpl.java:[56,104] unchecked cast
required: java.util.HashMap<java.lang.String,org.bson.Document>
found: java.lang.Object
[WARNING] ClickCountDashboard/src/main/java/com/joins//facebook/service/impl/FacebookServiceImpl.java:[57,130] unchecked cast
required: java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Integer>>
found: java.lang.Object
[WARNING] ClickCountDashboard/src/main/java/com/joins//common/db/MongoDBConnectionManager.java:[199,17] found raw type: java.util.List
missing type arguments for generic class java.util.List<E>
[WARNING] ClickCountDashboard/src/main/java/com/joins//common/db/MongoDBConnectionManager.java:[201,126] unchecked method invocation: method aggregate in interface com.mongodb.client.MongoCollection is applied to given types
required: java.util.List<? extends org.bson.conversions.Bson>
我在下面的maven中有设置
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
推荐阅读
- flutter - 无法在颤动中解析配置“:classpath”的所有工件
- .net - 如何在 IIS 2016 中将多个 SSL 连接到多个站点
- react-hooks - “react-hooks/exhaustive-deps”:eslint-plugin-react-hooks 的“警告”太敏感了?
- java - 如何隐藏和取消隐藏导航项单击的视图?
- java - java.net.ConnectException:连接被拒绝:在 java.net.PlainSocketImpl.socketConnect(本机方法)处连接
- flutter - 颤振:google_mobile_ads 酒吧。如何实现 GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth & GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth?
- c# - C# 静态方法是否同步和锁定?
- visual-studio - 查找 Visual Studio PATH/LIB 文件的问题
- python - 并行处理没有提高效率?
- android - 如何在 Jetpack compose 中制作 FlipCard 动画