java IBM Websphere 包的 Maven 依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36564098/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 01:35:50  来源:igfitidea点击:

Maven dependencies for IBM Websphere packages

javamavenwebsphere-8

提问by bish

I'm trying to convert a "classic" JAVA EE project, using IBM websphere 8.0.0.5, into a maven multi module project and facing issues with the IBM dependecies.

我正在尝试将使用 IBM websphere 8.0.0.5 的“经典”JAVA EE 项目转换为 maven 多模块项目,并面临 IBM 依赖项的问题。

We use IBM classes from the following packages:

我们使用以下包中的 IBM 类:

  • com.ibm.websphere.asynchbeans
  • com.ibm.websphere.scheduler
  • com.ibm.websphere.ce.cm
  • com.ibm.ws.asynchbeans
  • com.ibm.ws.util.ThreadPool
  • com.ibm.websphere.asynchbeans
  • com.ibm.websphere.scheduler
  • com.ibm.websphere.ce.cm
  • com.ibm.ws.asynchbeans
  • com.ibm.ws.util.ThreadPool

To get my local project to be compiled I downloaded the was.installer-8.0.0.pm from IBMand installed it to my maven using

为了编译我的本地项目,我从IBM下载了 was.installer-8.0.0.pm并使用

mvn install -f "was.installer-8.0.0.pom" -D serverInstallationFolder="C:\Program Files (x86)\IBM\WebSphere\AppServer"

This step was successfull according to command line output.

根据命令行输出,此步骤成功。

I then added the following dependencies to my project as described from IBM:

然后我将以下依赖项添加到我的项目中,如 IBM 所述:

In parent:

在父级:

<dependency>
 <groupId>com.ibm.tools.target</groupId>
 <artifactId>was</artifactId>
 <version>8.0.0</version>
 <type>pom</type>
 <scope>provided</scope>
</dependency>

In module:

在模块中:

 <dependency>
   <groupId>com.ibm.tools.target</groupId>
   <artifactId>was</artifactId>
 </dependency>      

But I still can't compile my project as the IBM packages are not found.

但是我仍然无法编译我的项目,因为没有找到 IBM 包。

Can anyone help me to find and correct a mistake I made?

谁能帮我找出并纠正我犯的错误?

Edit

编辑

After following BevynQ tip from the comments I copied the "was_public.jar" to "was_public-8.0.0.jar" (described at IBM here) and added it to my repository:

从评论中遵循 BevynQ 提示后,我将“was_public.jar”复制到“was_public-8.0.0.jar”(在IBM 此处描述)并将其添加到我的存储库中:

mvn install:install-file -Dfile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.jar" -DpomFile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.pom"

I then changed the dependencies to:

然后我将依赖项更改为:

<dependency>
 <groupId>com.ibm.websphere.appserver</groupId>
 <artifactId>was_public</artifactId>
 <version>8.0.0</version>
 <scope>provided</scope>
</dependency>

 <dependency>
   <groupId>com.ibm.websphere.appserver</groupId>
   <artifactId>was</artifactId>
 </dependency>    

This helped to get the compiling errors for the imports to com.ibm.webspheredone.

这有助于解决导入的编译错误com.ibm.websphere

What I now have still open is the packages com.ibm.ws.*package. Anyone have an idea?

我现在仍然打开的是com.ibm.ws.*包包。有人有想法吗?

Edit 2I added the following dependency and then I was rid of the com.ibm.ws.*import errors.

编辑 2我添加了以下依赖项,然后我摆脱了com.ibm.ws.*导入错误。

<dependency>
  <groupId>com.ibm.websphere.ws</groupId>
  <artifactId>com.ibm.ws.runtime</artifactId>
  <version>1.0.0</version>
</dependency> 

But it still does not compile as now indirectly references can not be found (in my case commonj.work.WorkManager). It seems I need to add further .jars for every single thing. Isn't there an easier way to provide all websphere jars at once as descirbe in the above linked tutorial with the com.ibm.toolsdependency (which do not work)?

但它仍然无法编译,因为现在无法找到间接引用(在我的情况下commonj.work.WorkManager)。似乎我需要为每一件事添加更多的 .jars。在上面链接的教程中,没有更简单的方法来一次性提供所有 websphere jars 作为描述与com.ibm.tools依赖项(不起作用)?

采纳答案by bish

Here's the solution so I solved my dependency problems:

这是解决方案,所以我解决了我的依赖问题:

  1. I configured the company repository manager (nexus) as a mirror. In this nexus all ibm packages are present. As you can think that solved the main problem.
  2. I then added the following dependencies according to common maven style:
  1. 我将公司存储库管理器(nexus)配置为镜像。在这个关系中,所有 ibm 包都存在。你可以认为这解决了主要问题。
  2. 然后我根据常见的 maven 风格添加了以下依赖项:

Dependencies in pom.xml(version numbers extracted to properties):

依赖项pom.xml(提取到属性的版本号):

<dependency>
  <groupId>com.ibm.websphere.ws</groupId>
  <artifactId>com.ibm.ws.runtime</artifactId>
  <version>${ibm.ws.runtime.version}</version>
</dependency>


<dependency>
  <groupId>com.ibm.ws.prereq</groupId>
  <artifactId>commonj-twm</artifactId>
  <version>${ibm.ws.prereq.commonj-twm.version}</version>
</dependency>

Sorry I can't provide a "nice" solution that's useable by all people but the answer from njrand the comment from BevynQhelped at lot to get clearer with the problem and helped to solve the problem in a "more manual" way by copying the needed jars by hand.

对不起,我不能提供一个“好”的解决方案,是由所有的人都可用,但在回答NJR和评论BevynQ帮助在很多让这个问题更加清晰,有助于通过复制来解决在“更多的手工”的方式问题手工制作所需的罐子。

回答by njr

In general, com.ibm.websphereare public API for use by applications (this is true of the packages you listed above) which is consistent with these being in was_public.jar

一般来说,com.ibm.websphere应用程序使用的公共 API(对于您上面列出的包都是如此)与这些是一致的was_public.jar

However, com.ibm.wspackage is generally product internals. May I ask what interface methods you are using from the com.ibm.ws.asynchbeanspackage? Maybe there is a public API alternative.

然而,com.ibm.ws包通常是产品内部。请问你在com.ibm.ws.asynchbeans包中使用了哪些接口方法?也许有一个公共 API 替代方案。

Regarding commonj.work, the only place I can find this in the WebSphere Application Server product image is WAS/plugins/com.ibm.ws.prereq.commonj-twm.jarso it looks like you will need to use that to compile against.

关于commonj.work,我可以在 WebSphere Application Server 产品图像中找到它的唯一地方是 WAS/plugins/com.ibm.ws.prereq.commonj-twm.jar,您似乎需要使用它来进行编译。

回答by Ebony Maw

I was facing this issue as I tried to build a project using Maven version 3.3.9, running on Java version 1.8.0_101, as depicted in the screenshot:

我在尝试使用 Maven 版本 3.3.9 构建项目时遇到了这个问题,该项目在 Java 版本 1.8.0_101 上运行,如屏幕截图所示:

enter image description here

在此处输入图片说明

This is how I resolved it: Step 1.Download the commonj.jar from here. Step 2.Determine which JDK your Maven is using by typing mvn -versionin the command prompt. enter image description here

我是这样解决的:步骤 1.这里下载 commonj.jar 。 步骤 2.通过mvn -version在命令提示符中键入来确定您的 Maven 正在使用哪个 JDK 。在此处输入图片说明

Step 3.Go to that directory and place the commonj.jarfile there in the jre/lib/extdirectory, as shown below. Now your project should build in maven without any issues.

步骤 3.转到该目录并将commonj.jar文件放在该jre/lib/ext目录中,如下所示。现在您的项目应该在 Maven 中构建而没有任何问题。

enter image description here

在此处输入图片说明