對於Maven項目,我有以下(簡稱)pom.xml
。我添加了com.google.collections
依賴項,但是當我執行maven clean package
時,我在/target/classes
目錄中沒有看到此依賴關係的任何類。此外,當我執行JAR時,出現錯誤(java.lang.NoClassDefFoundError: com/google/common/collect/Iterables
)。我忘了什麼?Maven未安裝依賴關係
<project>
<groupId>edu.berkeley</groupId>
<artifactId>java-page-rank</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<modelVersion>4.0.0</modelVersion>
<name>PageRank</name>
<packaging>jar</packaging>
<version>1.0</version>
<dependencies>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.6.0</version>
</dependency>
<!-- http://mvnrepository.com/artifact/com.google.collections/google-collections -->
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
不要使用'谷歌collections':使用'guava'代替。這是一樣的,刪除了錯誤。 –