使用 maven 创建整个项目的 war 文件和带有主要方法的 class 的 jar 文件(连同相关的 classes 和 jar 文件)

Creating a war file of the whole project and a jar file for a class with main method (along with the dependent classes and jar files) using maven

我有一个 CXF WS 项目,我需要从中创建整个项目的 war 文件和 class 的 jar 文件以及主要方法(连同相关的 classes 和 jar 文件)(为了代码的可重用性)使用 maven。请帮我怎么做。我需要知道我需要在 pom.xml 文件中提供什么 请指导我。

Maven 的处理方式是为每个模块创建一个工件(例如, war 或一个 jar)。由于您需要一个 jar 和一个 war,您希望至少使用两个模块。每个模块都在自己的目录中,有自己的 pom.xml 文件。据推测,war 将依赖于 jar。

Maven 有很多 support 用于多模块项目,以简化多个模块之间配置的维护和共享。