本文介绍了WebSphere和Maven的deployment.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Maven而不是RAD的内置工具转换了要构建和部署的应用程序。它大部分都很顺利,但最后一个问题是应用程序需要一个父级/应用程序的类加载器策略。我想自动执行此操作,因为目前我使用 ,它似乎完全卸载并重新安装应用程序,因此每次代码更改并重新部署应用程序时,我都必须通过管理控制台。如果我可以在部署的EAR中内置类加载器设置,那么工作会更快。

I've converted an application to be built and deployed with Maven instead of RAD's built-in tools. It's mostly gone well, but the last "gotcha" is that the application needs a class loader policy of "parent last/application". I'd like to automate this because currently, when I use the WAS plugin for Maven, it seems to uninstall and reinstall the application completely, and so I have to go through the admin console every time the code changes and the application is redeployed. If I could have the class loader settings built in to the deployed EAR, work would go much faster.

据我所知,类加载器配置是在RAD中控制的 - 托管文件,deployment.xml,位于我的EAR项目的META-INF / ibmconfig文件夹中。我猜我可以在我的EAR中包含这个目录结构,当它部署到WebSphere时它会正常工作,但我更关心这个文件的内容。它看起来像这样:

From what I can tell, class loader configuration is controlled in a RAD-managed file, "deployment.xml" which is located in my EAR project's "META-INF/ibmconfig" folder. I am guessing that I can include this directory structure in my EAR and it will work fine when it's deployed to WebSphere, but I'm more concerned about the contents of this file. It looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1460348645719">
  <deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1460348645719" startingWeight="10" warClassLoaderPolicy="SINGLE">
    <modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1460348645719" startingWeight="10000" uri="MyWarProject1.war"/>
    <modules xmi:type="appdeployment:EJBModuleDeployment" xmi:id="EJBModuleDeployment_1460348645719" startingWeight="5000" uri="MyEJBProject1.jar"/>
    <modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1460348645720" startingWeight="10000" uri="MyWarProject2.war"/>
    <classloader xmi:id="Classloader_1460348645719" mode="PARENT_LAST"/>
   ...

应用程序中的所有模块都有ID,例如 EJBModuleDeployment_1460348645719 ,我猜这些是在应用程序最初通过RAD发布到WAS时创建的。如果我将新的Maven-ized项目提供给新的开发人员,他们是否可以使用这个 deployment.xml 文件,或者是否有特定于特定文件的部分文件通常由RAD管理的WAS实例?

All of the modules in the application have IDs such as EJBModuleDeployment_1460348645719, and I'm guessing these were created when the application was originally published to WAS via RAD. If I give the new Maven-ized project to a new developer, would they be able to use this deployment.xml file or are there parts of it that are specific to a particular WAS instance that are usually managed by RAD?

此外,如果我稍后向应用程序添加更多模块,我将如何使用Maven生成新的模块ID?我可以只编一个ID,比如 EJBModuleDeployment_123 或者这是否真的应该由RAD / WAS管理?我还想知道我是否可以编写一个Jython脚本来实现这一点,并以某种方式将其与Maven集成,但我不确定这是否有用或者是否有必要。

Also, if I add more modules to the application later on, how would I generate new module IDs with Maven? Can I just make up an ID, like EJBModuleDeployment_123 or is this something that really should be managed by RAD/WAS? I was also wondering if I could write a Jython script to do this and somehow integrate that with Maven, but I'm not sure if that would work or if it's even necessary.

推荐答案

我通常使用maven部署我的应用程序,然后运行wsadmin脚本(Jython)来更改配置信息,例如(类加载器策略,共享库等)。

I usually deploy my apps with maven and then run wsadmin scripts (Jython) to change configuration info such as this (Class loader policy, Shared Libraries etc).

我通过Jenkins作业运行maven作业和wsadmin脚本,以便它们一起执行。

I run the maven job and wsadmin scripts togehter via Jenkins job so that they are performed together.

这篇关于WebSphere和Maven的deployment.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 14:38