我有一個(看似)簡單的maven問題,我無法解決。在我的POM我指定的依賴於openrdf芝麻這樣的:Maven編譯:包不存在
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime</artifactId>
<version>2.7.2</version>
</dependency>
運行Eclipse中的項目運作良好,我甚至可以導出一個可運行jar文件。 不幸的是,我不能通過cmd-line maven使它正常工作。 要建立一個罐子,我已經添加了以下到我的POM:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>foo.bar.Cli</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
編譯失敗,出現以下錯誤:當我編譯插件添加到POM
.../PLDReducer.java:[25,29] package org.openrdf.rio.rdfxml does not exist
.../PLDReducer.java:[27,33] package org.openrdf.sail.nativerdf does not exist
.../LowPLDReducer.java:[25,29] package org.openrdf.rio.rdfxml does not exist
.../Cli.java:[23,33] package org.openrdf.sail.nativerdf does not exist
.../SchemaBuilder.java:[30,33] package org.openrdf.sail.nativerdf does not exist
.../RepoQuerier.java:[23,33] package org.openrdf.sail.nativerdf does not exist
.../PLDReducer.java:[78,44] cannot find symbol
奇怪的是,並更新項目設置,eclipse似乎不能編譯。我檢查了我的存儲庫,並且所有的芝麻文件都在那裏。
MVN --version給出了這樣的輸出:
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.6.0_27
Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "3.8.0-25-generic" arch: "amd64" Family: "unix"
我看,它似乎指向一個JRE,但我的谷歌搜索表明,我會看到另一個錯誤,如果編譯器本身沒有被發現。 我有pasted the complete POM here,如果它有任何幫助。
有什麼我失蹤?我在我的POM中找不到任何錯誤。
你可以顯示'mvn clean package'的完整輸出嗎? – khmarbaise
[這裏有-e開關](http://pastebin.com/zg24L8rS)和 [這裏帶有-X開關](http://pastebin.com/A5G613LL) – feob
看起來你正在使用包名(presumbly在你的導入部分)哪些不存在。你真的需要thoose包嗎?使用它的類?用IDE清理導入部分(如Eclipse?)?你能展示一個像PLDReducer.java這樣的源代碼文件嗎? – khmarbaise