Am正在将应用程序从websphere迁移到websphere liberty,并且必须迁移JSf-bean验证组件。如何使用Maven将WLP功能添加到web项目中。我已经添加了
<dependency>
<groupId>net.wasdev.maven.tools.targets</groupId>
<artifactId>liberty-target</artifactId>
<version>RELEASE</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
但这并没有给我带来JSF和bean验证相关的类。
我建议遵循Open Liberty指南中的示例:
https://openliberty.io/guides/getting-started.html
基本方法包括:
-
使用聚合依赖项进行编译:
<dependency> <groupId>jakarta.platform</groupId> <artifactId>jakarta.jakartaee-api</artifactId> <version>8.0.0</version> <scope>provided</scope> </dependency>
-
使用server.xml进行细粒度功能启用,只激活您正在使用的功能,因此对于您提到的功能,您可能有:
<server description="Sample Liberty server"> <featureManager> <feature>beanValidation-2.0</feature> <feature>jsf-2.3</feature> <feature>cdi-2.0</feature> <!-- .... --> </featureManager>
另外请注意,虽然这与您的问题没有直接关系,但您也可以确保使用freedom maven插件的3.x版本,并带有";开发模式";以及许多其他有用的功能:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.2</version>
</plugin>