如何从Eclipse将Maven项目的WAR部署到JBoss服务器?
我想将Maven项目的WAR部署到JBoss服务器。我知道从 Eclipse Export->War 将 WAR 文件部署到 JBoss。但是我怎样才能为 Maven 项目做到这一点呢?任何一步一步的信息或有用的网站链接都会对我非常有帮助。谢谢。
编辑:我已添加
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<jbossHome>/home/tanmoy/Jboss</jbossHome>
<serverName>all</serverName>
<fileName>target/LoginExample-1.0.war</fileName>
</configuration>
</plugin>
到我的 pom.xml 并再次导入为 maven 项目,但右键单击 pom.xml 以运行方式时,我没有看到任何部署选项。
I want to deploy WAR of Maven project to JBoss server. I know that from Eclipse Export->War deploy the WAR file to JBoss. But How can I do this for Maven Project. Any step by step information or useful website link will be very helpful to me. Thank you.
Edit: I have added
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<jbossHome>/home/tanmoy/Jboss</jbossHome>
<serverName>all</serverName>
<fileName>target/LoginExample-1.0.war</fileName>
</configuration>
</plugin>
To my pom.xml and import again as maven project, but on right clicking into pom.xml for Run As I don't see any option for deployment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
如果它是一个 Maven 应用程序(EAR)或(JAR)或其他什么,您只需添加到您的 pom.xml:
并在您的 Eclipse 中运行您为目标所做的配置:
jboss-as:deploy
当然我是在和她谈论 Jboss AS7 或 EAP6
If it is a maven application (EAR) or (JAR) or what ever, you have just to add to your pom.xml:
And in your eclipse run configurations you make for the goals :
jboss-as:deploy
Of course i am talking her about Jboss AS7 or EAP6
使用以下目标在 Jboss 文件夹中部署您的 war
Use the following goals to deploy your war in Jboss folder
我找到了解决方案并分享,因为它可能对某人有帮助。
我的配置是:
您还需要
现在您已准备好开始创建项目。
注意:您的 WAR 的 jar 与 JBoss 的 lib 的 jar 有一些重叠的可能性。那么你应该采取适当的行动。例如,从 WAR 中删除 jar(如果您的 jar 版本与 JBoss 的版本相同或低于 JBoss 的版本),或者替换 JBoss 的 jar 并从 WAR 中删除该 jar(如果你的 jar 版本高于 JBoss 的版本)。我应该小心这一点,并在做任何事情之前收集良好的知识。
谢谢。
I found the solution and I am sharing as it might be helpful to someone.
My configuration is:
You also need to
Now you are ready to start to create project.
Note: there are some possibilities of overlapping jar(s) of your WAR with the jar(s) of JBoss's lib. Then you should take appropriate action. Like remove the jar(s) from your WAR (in case the version of your jar is same or lower than that of JBoss's) or replace the jar(s) of JBoss and remove that jar(s) from your WAR(in case the version of your jar is higher than that of JBoss's). I should be careful about this and gather well knowledge before doing anything.
Thank you.
您可以右键单击 pom.xml 文件并选择
Run As
->Maven 构建
。将构建目标设置为清理包
。完成后,进入项目的目标目录,右键单击战争并导出,就像您当前正在做的那样。编辑:
要从 pom.xml 中执行此操作,请使用 jboss maven 插件: http://mojo.codehaus.org/jboss-maven-plugin/examples/deploy-undeploy-examples.html
You can right click on the pom.xml file and choose
Run As
->Maven Build
. Set the build goals toclean package
. When that completes go into the target directory of your project, right click on the war and export as you are currently doing.EDIT:
To do this from within your pom.xml use the jboss maven plugin: http://mojo.codehaus.org/jboss-maven-plugin/examples/deploy-undeploy-examples.html
正确的格式是:
The correct format is:
只需将以下插件添加到 POM.xml 对我来说很有效。
使用命令提示符可以部署或取消部署工件。
注意:上述选项使用 http://localhost:9999 url 将工件部署到服务器。在执行命令之前,Jboss 服务器应该在后台运行。
也可以使用eclipse来执行上述目标。
步骤1:点击运行配置。
第 2 步:创建新的 Maven 构建
步骤 3:更新构建详细信息,如图所示。
找到
更多选项可以在https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html
Simply adding below plugin to POM.xml worked for me.
Using command prompt one can deploy or undeploy the artifact.
Note: The above option uses http://localhost:9999 url to deploy the artifact to server. The Jboss server should be running in background before the command is executed.
Also one can use eclipse to execute above goals.
Step 1: Click on run configuration.
Step 2:Create a new Maven Build
Step 3:Update build details as shown.
More option can be found at
https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html
假设
我假设您已经安装了 Eclipse 的 Maven 插件。
安装
在项目资源管理器中选择项目时选择
运行-->运行方式 --> Maven 安装
运行 Jboss
转到运行 -->运行配置..
添加新的 Maven 构建
命名进程,选择将部署为 war 的基目录
设定目标 --> jboss:start
按照以下步骤,您可以通过 Eclipse 部署所有内容。
玩得开心。 :)
Assumption
I am assuming that you have already installed the plugins for Maven for eclipse.
Installation
While selecting the project in project explorer select
Run --> Run As --> Maven Install
Running Jboss
Go to Run --> Run Configurations..
Add new Maven Build
Name the Process, Select the Base directory that will be deployed as war
set the Goal --> jboss:start
By following the steps you can deploy every thing via Eclipse.
Have fun. :)
这里
“包含Jboss中部署文件夹的地址”将给定的代码相应地放入
pom.xml
here
<outputDirectory>
"containes address of deployment folder in Jboss"</outputDirectory>
put the given code accordingly in
pom.xml
那么 http://cargo.codehaus.org/Maven2+plugin 也可能是一个不错的选择。
Well http://cargo.codehaus.org/Maven2+plugin could be a nice alternative, too.