2012-10-30 116 views
3

我試圖使用ServicesResourceTransformer對付我快到時,我建立一個fatjar(docoumented here)的一些問題用ServicesResourceTransformer的時候,但我得到一個ClassNotFound的當Maven嘗試使用它:ClassNotFound的Maven中

ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.apache.maven.plugins.shade.resource.ServicesResourceTransfor‌​mer' cannot be loaded 

我的全pom.xml的是:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>embedly.reverb</groupId> 
<artifactId>reverb</artifactId> 
<packaging>jar</packaging> 
<version>1.0-SNAPSHOT</version> 
<name>reverb</name> 
<url>http://maven.apache.org</url> 
<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-bundle</artifactId> 
     <version>1.14</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey</groupId> 
     <artifactId>jersey-grizzly2</artifactId> 
     <version>1.14</version> 
    </dependency> 

    <dependency> 
     <groupId>com.sun.grizzly</groupId> 
     <artifactId>grizzly-servlet-webserver</artifactId> 
     <version>1.9.18-i</version> 
    </dependency> 
    <dependency> 
     <groupId>com.sun.jersey.jersey-test-framework</groupId> 
     <artifactId>jersey-test-framework-grizzly</artifactId> 
     <version>1.4</version> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <inherited>true</inherited> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-shade-plugin</artifactId> 
      <version>1.5</version> 
      <configuration> 
       <transformers> 
        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> 
        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
         <manifestEntries> 
          <Main-Class>Main</Main-Class> 
          <Build-Number>1</Build-Number> 
         </manifestEntries> 
        </transformer> 
       </transformers> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>shade</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

請讓我知道如果有更多信息將是有益的;這個Java thang對我來說是新的。

+0

請發佈完整的pom.xml – Curt

+0

剛剛添加,謝謝。 – John

回答

1

試用2.0的插件。看起來這個班最近才推出。

+0

非常好,非常感謝。 – John

+1

確保org.apache.maven.plugins.shade.resource.ServicesResourceTransformer在其中沒有無效字符,因爲如果您的郵件包含「??」在這個包名的某處,這可能是 –

+0

現貨,@WolfgangFahl,謝謝! – Cacovsky