我编译过程中yarn无法安装的解决过程如下。
>mvn clean install -DskipTests -e
以下是出错提示关键内容。
-----------------------< org.thingsboard:ui-ngx >-----------------------
[INFO] Building ThingsBoard Server UI 3.5.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- frontend-maven-plugin:1.12.0:install-node-and-yarn (install node and npm) @ ui-ngx ---
[INFO] Node v18.17.0 is already installed.
[INFO] Installing Yarn version v1.22.19
[INFO] Downloading
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-v1.22.19.tar.gz to C:\Users\Administrator\.m2\repository\com\github\eirslett\yarn\1.22.19\yarn-1.22.19.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.899 s
[INFO] Finished at: 2023-08-06T14:08:08+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:install-node-and-yarn (install node and npm) on project ui-ngx: Could not download Yarn: Could not download
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-v1.22.19.tar.gz: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [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/MojoFailureException问题的原因看到了,就是从github下载不了文件。直接把文件URL用浏览器就能够下载。 用maven就是报错,真是无语啦!
解决方法:看红色文字。Downloading
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-v1.22.19.tar.gz to C:\Users\Administrator\.m2\repository\com\github\eirslett\yarn\1.22.19\yarn-1.22.19.tar.gz
想到把刚才浏览器下载的yarn-v1.22.19.tar.gz 复制到.m2\repository\com\github\eirslett\yarn\1.22.19\
复制以后再执行mvn clean package -DskipTests 发现还是不好使。
再后来 把[C:\Users\Administrator\.m2\repository\com\github\eirslett\yarn\1.22.19\yarn-1.22.19.tar.gz]复制到文件管理器的URL中回车,发现打不开。????为什么打不开?刚才不是复制过了吗?
打开[C:\Users\Administrator\.m2\repository\com\github\eirslett\yarn\1.22.19\]发现有yarn.tar.gz文件啊!,仔细核对文件名称发现:
C:\Users\Administrator\.m2\repository\com\github\eirslett\yarn\1.22.19\yarn-1.22.19.tar.gz
C:\Users\Administrator\.m2\repository\com\github\eirslett\yarn\1.22.19\yarn-v1.22.19.tar.gz
大意了!就差一个v字母。网上下载的文件包带v,而本地不带v。
修改后编译通过。