公众平台网站开发哪家好,网上询价,做网站前台用什么问题,2019 做网站在上一篇文章中#xff0c;我描述了如何使用OpenLiberty和maven作为独立服务器或maven构建的一部分来启动服务器#xff0c;以及如何创建fatjar包。 在这篇文章中#xff0c;我正在研究如何使用Wildfly群。 我仍在尝试使MicroProfile在Wildfly full上运行#xff0c;因此我描述了如何使用OpenLiberty和maven作为独立服务器或maven构建的一部分来启动服务器以及如何创建fatjar包。 在这篇文章中我正在研究如何使用Wildfly群。 我仍在尝试使MicroProfile在Wildfly full上运行因此到目前为止该示例与OpenLiberty示例的工作方式不同。 我使用的是同一个示例项目 其中包含更多的maven配置文件以运行不同的部署选项。 请参阅https://github.com/phillip-kruger/javaee-servers-parent 示例项目 我想包含一些MicroProfile功能因此这是一个“每日报价”应用程序而不是基本的“ Hello world”。 我的应用程序使用工厂加载报价提供程序目前只有一个。 当前提供者从forismatic.com获得报价。 我使用MicroProfile Configuration API配置诸如URL和要加载的提供程序之类的东西。 我使用MicroProfile Fault Tolerance API来确保在提供程序源不可用时我们能够生存。 您可以在此处获取完整的示例项目 https : //github.com/phillip-kruger/quote-service 作为Maven构建的一部分运行 您可以使用wildfly-swarm-plugin运行 mvn wildfly-swarm:run 作为构建一部分的wildfly swarm实例。 该插件将执行“分数检测”这意味着它将查看您需要的应用服务器的哪些部分并且仅创建包含这些分数的部署。 因此您仍然可以将伞状API包含在依赖关系中并针对这些依赖关系进行编码但是在部署时您将获得正确的大小分布。 好酷 dependencies!-- Java EE --dependencygroupIdjavax/groupIdartifactIdjavaee-api/artifactIdversion${java-ee.version}/versionscopeprovided/scope/dependency!-- MicroProfile --dependencygroupIdorg.eclipse.microprofile/groupIdartifactIdmicroprofile/artifactIdversion${microProfile.version}/versiontypepom/typescopeprovided/scope/dependency/dependencies 在包含引用webjars的 HTML文件时我总是使用过滤但是似乎插件在应用过滤器之前使用了原始源文件因此我不得不寻找一种替代方法。 plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-war-plugin/artifactIdversion3.0.0/versionconfigurationwebResourcesresourcedirectory${basedir}/src/main/webapp/directoryfilteringtrue/filteringincludesinclude**/*.css/includeinclude**/*.jsp/include/includes/resource/webResources/configuration/plugin 在此示例中我使用语义UI来构建显示当天报价的网页 我将maven属性用于HTML中CSS和JS版本并且在构建时需要用实际值替换它们 link relstylesheet typetext/css hrefwebjars/semantic-ui/${semantic-ui.version}/dist/semantic.min.cssscript typetext/javascript srcwebjars/jquery/${jquery.version}/dist/jquery.min.js /script typetext/javascript srcwebjars/semantic-ui/${semantic-ui.version}/dist/semantic.min.js/script 作为替代我使用包目标然后使用exec-maven-plugin运行jar。 这也使我可以传递standalone.xml进行任何其他配置 plugingroupIdorg.wildfly.swarm/groupIdartifactIdwildfly-swarm-plugin/artifactIdexecutionsexecutionid1/idphasepre-integration-test/phasegoalsgoalpackage/goal/goals/execution/executions/pluginplugingroupIdorg.codehaus.mojo/groupIdartifactIdexec-maven-plugin/artifactIdversion1.6.0/versionexecutionsexecutionid1/idphasepost-integration-test/phasegoalsgoalexec/goal/goals/execution/executionsconfigurationexecutablejava/executableargumentsargument-jar/argumentargument${project.build.directory}${file.separator}${project.artifactId}-swarm.jar/argumentargument-c/argumentargument${project.build.directory}${file.separator}standalone.xml/argument/arguments/configuration/plugin 在我的情况下 standalone.xml仅包含日志记录配置但是您现在可以包括任何其他配置。 server xmlnsurn:jboss:domain:4.0profilesubsystem xmlnsurn:jboss:domain:logging:3.0periodic-rotating-file-handler nameFILE autoflushtruefile path${wildfly-swarm.logfile}/suffix value.yyyy-MM-dd/append valuetrue//periodic-rotating-file-handlerroot-loggerlevel nameINFO/handlershandler nameFILE//handlers/root-loggerlogger category${log.name}level name${log.level}//logger/subsystem/profile/server 因此在qoute-service示例中您可以执行此操作与OpenLiberty示例相同 mvn clean install -P wildfly-swarm-fatjar Hollowjar Wildfly群可让您创建空心罐。 请参阅本文 也就是说没有应用程序的胖子仅仅是应用程序服务器的一部分。 然后您可以将应用程序作为命令行输入提供 java -jar myapp-hollow-swarm.jar myapp.war 因此如果我们能找到一种方法来重新加载应用程序部分那么我们可以拥有与完整应用程序相同的开发模型热部署。 部署扫描器 Wildfly群有一个称为Deployment Scanner的部分您可以将其包含在您的发行版中胖或空心。 分数检测将不会自动检测到此因为在代码中没有对此的引用。 幸运的是您可以在Maven中定义其他分数 plugingroupIdorg.wildfly.swarm/groupIdartifactIdwildfly-swarm-plugin/artifactIdexecutionsexecutionphasepre-integration-test/phasegoalsgoalpackage/goal/goals/execution/executionsconfigurationhollowtrue/hollowadditionalFractionsscanner/additionalFractions/configuration/plugin 为了使扫描程序工作将其添加到standalone.xml subsystem xmlnsurn:jboss:domain:deployment-scanner:2.0deployment-scanner scan-enabledtruescan-interval5000 path/tmp/quote-service/wildfly-swarm/deployments namequote-service auto-deploy-xmlfalse/ /subsystem 如果现在将应用程序的更新版本移至定义的路径则可以进行热部署。 在引用示例中这意味着您可以 mvn clean install -P wildfly-swarm-start启动服务器 mvn clean install -P wildfly-swarm-deploy热部署到正在运行的服务器 mvn clean install -P wildfly-swarm-stop停止正在运行的服务器 您还可以创建一个胖子 mvn全新安装-P软件包 节约时间 建立和启动胖子大约需要10秒钟 。 热部署大约需要2.7秒 。 这节省了大量时间从而使更改之间的周转时间更快。 翻译自: https://www.javacodegeeks.com/2018/01/hollowjars-deployment-scanner-wildfly-swarm-cool.html