简体   繁体   English

将Java EE Web App部署到Wildfly / JBoss EAP

[英]Deploying Java EE Web App to Wildfly/JBoss EAP

More of a "what's best practice?" 更多的是“什么是最佳实践”? kind of question. 这样的问题。

We have a number of Java EE web applications currently deployed manually through the web interface to JBoss EAP 7.0 application servers. 当前,我们有许多Java EE Web应用程序是通过Web界面手动部署到JBoss EAP 7.0应用程序服务器的。 I'm looking at automating these and have a simple Jenkins build which will deploy to our UAT environment using Jenkins promoted build plugins and the Wildfly maven plugin. 我正在考虑使它们自动化,并有一个简单的Jenkins构建,它将使用Jenkins推广的构建插件和Wildfly maven插件部署到我们的UAT环境中。

Whilst this is ok, we clearly have a defined "build" and "deploy" setup which i want to refine. 没关系,但我们显然有一个要完善的定义的“构建”和“部署”设置。 My issue however is that when we run the "wildfly:deploy" goal, it's runs the maven install section of the build! 但是,我的问题是,当我们运行“ wildfly:deploy”目标时,它将运行构建的maven安装部分!

Essentially, deploying to different environments rebuilds the app, therefore we can't guarantee byte-for-byte parity with the build that was tested. 本质上,部署到不同的环境会重新构建应用程序,因此我们不能保证与经过测试的构建进行逐字节奇偶校验。

Is there a best practice way of deploying a built final release through environments using Jenkins/Maven onto JBoss EAP/Wildfly? 有没有最佳实践方法,可以在使用Jenkins / Maven的环境中将构建的最终发行版部署到JBoss EAP / Wildfly上?

Thanks all! 谢谢大家!

I'm not sure why you need to deploy with Maven. 我不确定为什么需要使用Maven进行部署。 Why not use the jboss-cli tool? 为什么不使用jboss-cli工具? With that you can do something like: 这样,您可以执行以下操作:

jboss-cli.sh --connect --command="deploy target/your.war --force"

This is the "localhost" version and it assumes you haven't created any users for Wildfly but it gives you an idea of what you can do. 这是“ localhost”版本,它假定您尚未为Wildfly创建任何用户,但可以使您了解可以做什么。 The CLI Docs get into different ways to deploy applications and expands greatly on the security aspect. CLI文档采用了不同的方式来部署应用程序,并在安全方面进行了很大的扩展。

Jenkins can run a shell or batch script about as easily as it can run a maven build so this shouldn't be too difficult to implement in Jenkins. Jenkins可以像运行Maven构建一样轻松地运行shell或批处理脚本,因此在Jenkins中实现起来应该不太困难。

Well in development workflow it is perfectly ok to deploy with maven, it saves time and context switching. 在开发工作流程中,可以很好地使用maven进行部署,这样可以节省时间和上下文切换。

You can create a dedicated maven profile for deployment - this way you have the flexibility, either use maven just for build and deploy however you want, or run maven with your deploy profile, and let it do build+deploy. 您可以创建用于部署的专用maven配置文件-这样,您就可以灵活地使用maven来进行构建和部署(随心所欲),或者使用您的deploy配置文件运行maven,然后进行构建+部署。

Head over to Wildfly maven plugin for more info. 前往Wildfly maven插件以获取更多信息。 It can do many tasks apart from deployment, including configuration tasks via jboss cli, but for the sake of deployment, this is all you need: 它可以完成除部署之外的许多任务,包括通过jboss cli进行配置,但是为了进行部署,这就是您所需要的:

<profile
  <id>jboss-deploy</id>
  <build>
    <plugins>
      <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>1.2.1.Final</version>
        </plugin>
     </plugins>
  </build>
 </profile>

Now you can simply run mvn clean package -Pjboss-deploy and maven will compile and package your app, and then deploy the resulting war or ear to your running JBoss/Wildfly instance. 现在,您可以简单地运行mvn clean package -Pjboss-deploy并且maven将编译和打包您的应用程序,然后将所产生的战争或耳朵部署到正在运行的JBoss / Wildfly实例中。 You can also invoke the deployment manually via mvn wildfly:deploy 您也可以通过mvn wildfly:deploy手动调用mvn wildfly:deploy

Have fun. 玩得开心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 i need to migrate a java EE, jsf, jboss eap 6.3 primefaces app to wildfly 8.2.1 - i need to migrate a java EE, jsf, jboss eap 6.3 primefaces app to wildfly 8.2.1 JBoss(Wildfly 10.0)上的Java Web应用程序未通过Eclipse部署 - Java web app on JBoss(Wildfly 10.0) not deploying through Eclipse Netbeans中的“ Java EE 7”和JBoss EAP 7.0 - “Java EE 7” and JBoss EAP 7.0 in Netbeans 在JBoss AS中部署Java EE应用程序:找不到可用的端口 - Deploying Java EE app in JBoss AS: Can not find a free port for use Java8和JBoss EAP 7是否存在严重的兼容性问题,以便通过JBOSS Developer Studio部署Web服务 - Are there serious compatibility issues with Java8 and JBoss EAP 7 for deploying web services with JBOSS developer studio 我应该将我的应用程序打包到wildfly / jboss模块中吗? (或任何等效的Java EE服务器tek) - Should I package my app into wildfly/jboss modules? (or any Java EE server equivalent tek) Java EE (JBoss EAP) 自定义认证方法 JWT - Java EE (JBoss EAP) custom auth-method JWT 将Java应用程序从Jboss eap-6.3迁移到Wildfly 9 - Migrating Java application from Jboss eap-6.3 to Wildfly 9 在GlassFish Server的指定域中部署Java EE Web App - Deploying Java EE Web App in specified domain on GlassFish Server 在 WildFly 上部署 Java Web 应用程序时出现 404 错误 - Error 404 while deploying a java web app on WildFly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM