我正在嘗試使用maven創建可執行jar。創建罐子,當我嘗試執行Java的罐子myjar這一我得到以下錯誤
引起的:在java.net.URLClassLoader的org.apache.hadoop.conf.Configuration :拋出java.lang.ClassNotFoundException $ 1.run(URLClassLoader.java:202)
我提取了jar,看到hadoop類不存在。並在日誌中我可以看到Hadoop的罐子不會被複制。哪裏出了問題
我的pom.xml如下:
<構建>
<插件>
<插件>
<groupId> org.apache.maven.plugins < /的groupId >
<的artifactId >行家編譯-插件</artifactId的>
<版本2.3.1 > < /版本>
<配置>
<源> 1.6 </source >
<target> 1.6 </tar得到>
< /配置>
< /插件>
<插件>
<的groupId > org.apache.maven.plugins < /的groupId >
<的artifactId >行家組裝-插件</artifactId的>
<版本> 2。2-β-4 < /版本>
<配置>
<descriptorRefs>
<descriptorRef>罐與 - 依賴性</descriptorRef >
</descriptorRefs >
<歸檔>
<清單>
<mainClass> com.MyClass </mainClass >
< /清單>
< /存檔>
< /配置>
<處決> <執行>
<相>包< /相位>
個<目標>
<目標>單< /目標>
< /兩球>
< /執行>
< /執行>
< /插件>
< /插件>
< /建>
<!-- Compile time dependencies -->
<dependency>
<groupId>bixo</groupId>
<artifactId>bixo-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-core</artifactId>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-11-jdbc</artifactId>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>org.archive</groupId>
<artifactId>heritrix</artifactId>
<version>1.14.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>args4j</artifactId>
<version>2.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.21.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jetty</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-util</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapred</artifactId>
<version>0.21.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>0.21.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- Eclipse project generation dependencies -->
<dependency>
<groupId>ant-eclipse</groupId>
<artifactId>ant-eclipse-jvm1.2</artifactId>
<version>1.0</version>
<scope>eclipse</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-core</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-test</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
`