安装Ambari的过程中遇到了报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
[INFO] ------------------------------------------------------------------------ [INFO] Building Ambari Web 2.7.4.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ambari-web --- [INFO] Deleting /root/apache-ambari-2.7.4-src/ambari-web (includes = [**/*.pyc], excludes = []) [INFO] [INFO] --- exec-maven-plugin:1.2.1:exec (clean-rmdir) @ ambari-web --- [INFO] [INFO] --- exec-maven-plugin:1.2.1:exec (clean-mkdir) @ ambari-web --- [INFO] [INFO] --- build-helper-maven-plugin:1.8:regex-property (parse-package-version) @ ambari-web --- [INFO] [INFO] --- build-helper-maven-plugin:1.8:regex-property (parse-package-release) @ ambari-web --- [INFO] [INFO] --- build-helper-maven-plugin:1.8:parse-version (parse-version) @ ambari-web --- [INFO] [INFO] --- build-helper-maven-plugin:1.8:regex-property (regex-property) @ ambari-web --- [INFO] [INFO] --- frontend-maven-plugin:1.4:install-node-and-yarn (install node and yarn) @ ambari-web --- [INFO] Node v4.5.0 is already installed. [INFO] Installing Yarn version v0.23.2 [INFO] Downloading https://github.com/yarnpkg/yarn/releases/download/v0.23.2/yarn-v0.23.2.tar.gz to /root/.m2/repository/com/github/eirslett/yarn/0.23.2/yarn-0.23.2./yarn-v0.23.2.tar.gz [INFO] No proxies configured [INFO] No proxy was configured, downloading directly Dec 05, 2019 10:51:29 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Invalid cookie header: "Set-Cookie: has_recent_activity=1; path=/; expires=Thu, 05 Dec 2019 15:51:29 -0000". Invalid 'expires' attribute: Thu, 05 Dec 2019 15:51:29 -0000 Dec 05, 2019 10:51:29 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Mon, 05 Dec 2039 14:51:29 -0000; secure; HttpOnly". Invalid 'expires' attribute: Mon, 05 Dec 2039 14:51:29 -0000 [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Ambari Main ........................................ SUCCESS [ 4.989 s] [INFO] Apache Ambari Project POM .......................... SUCCESS [ 0.167 s] [INFO] Ambari Web ......................................... FAILURE [02:09 min] [INFO] Ambari Views ....................................... SKIPPED [INFO] Ambari Admin View .................................. SKIPPED [INFO] ambari-utility ..................................... SKIPPED [INFO] ambari-metrics ..................................... SKIPPED [INFO] Ambari Metrics Common .............................. SKIPPED [INFO] Ambari Metrics Hadoop Sink ......................... SKIPPED [INFO] Ambari Metrics Flume Sink .......................... SKIPPED [INFO] Ambari Metrics Kafka Sink .......................... SKIPPED [INFO] Ambari Metrics Storm Sink .......................... SKIPPED [INFO] Ambari Metrics Storm Sink (Legacy) ................. SKIPPED [INFO] Ambari Metrics Collector ........................... SKIPPED [INFO] Ambari Metrics Monitor ............................. SKIPPED [INFO] Ambari Metrics Grafana ............................. SKIPPED [INFO] Ambari Metrics Host Aggregator ..................... SKIPPED [INFO] Ambari Metrics Assembly ............................ SKIPPED [INFO] Ambari Service Advisor ............................. SKIPPED [INFO] Ambari Server ...................................... SKIPPED [INFO] Ambari Functional Tests ............................ SKIPPED [INFO] Ambari Agent ....................................... SKIPPED [INFO] ambari-logsearch ................................... SKIPPED [INFO] Ambari Logsearch Appender .......................... SKIPPED [INFO] Ambari Logsearch Config Api ........................ SKIPPED [INFO] Ambari Logsearch Config JSON ....................... SKIPPED [INFO] Ambari Logsearch Config Solr ....................... SKIPPED [INFO] Ambari Logsearch Config Zookeeper .................. SKIPPED [INFO] Ambari Logsearch Config Local ...................... SKIPPED [INFO] Ambari Logsearch Log Feeder Plugin Api ............. SKIPPED [INFO] Ambari Logsearch Log Feeder Container Registry ..... SKIPPED [INFO] Ambari Logsearch Log Feeder ........................ SKIPPED [INFO] Ambari Logsearch Web ............................... SKIPPED [INFO] Ambari Logsearch Server ............................ SKIPPED [INFO] Ambari Logsearch Assembly .......................... SKIPPED [INFO] Ambari Logsearch Integration Test .................. SKIPPED [INFO] ambari-infra ....................................... SKIPPED [INFO] Ambari Infra Solr Client ........................... SKIPPED [INFO] Ambari Infra Solr Plugin ........................... SKIPPED [INFO] Ambari Infra Manager ............................... SKIPPED [INFO] Ambari Infra Assembly .............................. SKIPPED [INFO] Ambari Infra Manager Integration Tests ............. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:16 min [INFO] Finished at: 2019-12-05T22:53:36+08:00 [INFO] Final Memory: 28M/66M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:install-node-and-yarn (install node and yarn) on project ambari-web: Could not download Yarn: Could not download https://github.com/yarnpkg/yarn/releases/downloithub-production-release-asset-2e65be.s3.amazonaws.com:443 [github-production-release-asset-2e65be.s3.amazonaws.com/54.231.82.114] failed: Connection timed out (Connection timed out) -> [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 [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :ambari-web |
frontend-maven-plugin为项目本地下载/安装node、npm、yarn等,然后运行npm install、yarn install等命令 。使用这个插件目的在于可以在构建中用Node.js及其库而无需为构建系统全局安装,也能够使得让前端和后端版本构建尽可能分开,保证每个构建环境中运行的node和npm的版本是相同的。
我们可以看到,frontend-maven-plugin在下载yarn时没有使用代理(No proxy was configured, downloading directly),并最后下载失败。这是因为github所用s3.amazonaws.com的CDN被墙所致。之前有人提到通过hosts文件强制将s3.amazonaws.com解析至香港,实测无效。
在参考文档1中,有人指出Maven Frontend Plugin使用的是maven配置文件中指定的代理:
The Eirslett Maven Frontend Plugin does not use
$http_proxy
or the proxy settings in the$HOME/.npmrc
file. Instead, I had to put the proxy setting inside my$HOME/.m2/settings.xml
file.
因此我们配置/etc/maven/settings.xml,使用(且仅支持)HTTP代理:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<!-- proxies | This is a list of proxies which can be used on this machine to connect to the network. | Unless otherwise specified (by system property or command-line switch), the first proxy | specification in this list marked as active will be used. |--> <proxies> <proxy> <id>optional</id> <active>true</active> <protocol>http</protocol> <username>username</username> <password>password</password> <host>139.*.*.*</host> <port>11443</port> </proxy> </proxies> |
此时,我们可以看到使用了代理:
参考文档:
1、https://stackoverflow.com/questions/38442298/npm-frontend-proxy-set-but-cant-download-npm-package
2、http://maven.apache.org/guides/mini/guide-proxies.html
3、https://www.jianshu.com/p/b378dfad09f6
转载时请保留出处,违法转载追究到底:进城务工人员小梅 » frontend-maven-plugin插件使用代理