简体   繁体   English

将外部私有 jar 添加到 Openshift 应用程序

[英]Adding external private jar to Openshift Application

I want to deploy a Java & Maven micro services application on OpenShift however I have one small issue.我想在 OpenShift 上部署 Java 和 Maven 微服务应用程序,但是我有一个小问题。 These micro services are dependent on a commons project containing some common components.这些微服务依赖于一个包含一些公共组件的commons project

How can i add the jar of the commons project ( private jar, not on public repo) to the class path of the micro services about to be deployed on Openshift?如何将commons project的 jar(私有 jar,不在公共 repo 上)添加到即将部署在 Openshift 上的微服务的类路径中?

When building the application locally we used a maven plugin which would move the jar of the commons project into the local maven repository, from where it was easily referenced via a dependency tag in the pom file.在本地构建应用程序时,我们使用了一个 maven 插件,它将commons project的 jar 移动到本地 maven 存储库中,从那里可以通过pom文件中的dependency tag轻松引用它。

Here are some approaches that I thought about:以下是我想到的一些方法:

  • use an internal maven repository使用内部 Maven 存储库
  • create a folder on the root of the project and use it as a local maven repo, declaring it via repository tags in the pom files在项目的根目录上创建一个文件夹并将其用作本地 maven repository ,通过pom文件中的repository标签声明它
  • deploy a nexus repository on the Openshift cluster在 Openshift 集群上部署 nexus 存储库

The first approach is not viable since our company does not have an internal maven repository.第一种方法不可行,因为我们公司没有内部 Maven 存储库。

We also tried the third approach , however we did not manage to deploy a running nexus repo on Openshift.我们也尝试了第三种方法,但是我们没有设法在 Openshift 上部署一个正在运行的 nexus 存储库。

The only viable solution left is the second one, however I am a little bit reluctant to implement it since it does seem to be the standard way of doing things.剩下的唯一可行的解​​决方案是第二个,但是我有点不愿意实施它,因为它似乎确实是做事的标准方式。 What approach would you reccommend?你会推荐什么方法?

create a folder on the root of the project and use it as a local maven repo, declaring it via repository tags in the pom files在项目的根目录上创建一个文件夹并将其用作本地 maven 存储库,通过 pom 文件中的存储库标签声明它

This won't be a good approach TBH.这不是一个好方法 TBH。

My recommendation would be using a nexus/jfrog etc. repo OpenShift internal or externally (a more recommended approach for enterprises) and get the commons and other libraries from that repo via defining maven dependencies.我的建议是在内部或外部使用 nexus/jfrog 等 repo OpenShift(更推荐用于企业的方法),并通过定义 maven 依赖项从该 repo 中获取公共和其他库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM