2017-02-22 123 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 :)。