虽然在本地运行良好,但无法从Jenkins执行脚本。通过命令行

时间:2018-04-11 21:36:15

标签: selenium jenkins

我无法从Jenkins运行脚本。如何从Command line&本地。我在办公室网络内。低于错误。我不明白Jenkins为什么要下载Maven插件?我是詹金斯的新手。任何建议都会受到鼓舞。

[INFO] ------------------------< Test:Junit-Demo >-------------------------
[INFO] Building Junit-Demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------

Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 21.695 s
    [INFO] Finished at: 2018-04-11T14:29:52-07:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.68.215] failed: Connection timed out: connect -> [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/PluginResolutionException
    Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding="UTF-8"
    Build step 'Execute Windows batch command' marked build as failure

    Finished: FAILURE

2 个答案:

答案 0 :(得分:1)

由Jenkins触发的Maven下载maven-clean-plugin作为其正常执行的一部分。这在第一次运行时在您的位置计算机上发生,然后缓存在~/.m2/

但是,您的Jenkins构建代理无法连接到maven下载工件的服务器:

  

连接到repo.maven.apache.org:443 [repo.maven.apache.org/151.101.68.215]失败:连接超时:连接

确保没有涉及阻止这些连接的防火墙或将Jenkins配置为使用本地工件存储库(如Nexus或Artifactory)。

答案 1 :(得分:0)

缺少一些信息以完全了解错误。

要在Jenkins中使用maven,您必须安装jenkins maven插件并在Jenkins文件中调用二进制文件。

您是否必须为本地设置进行任何maven配置?

即~~ .m2内部通常是您在settings.xml中为nexus凭据设置帐户的地方。

您必须在Jenkins用户帐户的〜/ .m2或maven插件文件夹内的jenkins机器上执行相同的配置。