0

我想试用 Open Web Beans 1.6.2,但它在其网站上列出的用于向 Java SE 应用程序添加 CDI 支持的 jar

openwebbeans-spi.jar
openwebbeans-impl.jar
geronimo-jcdi_1.0_spec.jar
geronimo-atinject_1.0_spec.jar
geronimo-interceptor_1.2_spec.jar
geronimo-annotation_1.2_spec.jar

似乎不包含javax.enterprise.inject.Vetoed注释,我必须添加 cdi-api 1.2 作为依赖项来解决问题,但我不确定这是否正确,因为所有其他 CDI 依赖项都已通过上述解决?这是我在 pom 中的依赖项,这是正确的吗?

    <dependency>
        <groupId>org.apache.openwebbeans</groupId>
        <artifactId>openwebbeans-impl</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.openwebbeans</groupId>
        <artifactId>openwebbeans-spi</artifactId>
        <version>1.6.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jcdi_1.0_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-atinject_1.0_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-interceptor_1.2_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-annotation_1.2_spec</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>1.2</version>
    </dependency>

链接似乎表明@Vetoed在 Open Web Beans 1.5.0 中添加了对

4

1 回答 1

2

请升级geronimo-jcdi_1.0_specjcdi_1.1版本

<dependency>
  <groupId>org.apache.geronimo.specs</groupId>
  <artifactId>geronimo-jcdi_1.1_spec</artifactId>
  <version>1.0</version>
</dependency>

尽管您的问题很奇怪,因为您还有以下条目:

<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
    <version>1.2</version>
</dependency

其中也包含@Vetoed,因此应该足够了。maven会以某种方式忽略它吗?

于 2015-10-28T08:16:31.360 回答