树脂的‘石榴’ - 自动神奇加载项目的 Maven jar 依赖项 - 但如何使用 pom.xml 为它们生成 jar?
Resin java 服务器有一个巧妙的功能,他们称之为石榴 ( http://www.caucho.com/projects/ pomegranate/ ),它允许将各种 jar 依赖项放入服务器目录(project-jars/)中,然后从其 pom.xml 文件为 Web 应用程序加载它们。
问题是:我应该如何将罐子放入树脂的项目罐子中? (仅仅复制它们是行不通的)
详细信息:
我有一个使用 Maven 的工作项目,所有依赖项都配置在 项目 pom.xml 文件。我可以构建一个Web应用程序战争等。
我将jar文件复制到resin的project-jars/,因为它们是由maven为这个特定的Web应用程序生成的。
当我部署战争时,resin 发现 pom.xml 并尝试解析 依赖关系;不幸的是,它无法在其中找到任何文物 存储库(项目 jar)。
我想这是因为我放在那里的所有罐子都没有 META-INF/maven/pom.xml 文件打包在其中。它们只是普通的罐子 就像maven下载的那样。
在石榴网站上,他们说树脂会扫描项目罐子中是否有带有 pom.xml 文件的罐子,以确定它们的版本。
我应该如何创建包含 pom.xml 文件的 jar?
或者我应该从我的开发版本库中手动复制 foo-bar-1.0.pom 文件 机器到resin的project-jars目录? (这击败了所有自动魔法的目的)
感谢您的回答,
最诚挚的问候
霍勒斯
Resin java server has a neat feature they call pomegranate ( http://www.caucho.com/projects/pomegranate/ ) which allows to just put various jar dependencies in server's directory (project-jars/) and then it loads them for a web-app from its pom.xml file.
Question is: how should I put the jars to resin's project-jars ? (just copying them doesn't work)
Details:
I have a working project with maven, with all dependencies configured in
projects pom.xml file. I can build a webapp war etc.
I copied the jar files to resin's project-jars/ as they were generated by maven for this particular web-app.
When I deploy the war, resin spots pom.xml and tries to resolve
dependencies; unfortunately it cannot find any artifacts in its
repository (project-jars).
I suppose this is because all the jars I have put there do not have
META-INF/maven/pom.xml files packed in them. They are just normal jars
like those downloaded by maven.
On pomegranate website they say resin scans project-jars for jars with pom.xml files, to determine their versions.
How should I create jars with pom.xml files included?
Or should I manually copy the foo-bar-1.0.pom files from the repository on my devel
machine to the resin's project-jars directory? (which kind of beats the purpose of all the auto-magic)
Thanks for answer,
Best regards
Horace
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 Pomegranate Draft 规范的理解是:
所以我想这个想法是在战争
pom.xml
中将依赖项标记为“已提供”,并将它们添加到WEB-INF/pom.xml
中以进行部署树脂。不过我还没有测试过,所以我可能是错的。事实上,这个石榴看起来很有趣,但我现在还没有完全理解。虽然我了解它的好处,但它似乎使 WAR 不可移植,这是一个很大的缺点。我会进一步挖掘它......
(编辑:我正在回答下面OP的评论)
说实话,我认为规范草案不是很清楚。然而,我在 Caucho 的博客上发现了这篇 石榴模块 帖子,其中详细介绍了如何获取它适用于网络应用程序:
至少,我理解这些步骤,它们回答了你的问题:你必须手动将 jar 放到 Resin 的 project-jars 目录中。这不是我所期待的,但我认为我误解了石榴的含义。如果我没记错的话,石榴是 OSGI 的一种替代品,它是关于模块捆绑和类加载的巫毒。它使用 Maven 的约定来描述依赖关系,但它与依赖关系管理无关。
My understanding of the Pomegranate Draft specification is that:
So I guess the idea is to mark the dependencies as "provided" in the war
pom.xml
and to add them inWEB-INF/pom.xml
for a deployment on Resin. I've not tested this though, so I might be wrong.Actually, this pomegranate looks interesting but I don't get it entirely for now. While I understand its benefits, it seems to make the WAR not portable which is a big drawback. I'll dig it a bit further...
(EDIT: I'm putting an answer to a comment from the OP below)
To be honest, I don't find the spec draft very clear. However, I found this pomegranate modules post on Caucho's blog that details a bit more how to get it working for a webapp:
At least, I understand these steps and they answer your question: you have to drop the jars manually in Resin's project-jars directory. That's not what I was expecting but I think that I was misunderstanding what pomegranate is all about. If I'm not wrong, pomegranate is a kind of alternative to OSGI, it is about module bundling and classloading voodoo. It uses Maven's conventions to describe dependencies but it's not about dependencies management.