Java 什么是 org.eclipse.wst.common.component 以及如何将其用于 ant

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24828453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 15:03:11  来源:igfitidea点击:

what is org.eclipse.wst.common.component and how to use it for ant

javaeclipseantjboss

提问by duxfox--

I have an eclipse workspace (for work) that has an ear project that I use to "export"/deploy an ear file to a JBoss server.

我有一个 eclipse 工作区(用于工作),它有一个 ear 项目,我用来将一个 ear 文件“导出”/部署到 JBoss 服务器。

However, they recently asked me to create an ant script that can build the workspace and create the ear, and I have done this successfully. The problem arises when I try to run my program with this ear that was built using the ant script; for deploying I'm simply copying the resulting ear file and pasting it into the JBoss/standalone/deployments folder and running the application.

不过最近他们让我做一个蚂蚁脚本,可以搭建工作空间,创建耳朵,我已经成功做到了。当我尝试用这个使用 ant 脚本构建的耳朵运行我的程序时,问题就出现了;对于部署,我只需复制生成的 ear 文件并将其粘贴到 JBoss/standalone/deployments 文件夹中并运行应用程序。

The JBoss AS starts fine, but then I get a few exceptions that halt my application that I do not get when I do a build and deploy through eclipse. The two ear files are identical when viewing the two ear files using 7zip, however I see in the eclipse workspace, in the ear project, theres a .settings folder that has 4 files, one of them being org.eclipse.wst.common.component and I'm guessing this (if not all 4 files) is necessary when deploying somehow.

JBoss AS 启动良好,但随后出现了一些异常,这些异常停止了我的应用程序,而我在通过 Eclipse 进行构建和部署时却没有遇到这些异常。使用 7zip 查看两个 ear 文件时,这两个 ear 文件是相同的,但是我在 eclipse 工作区中看到,ear 项目中有一个 .settings 文件夹,其中包含 4 个文件,其中一个是 org.eclipse.wst.common。组件,我猜这(如果不是全部 4 个文件)在以某种方式部署时是必需的。

Does ecplise use this .settings folder and the files inside when deploying an ear? What happens during this process? and how can I replicate it in an ant script so that my application runs identically from either ant or eclipse builds?

ecplise 在部署耳朵时是否使用这个 .settings 文件夹和里面的文件?在这个过程中会发生什么?以及如何在 ant 脚本中复制它,以便我的应用程序从 ant 或 eclipse 构建中以相同的方式运行?

EDIT

编辑

let me just add that none of the files in the .settings folder get packaged up in the ear file, so I'm guessing they're somehow used when eclipse does a build/deploy, but it doesnt get placed in the final ear product

让我补充一点,.settings 文件夹中的所有文件都没有打包到 ear 文件中,所以我猜它们在 eclipse 进行构建/部署时以某种方式使用了,但它没有被放置在最终的 ear 产品中

thank you

谢谢你

采纳答案by Heinrich Filter

Eclipse uses the data in org.eclipse.wst.common.componentto figure out the dependencies needed for deployment. The file corresponds to the settings found in Eclipse when Right-clicking on an EAR project > Properties > Deployment Assembly.

Eclipse 使用输入的数据org.eclipse.wst.common.component来确定部署所需的依赖项。该文件对应于在 Eclipse 中找到的设置Right-clicking on an EAR project > Properties > Deployment Assembly

E.g. if your EAR project has a dependency on a WAR project then Eclipse knows to include the WAR when deploying because of the Deployment Assemblysettings which get stored in org.eclipse.wst.common.component

例如,如果您的 EAR 项目依赖于 WAR 项目,则 Eclipse 知道在部署时包含 WAR,因为部署程序集设置存储在org.eclipse.wst.common.component

When building the EAR using Ant you need to add these dependencies manually (without relying on Eclipse metadata)

使用 Ant 构建 EAR 时,您需要手动添加这些依赖项(不依赖 Eclipse 元数据)