javax.enterprise.inject.Vetoed打开网络bean,哪个jar?

时间:2015-10-27 14:48:23

标签: java maven cdi openwebbeans

我想尝试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>

link似乎表明在Open Web Beans 1.5.0中添加了对@Vetoed的支持

1 个答案:

答案 0 :(得分:2)

请将geronimo-jcdi_1.0_spec升级为 jcdi_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会以某种方式忽略它吗?