如何启用 glassfish 内部对 Maven 存储库的访问?

发布于 2024-11-16 09:15:57 字数 594 浏览 2 评论 0原文

我有以下问题。我们在公司服务器上托管了一个中央 Maven 存储库。我们的团队正在开展一个项目。这里的每个人都使用该存储库来获取所需的工件。如果目前缺少某些内容并且开发人员当前正在处理的任务需要某些内容,他会手动将此工件安装到中央存储库,以便他的提交不会破坏自动构建。

现在,每个开发人员也在他的机器上安装了 Glassfish v2。这是为了测试和调试目的。在提交更改之前,开发人员在 Maven 帮助下为项目制作 .ear。然而,当开发人员将 Ear 部署到本地 glassfish 后,经常会出现错误,因为 glassfish 库集可能不包含中央公司存储库的所有最新依赖项。

现在,如果出现错误,开发人员只需读取日志并查看到底缺少什么。之后,他手动将所需的 jar 复制到本地 $GLASSFISH_HOME$/lib 目录中。但这似乎有点令人沮丧。如何自动完成此操作?

现在我们正在尝试实施以下解决方案。开发人员必须同步其本地 Maven 存储库,从中央存储库收集项目所需的所有工件。这个本地存储库必须放置在 java 类路径上,以便 glassfish 也能看到它。这是正确的做法吗?也许有一种方法可以直接从 $GLASSFISH_HOME$/dir 内的中央存储库安装所有必需的工件,并且这可以在部署期间自动完成?

I have a following problem. We have a central maven repository hosted on our company server. Our team is working on a project. Everyone here uses that repository to get the required artifacts. If something is missing at the moment and is required for the task that the developer is currently dealing with, he installs this artifact manually to the central repository, so that his commits don't break the automated builds.

Now, each developer also has Glassfish v2 installed on his machine. That is for testing and debugging purposes. Before committing the changes, developer makes the .ear for the project with Maven help. However, after the developer deploys the ear to it's local glassfish, frequent errors arise, because the set of glassfish libraries may not contain all the latest dependencies of the central company repository.

Right now in case of the error the developer simply reads the log and looks what exactly is missing. After that he manually copies the required jar inside his local $GLASSFISH_HOME$/lib dir. But that seems a little bit frustrating. How can this be done automatically?

Right now we are trying to implement the following solution. The developer has to synchronize his local maven repository gathering all the artifacts from the central one that are required by the project. This local repository has to be placed on the java classpath, so that glassfish would also see it. Is that a correct approach? Maybe there is a way to install directly all the required artifacts from the central repository inside $GLASSFISH_HOME$/dir and this can be done automatically during deploy?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伴我心暖 2024-11-23 09:15:57
  • 关于必须安装依赖项。如果开发人员需要安装公共 Maven 存储库中缺少的依赖项,请考虑到通常 Maven 代理具有缓存公共存储库的能力。例如,archiva 有一个代理缓存。如果依赖项是您自己的项目可交付成果,您应该考虑使用 maven 发布和部署 到您公司的存储库。

  • 关于最新版本。您需要指定 Maven 应使用哪个版本的依赖项。我更喜欢手动编辑我的 poms,无论如何有一个 实现这一目标的各种方法

  • 我认为这些库应该是该项目的一部分。如果不是 glassfish 的标准库,则应将它们包含在您的 war 文件中,作为项目的一部分。如果不是标准的,但不是您项目的一部分(不是常规方法),请考虑将这个 glassfish 作为一个项目单独管理(自己的 git/svn 存储库、自己的 pom、自己的版本、拥有一切)。

祝你好运。

  • About having to install dependencies. If the developers need to install dependencies missing from public maven repositories, take into account that usually maven proxies have the ability to cache public repos. For instance, archiva has a proxying cache. If the dependencies are your own project deliverables you should consider releasing and deploying with maven to your company repo.

  • About latest versions. You need to specify maven what version of dependencies should use. I would prefer editing my poms manually, anyway there's a variety of ways to achieve that.

  • The libraries should be part of the project, I think. If not standard libraries of glassfish, they should be included, for instance, in your war file as part of your project. If not standard but not part of your project (not the regular approach) consider managing this glassfish as a project on its own (own git/svn repo, own pom, own versions, own everything).

Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文