当前位置: 首页 > 知识库问答 >
问题:

找不到log4j jar父依赖项

太叔英锐
2023-03-14

我使用的是Maven 3.6.0,我有Spring Boot Maven项目,其pom文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>com.myapp</groupId>  
    <artifactId>myAppName</artifactId> 
    <version>1</version>
    <packaging>war</packaging>    

    <parent>   
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.6.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>   
    </properties>

    <dependencies>
    
       

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId> 
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-cache</artifactId>
        </dependency>

        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        
        

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-ldap</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.directory.server</groupId>
            <artifactId>apacheds-server-jndi</artifactId>
            <version>1.5.7</version>
        </dependency>
        
        
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>8.2.1.jre8</version>
        </dependency>
        
         
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.3.9</version>
        </dependency>
        
         
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>10.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>primefaces-extensions</artifactId>
            <version>10.0.0</version>
        </dependency>


        <dependency>
            <groupId>org.primefaces.extensions</groupId>
            <artifactId>resources-ckeditor</artifactId>
            <version>10.0.0</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.ocpsoft.rewrite</groupId>
            <artifactId>rewrite-servlet</artifactId>
            <version>3.4.4.Final</version>
        </dependency>

        <dependency>
            <groupId>org.ocpsoft.rewrite</groupId>
            <artifactId>rewrite-config-prettyfaces</artifactId>
            <version>3.4.4.Final</version>
        </dependency>
        
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.14</version>
        </dependency> 
            
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.5</version>
        </dependency>
                        
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.6</version>
        </dependency>
        
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.4</version>
        </dependency>
        
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.7</version>
        </dependency>
            
        
            
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.2</version>
        </dependency>
        
        
        <dependency>
          <groupId>org.primefaces</groupId> 
          <artifactId>california-theme</artifactId>
          <version>2.0.1</version>
        </dependency>
        
        <dependency>
          <groupId>SadadMC</groupId> 
          <artifactId>SadadMC</artifactId>
          <version>1.0</version>
        </dependency>
        
        <dependency>
          <groupId>Jace</groupId> 
          <artifactId>Jace</artifactId> 
          <version>5.2.1</version>
        </dependency>
        
        <dependency>
          <groupId>stax-api</groupId> 
          <artifactId>stax-api</artifactId> 
          <version>5.2.1</version>
        </dependency>
        
        <dependency>
          <groupId>xlxpScanner</groupId> 
          <artifactId>xlxpScanner</artifactId> 
          <version>5.2.1</version>
        </dependency>
        
        <dependency>
          <groupId>xlxpScannerUtils</groupId> 
          <artifactId>xlxpScannerUtils</artifactId> 
          <version>5.2.1</version>
        </dependency>
        
        
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>2.15.0</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.15.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.15.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
        </dependency>
        
        
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>
            
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.5</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.24.1</version>
        </dependency>
        
    </dependencies>
    
    <build>
        <finalName>myAppName</finalName>    
        <plugins>
            
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>          
               <configuration>
                  <argLine>-Dfile.encoding=UTF8</argLine>
                  <skipTests>true</skipTests>
               </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>${basedir}/src/main/java</directory>
                            <targetPath>WEB-INF/classes</targetPath>
                            <includes>
                                <include>**/*.properties</include>
                                <include>**/*.xml</include>
                                <include>**/*.css</include>
                                <include>**/*.html</include>
                            </includes>
                        </resource>
                        <resource>
                            <directory>${basedir}/lib</directory>
                            <targetPath>WEB-INF/lib</targetPath>
                            <includes>
                                <include>**/*.jar</include>
                            </includes>
                        </resource>
                    </webResources>
                    <!--  <outputDirectory>C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps</outputDirectory> -->
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

        </plugins>
         
    </build>
    
    

    <repositories>
    
       <repository>
            <id>java-net-repo</id>
            <url>https://maven.java.net/content/repositories/public/</url>
        </repository>
        
       <repository>
          <id>central</id>
          <name>Central Repository</name>
          <url>https://repo.maven.apache.org/maven2</url>
          <layout>default</layout>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        
        <repository>
            <id>itext-releases</id>
            <name>iText Repository - releases</name>
            <url>https://repo.itextsupport.com/releases</url>
          </repository>
        <repository>
            <id>Enonic</id>
            <name>Enonic</name>
            <url>https://repo.enonic.com/public/</url>
        </repository>
        <repository>
            <id>central-repo</id>
            <name>Central Repository</name>
            <url>http://insecure.repo1.maven.org/maven2</url>
        </repository>
        <repository>
            <id>org.jboss.repository.releases</id>       
            <name>JBoss Maven Release Repository</name>
            <url>http://repository.jboss.org/nexus/content/repositories/releases</url>
        </repository>
        <repository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/libs-release</url>  
        </repository>
        


    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>

</project>

出于某种原因,我在我的lib文件夹中发现了以下jarlog4j-1.2.14.jar.我想从我的最终战争中排除这个jar,所以我尝试了mvn依赖项:树,但我找不到父依赖项。

我还试图从Eclipse中打开依赖层次结构,但也找不到这个jar。我怎样才能排除这个罐子?

共有1个答案

顾斌
2023-03-14

具有提供范围的另一个依赖项的依赖项不会导致提供的依赖项位于类路径上。它可能存在是因为测试或构建需要它。

因此,您应该做的是检查您的最终部署单元(您自己的jar/war)并检查jar是否在lib目录中。如果是其他东西正在管理/包括该依赖项。(您可以使用mvn依赖项:tree来找出哪一个)。

有关Maven作用域的更多信息,请查看此项。本Spring介绍了如何将特定版本的Log4j2(当您使用它时)与Spring Boot结合使用。io博客帖子。

 类似资料:
  • 我正在使用本机库格式OCR,添加jar并将dll放入progfile\common文件中,尽管我遇到以下错误,请帮助我。。。。 ibrary.load不满意LinkError: C:\Program Files\Common Files:无法找到依赖库java.lang.ClassLoader$NativeLoader.load(Native Method)在oader.java:1751Clas

  • 我和我的朋友正在做一个Java maven项目,它的设置和我们从Git得到的项目是一样的。在我的设置中,Maven正确地导入了所有依赖项,但对于我的朋友,它找不到任何依赖项。 我们尝试过的事情: 右键单击project,单击maven并单击Reimport。 我们都可以上网,所以这也不是问题。而且,Maven在IntelliJ中设置为自动导入。

  • 当我从以下链接运行代码时,https://github.com/sagioto/lipreading/blob/master/lipreading-gui/src/main/java/edu/lipreading/gui/mainframe.java;我得到以下错误: 线程“Thread-6”java.lang.UnsatisfiedLinkError中出现异常:C:\users\harish r

  • 我最近安装了ImageMagick 6.3.9和JMagick 6.3.9。从这里通过和。 我在NetBeans中将添加到我的项目的库中,并将类路径设置为包含安装ImageMagick的文件夹(我还将放在其中)。 这就是我所做的一切。 然而,当我运行我的程序(它只声明一个并初始化它)时,我得到了以下错误: 为什么会这样,我该如何解决?

  • 我对Clojure和Leiningen是新来的。刚开始工作一个现有的项目。我拉了回购并执行了Lein运行的命令。它抱怨说: “在clojars中找不到项目arcType:service.jose:jar:0.1.0-快照(https://repo.clojars.org/)无法将项目arcType:service.jar:0.1.0-快照从/传输到enonic(https://repo.enoni