【发布时间】:2020-10-16 00:49:32
【问题描述】:
我的 springboot 应用程序构建到一个 WAR 文件中(使用 Jenkins)。我想自动远程部署到 Websphere 9。
我已经阅读过,似乎没有用于部署到 websphere 9 的 maven 插件,但 ant 支持非常好。所以,我正在使用 maven ant 插件来帮助运行这些 ant 任务。我开始尝试列出已安装的应用程序,看看它是否有效。但是我遇到了与本地化相关的异常:
[错误] C:\DEV\ant-was-deploy.xml:81: java.util.MissingResourceException:找不到基本名称的包 com.ibm.ws.profile.resourcebundle.WSProfileResourceBundle,语言环境 zh_CN
我的ant-was-deploy.xml是从pom.xml中引用的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>id123</id>
<phase>clean</phase>
<configuration>
<locales>es</locales>
<target>
<ant antfile="${basedir}/ant-was-deploy.xml">
<target name="listApps"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
ant-was-deploy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="websphere" default="listApps" basedir="." >
<target name="listApps" >
<taskdef name="wsListApps" classname="com.ibm.websphere.ant.tasks.ListApplications" classpath="${wasHome.dir}/plugins/com.ibm.ws.runtime.jar" />
<wsListApps
profileName="AppServ01"
wasHome="C:\\opt\\IBM\\WebSphere\\AppServer"
/>
</target>
</project>
我认为错误来自 com.ibm.ws.runtime.jar。里面有 WSProfileResourceBundle.class 和 WSProfileResourceBundle_en.class 但没有 WSProfileResourceBundle_en_US.class (名称只是一个假设 - 我已经在 jar 中复制了具有此名称的包,但它不起作用)。
我还尝试为整个插件设置语言环境,但似乎没有正确实现此插件的本地化(在我的情况下没有影响 - 我将语言环境设置为“es”,但仍然收到 en_US 的错误)。
我还尝试将系统参数传递给 maven 命令:mvn clean -Duser.language=fr -Duser.country=FR 它也没有工作。
那么,我的问题是是否有办法在 ant 脚本之前更改语言环境?如果我可以将其设置为“en”,它可能会找到正确的资源包。
我对 Websphere 还很陌生,如果有另一种解决方案可以自动远程部署到 websphere 9,我会很高兴听到的。我宁愿不在目标服务器或 Jenkins 插件上使用脚本,但如果没有其他方法...
【问题讨论】:
标签: maven jenkins deployment websphere