簡體   English   中英

Java-無法在Eclipse的項目瀏覽器中使用log4j

[英]java - can't use log4j in project explorer of eclipse

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM