手动依赖Maven和Jenkins

时间:2017-02-22 13:29:07

标签: maven jenkins

我在Jenkins中创建了一个Job,在Maven中有一些目标(clean verify compile)。 但是,当我运行Job时出现错误:



table= '<table>';
for(i=1;i<=arr.length;i++) {
    table= '<tr>';
                if(arr[i]==undefined)
                    {
                    table += '</tr>';
                    break;
                    }
                else {
                    table+='<td>'+arr[i]+'</td>';
                    //document.write(arr[i] + ' ');
                }
                if(i%3 == 0) {
                    table += '</tr>';
                    //document.write('<br />');
                }
}
table += '</table>';
document.write(table);
&#13;
&#13;
&#13;

我在Maven中创建了手动依赖

&#13;
&#13;
[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
&#13;
&#13;
&#13;

,但Jenkins并不知道pom中的这种依赖性。 当我在Maven中执行验证编译时,它可以工作!但是当我在Jenkins中执行时,它不起作用。

2 个答案:

答案 0 :(得分:0)

如果要将其安装到本地存储库中,则需要将其安装到Jenkins服务器使用的本地存储库中,即。你需要在Jenkins服务器上启动mvn install。

如果您有公司的Nexus服务器,最好在那里安装它。

答案 1 :(得分:0)

have changed默认的本地存储库Maven

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

My Maven diretory在另一个驱动器(E:/)中,当存储库在(C :)中时。