2013-04-02 47 views
1

我是maven環境的新手。在我的項目中,我需要使用我在本地安裝的外部jar,但構建編譯maven仍然搜索intranet repo並且無法構建編譯。在日誌中,我可以看到它在做make時安裝了外部jar,但是在編譯時(或者可能是當涉及到項目pom並找到依賴項時),它會嘗試從intranet repo再次下載相同的jar並失敗。在maven中本地安裝的jar,但maven仍然在jar中搜索intranet repo

這裏是我使用生成文件在本地安裝的jar命令,

$(MVNBLD) install:install-file -Dfile=jarName.jar -DgroupId=com.example.project -DartifactId=jarName -Dversion=1.0 -Dpackaging=jar -Dgenerate`enter code here`Pom=true -gs settings.xml 

有沒有辦法迫使行家尋找到本地回購而不是去網上。

============

我試着在Maven: add a dependency to a jar by relative path定解決方案....而不是至少我不是對着罈子下載問題。但它仍然沒有編譯與以下錯誤的版本,

Exception in thread "main" java.lang.NoClassDefFoundError: '-Xmx1024m 
Caused by: java.lang.ClassNotFoundException: '-Xmx1024m 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
Could not find the main class: '-Xmx1024m. Program will`enter code here` exit. 
make: *** [prod_jar] Error 1 
Command finished (error code: 2) 

它仍然沒有找到依賴jar嗎?

+1

發佈錯誤日誌+安裝日誌可能會有所幫助。 – ben75

+0

我試過在http://stackoverflow.com/questions/2229757/maven-add-a-dependency-to-a-jar-by-relative-path給出的解決方案....並沒有至少我沒有面對罐子下載問題。但它仍然無法編譯與以下錯誤, –

回答

3

Exception in thread "main" java.lang.NoClassDefFoundError: '-Xmx1024m

這意味着您的MAVEN_OPTS環境變量定義錯誤。檢查你是否有'角色在那裏並刪除。

+0

生成非常感謝幫助。有效。 –

相關問題