maven - 如果 Jenkins 已经知道,为什么要在 POM 中添加分发管理
问题描述
和标题说的差不多。
我正在尝试为 WSO2 构建 CI/CD。在遵循本教程时: https ://docs.wso2.com/display/IntegrationCloud/Implement+Continuous+Integration+and+Deployment+with+Jenkins
它没有说明在 POM 上添加 DistributionManagement,它甚至还有一个特殊的 POM 配置部分,但是,jenkins 正在抛出一个
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project HelloWorld: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
因此,如果 jenkins 已经有了 repo URL、分支和 github,并且 POM 有一个部署目标,应该部署到一个 URL:
1) 为什么我需要分销管理?
2) 我可以将它指向我的文件系统之类的任何位置,还是必须将其指向我实际想要部署到的云?
解决方案
根据maven文档,您可以使用标签distributionManagement将构建工件直接上传到带有maven的服务器
https://maven.apache.org/pom.html
重要的部分是 url 标签。您可以使用 scp 或 sftp(可能是其他协议)
scp://user:password@serverUrl/var/some/directory
我建议在本地测试命令 deploy ,当你确定它有效时,使用 jenkins。
如果你想做最先进的 jenkins 工作,我建议使用 jenkins 管道,使用 sh 命令执行 maven 并使用 ssh-steps-plugin 提供的 ssh 步骤发布到服务器
推荐阅读
- git - 使用 git 推送到存储库的文件在 Bitbucket 上不可见
- javascript - 如何在Javascript中仅对数字进行正则表达式并跳过字母e
- caching - 如何在easeljs中缓存文本?
- ruby-on-rails - 使用 GoDaddy 颁发的 SSL 访问 Heroku 站点时出现 SSL 协议错误
- firebase - 通过添加区域来扩展 Firebase 的推荐方法
- android - android studio 中的文件已损坏或无法访问
- sql - 如何针对firebird执行多个sql脚本
- salesforce - 我如何在销售人员中以小数幂实现指数
- angular - Angular 6:DebounceTime,只取最后一个值
- javascript - 如何将来自 servlet doGet 方法的请求转发到新的 html/jsp 页面