2017-02-22 124 views
0

我在Jenkins中創建了一個Job,並在Maven中進行了一些目標(clean verify compile)。 但是,當我運行的作業有錯誤:手動依賴Maven和Jenkins

[ERROR] Failed to execute goal on project NameProject: Could not resolve dependencies for project NameProject:x:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.oracle:ojdbc14:jar:10.2.0.5, org.primefaces.themes:sentinel-theme:jar:2.1.2: Could not find artifact com.oracle:ojdbc14:jar:10.2.0.5 in central (https://repo.maven.apache.org/maven2) -> [Help 1] 
 
[ERROR] 
 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
 
[ERROR] 
 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

我在Maven的

mvn install:install-file 
 
    -Dfile=<path-to-file> 
 
    -DgroupId=<group-id> 
 
    -DartifactId=<artifact-id> 
 
    -Dversion=<version> 
 
    -Dpackaging=<packaging> 
 
    -DgeneratePom=true

創造人工的依賴,但是詹金斯沒有按」在pom中知道這種依賴關係。 當我在Maven中執行驗證編譯它是有效的,但是當我在Jenkins中執行時不起作用。

+0

您是否將其安裝在Jenkins服務器上? –

+0

我已經在本地主機上安裝Jenkins來測試!同樣的本地Maven。 – Halley

+0

同一個用戶,還是不同? –

回答

0

如果要將其安裝到本地存儲庫中,則需要將其安裝到Jenkins服務器使用的本地存儲庫中,即,您需要在Jenkins服務器上啓動mvn安裝。

如果你有一家公司的Nexus服務器,最好在那裏安裝它。

0

have changed默認的本地倉庫的Maven

<localRepository>C:/Users/nameUser/.m2/repository</localRepository>

我的Maven diretory是在另一個驅動器(E:/),當存儲庫(C :)。