gpt4 book ai didi

java - Dropwizard:无法解析配置:logging.appenders

转载 作者:行者123 更新时间:2023-11-30 06:14:18 25 4
gpt4 key购买 nike

当我使用“java -jar target\helloDropwizard-1.0-SNAPSHOT.jar server”运行基本的 Dropwizard.io (v0.8.1) 项目时,出现错误“无法解析配置:logging.appenders”。

完整错误信息:

Failed to parse configuration at: logging.appenders.[0]; 
Could not resolve type id 'console' into a subtype of [simple type, class io.dropwizard.logging.AppenderFactory]: known type ids = [AppenderFactory] at [Source: N/A; line: -1, column: -1] (through reference chain: io.dropwizard.
Configuration["logging"]->io.dropwizard.logging.LoggingFactory["appenders"]->java.util.ArrayList[0])

我的 pom.xml

<properties>
<dropwizard.version>0.8.1</dropwizard.version>
</properties>

<dependencies>

<!-- Dropwizard -->
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<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>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.hello.helloDropwizard.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

最佳答案

我需要将 ServiceResourceTransformer 添加到 shade-plugin 中。

<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.hello.helloDropwizard.App</mainClass>
</transformer>
<!-- SEE HERE!!!! -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<!-- -->
</transformers>
</configuration>
</execution>
</executions>

查看更多信息:

关于java - Dropwizard:无法解析配置:logging.appenders,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30542066/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com