【发布时间】:2015-09-24 15:38:09
【问题描述】:
我们有一个公司代理阻止我按原样使用 maven-frontend-plugin。
问题在于,为了获取 npm 和 bower 依赖项,我们使用了内部 Artifactory,因此我们不应该为此设置任何代理设置。但是实际的可执行文件是直接获取的,因此要获取它们我们需要代理。而且前端插件似乎不支持特定域的异常。
那么有没有一种简单的方法可以将 npm 和 nodejs 可执行文件上传到我们的内部工件,以便我们可以完全跳过代理?或者其他解决方法?
编辑
为了方便起见,我在这里添加了解决方案,因为我需要修改我在下面批准的答案。
在 Artifactory 中设置两个远程存储库,一个到 nodejs (https://nodejs.org/dist/),一个到 npm (https://registry.npmjs.org/npm/-/)。
编辑你的 maven-frontend-plugin 配置:
<execution>
<!-- optional: you don't really need execution ids,
but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v0.12.1</nodeVersion>
<npmVersion>2.14.1</npmVersion>
<!-- use the URL for the repository you created in step 1 -->
<nodeDownloadRoot>https://artifactory.my company.com/artifactory/nodejs.dist/</nodeDownloadRoot>
<npmDownloadRoot>https://artifactory.my company.com/artifactory/npm.dist/</npmDownloadRoot>
</configuration>
</execution>
可以仅使用 nodejs 存储库(但 npm 仅适用于 1.4.9 版本)将 npmDownloadRoot 更改为:
<npmDownloadRoot>https://artifactory.my company.com/artifactory/nodejs.dist/npm/</npmDownloadRoot>
别忘了从你的 maven settings.xml 中删除代理设置
【问题讨论】:
标签: node.js maven npm artifactory