gradle 编译 azkaban 出错

主要出错信息:

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.cinnober.gradle:semver-git:2.2.3.
     Required by:
         project :
      > Could not resolve com.cinnober.gradle:semver-git:2.2.3.
         > Could not get resource 'https://plugins.gradle.org/m2/com/cinnober/gradle/semver-git/2.2.3/semver-git-2.2.3.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/com/cinnober/gradle/semver-git/2.2.3/semver-git-2.2.3.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve com.cinnober.gradle:semver-git:2.2.3.
         > Could not get resource 'https://repo.maven.apache.org/maven2/com/cinnober/gradle/semver-git/2.2.3/semver-git-2.2.3.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/com/cinnober/gradle/semver-git/2.2.3/semver-git-2.2.3.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve com.cinnober.gradle:semver-git:2.2.3.
         > Could not get resource 'https://plugins.gradle.org/m2/com/cinnober/gradle/semver-git/2.2.3/semver-git-2.2.3.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/com/cinnober/gradle/semver-git/2.2.3/semver-git-2.2.3.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.apache.httpcomponents:httpmime:4.3.
     Required by:
         project : > com.github.kt3k.coveralls:com.github.kt3k.coveralls.gradle.plugin:2.6.3 > org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3
      > Could not resolve org.apache.httpcomponents:httpmime:4.3.
         > Could not get resource 'https://plugins.gradle.org/m2/org/apache/httpcomponents/httpmime/4.3/httpmime-4.3.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/apache/httpcomponents/httpmime/4.3/httpmime-4.3.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.apache.httpcomponents:httpmime:4.3.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpmime/4.3/httpmime-4.3.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpmime/4.3/httpmime-4.3.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.apache.httpcomponents:httpmime:4.3.
         > Could not get resource 'https://plugins.gradle.org/m2/org/apache/httpcomponents/httpmime/4.3/httpmime-4.3.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/apache/httpcomponents/httpmime/4.3/httpmime-4.3.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.eclipse.jgit:org.eclipse.jgit:3.6.0.201412230720-r.
     Required by:
         project : > com.github.kt3k.coveralls:com.github.kt3k.coveralls.gradle.plugin:2.6.3 > org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3
      > Could not resolve org.eclipse.jgit:org.eclipse.jgit:3.6.0.201412230720-r.
         > Could not get resource 'https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit/3.6.0.201412230720-r/org.eclipse.jgit-3.6.0.201412230720-r.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit/3.6.0.201412230720-r/org.eclipse.jgit-3.6.0.201412230720-r.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.eclipse.jgit:org.eclipse.jgit:3.6.0.201412230720-r.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/eclipse/jgit/org.eclipse.jgit/3.6.0.201412230720-r/org.eclipse.jgit-3.6.0.201412230720-r.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/eclipse/jgit/org.eclipse.jgit/3.6.0.201412230720-r/org.eclipse.jgit-3.6.0.201412230720-r.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.eclipse.jgit:org.eclipse.jgit:3.6.0.201412230720-r.
         > Could not get resource 'https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit/3.6.0.201412230720-r/org.eclipse.jgit-3.6.0.201412230720-r.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/eclipse/jgit/org.eclipse.jgit/3.6.0.201412230720-r/org.eclipse.jgit-3.6.0.201412230720-r.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve org.codehaus.groovy.modules.http-builder:http-builder:0.7.1.
     Required by:
         project : > com.github.kt3k.coveralls:com.github.kt3k.coveralls.gradle.plugin:2.6.3 > org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3
      > Could not resolve org.codehaus.groovy.modules.http-builder:http-builder:0.7.1.
         > Could not get resource 'https://plugins.gradle.org/m2/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.codehaus.groovy.modules.http-builder:http-builder:0.7.1.
         > Could not get resource 'https://repo.maven.apache.org/maven2/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.pom'.
            > Could not GET 'https://repo.maven.apache.org/maven2/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve org.codehaus.groovy.modules.http-builder:http-builder:0.7.1.
         > Could not get resource 'https://plugins.gradle.org/m2/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/org/codehaus/groovy/modules/http-builder/http-builder/0.7.1/http-builder-0.7.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s

解决方法

尝试了添加网站证书到 JAVA_HOME 依然没用。

修改 gradlew 文件,在

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script

这一行下加一行:

GRADLE_OPTS=-Dgradle.user.home=/mnt/e/temp

即指定 gradle 临时目录,这不是重点,重点是:

把前面出错信息中下载失败的各种资源 (pom文件或jar文件)直接通过浏览器下载到这个指定的临时目录中,然后再执行

./gradlew clean build

如果最终发现还是有几个 jar 包提示下载出错,则在上面设置的临时目录下找到以下路径:caches/modules-2/files-2.1,这里就是下载的 jar 包的临时目录,按照出错的 jar 包路径创建对应的文件夹。如org.eclipse.jgit,具体再参照已经下载成功的一些 jar 包的目录路径(因为各个包生成的目录路径还不一样)。把手动下载的 jar 包放进去(不一定产生作用),再执行 上述的build命令,再去看看,有可能就下载成功了。

也有可能此时目录已经生成,但在最末端的文件夹内只有一个 pom 文件,此时在跟 pom 文件目录同级的目录下创建一个文件夹,名称跟存有 pom 文件的差不多(改掉末尾几个字符),再把下载好的 jar 文件放进去,然后再执行 build 命令


nodeSetup报错

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':azkaban-web-server:nodeSetup'.
> Could not resolve all files for configuration ':azkaban-web-server:detachedConfiguration1'.
   > Could not resolve org.nodejs:node:8.10.0.
     Required by:
         project :azkaban-web-server
      > Could not resolve org.nodejs:node:8.10.0.
         > Could not get resource 'https://nodejs.org/dist/v8.10.0/ivy.xml'.
            > Could not GET 'https://nodejs.org/dist/v8.10.0/ivy.xml'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 26s
34 actionable tasks: 27 executed, 7 from cache

解决方法

安装 nodejs,安装 npm

apt install nodejs
apt install npm

如果还是报这个错,则进入到 azkaban-web-server 目录中,修改 build.gradle 文件中的以下内容

即把 download = true 改为 false,让它使用系统中已经安装好的 nodejs

原文地址:https://www.cnblogs.com/wuzhiblog/p/13620906.html