EAR 在 Eclipse 中打包并发布,使用 Ant builder 构建依赖模块

发布于 2024-10-16 11:27:58 字数 465 浏览 3 评论 0原文

我有一个要求,其中各个模块是使用 ant 构建的,并且 eclipse 应该使用生成的 jar 来打包 Ear 并在 JBoss 服务器上发布。

我编写了 ant 脚本来构建依赖模块并将其放在 project/build/artifact 目录下。并使用该目录下的jar来提供Java EE模块依赖项。

如果在模块生成后添加依赖项,则打包似乎可以正常工作。但是,当另一个开发人员接受我的更改并尝试使其正常工作时,依赖模块无法识别,因为模块尚未创建。

构建模块并刷新项目工作区后,模块将被识别并添加到耳朵中。但是,直到我假装修改组件文件(添加新行或空格并保存它 - 并没有真正修改内容)并刷新项目并且它起作用后,模块依赖关系才显示出来。我在 eclipse 上搜索,看看这是否是一个现有的错误,但没有找到任何相关的错误。

我在这里做错了什么吗?这种方法是获取 ant 构建的模块并将其用于打包 Ear 并使用 Eclipse 发布它的正确方法吗?请帮忙。

I have a requirement where the individual modules are built using ant and the resulting jars should be used by eclipse to package the ear and publish on JBoss server.

I wrote ant script that builds the dependency modules and puts under project/build/artifact directory. And used the jars under this directory to provide Java EE module dependencies.

The packing seems to work fine if the dependencies were added after the modules were already generated. But when another developer takes my changes and tries to get this working, the dependency modules are not recognized because the modules were not created yet.

After building the modules and refreshing the project workspace, the modules be recognized and added to the ear. But the module dependencies were not shown until I pretended to modify the component file (added a new line or a space and saved it - not really modifying the content) and did a project refresh and it worked. I searched on eclipse to see if this is an existing bug, but didn't find any relating bugs.

Am I doing something wrong here? Is this approach the right approach to get the modules built by ant and use them in packaging an ear and publish it using eclipse? Please help.

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

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

发布评论

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

评论(1

心舞飞扬 2024-10-23 11:27:58

这可能是 WTP 中的一个错误,但是……

我会让 Ant 和 Eclipse 构建彼此远离。使用 Ant 脚本生成用于生产的“官方”版本。在开发过程中,不要尝试将 Ant 构建的结果提供给 Eclipse 构建。而是使用直接的项目到项目 Java EE 模块依赖项来执行此操作。

只有当您需要将外部编译器或代码生成器集成到构建过程中时,才真正需要让 Ant 参与 Eclipse 构建。

This is likely a bug in WTP, but..

I would keep Ant and Eclipse builds away from each other. Use your Ant script to produce your "official" builds for production. During development do not try to feed result of Ant build into Eclipse build. Do this with direct project-to-project Java EE module dependencies instead.

The only time that it is really necessary to get Ant involved in the Eclipse build is when you need to integrated external compilers or code generators into the build process.

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