java 如何将 apache-cxf 作为依赖项包含在我的 Maven pom 中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2149111/
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-10-29 19:42:45  来源:igfitidea点击:

How can I include apache-cxf as a dependency in my Maven pom?

javamaven-2cxf

提问by Jared

Apache CXF "syncs" their releases to the Maven central repository. When I look at the CXF entries, there are no jar files, just the pom.

Apache CXF 将它们的发布“同步”到 Maven 中央存储库。当我查看 CXF 条目时,没有 jar 文件,只有 pom.jar 文件。

If I include the following section in my pom, the build fails because it can't download the cxf dependency:

如果我在 pom 中包含以下部分,构建将失败,因为它无法下载 cxf 依赖项:

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf</artifactId>
    <version>2.1.3</version>
    <type>jar</type>
</dependency>

If I change the type to "pom," the build succeeds, but the appropriate jars are not downloaded (and thus, obviously, not included in the package.)

如果我将类型更改为“pom”,则构建成功,但不会下载相应的 jar(因此,显然,不包含在包中。)

What am I missing?

我错过了什么?

采纳答案by bmargulies

See the samples. What you did was depend on the aggregate project, and that has no effect.

请参阅示例。你所做的取决于聚合项目,这没有任何影响。

Typical is :

典型的是:

  <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <!-- Jetty is needed if you're using the CXFServlet -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http-jetty</artifactId>
            <version>${cxf.version}</version>
        </dependency>

回答by rodrigoap

Point to the artifacts you need:

指向您需要的工件:

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-api</artifactId>
    <version>2.1.3</version>
    <type>jar</type>
</dependency>