2015-05-30 11 views
2

У меня возникла ошибка «Не удалось проанализировать конфигурацию по адресу: logging.appenders», когда я запускал базовый проект Dropwizard.io (v0.8.1), используя «java -jar target \ helloDropwizard-1.0-SNAPSHOT.jar server ".Dropwizard: Не удалось проанализировать конфигурацию по адресу: 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> 

ответ

4

мне нужно добавить ServiceResourceTransformer в тень-плагин.

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

Смотреть подробнее в:

+0

Я столкнулся с аналогичной проблемой, но я не использую тени плагин в моем pom.xml, я могу это исправить без использования плагина ?? – user2098324