【问题标题】:Using provided scope for javaee-api version 6 causes wsgen to fail in Maven为 javaee-api 版本 6 使用提供的范围会导致 wsgen 在 Maven 中失败
【发布时间】:2012-03-14 09:08:08
【问题描述】:

我使用 jaxws-maven-plugin 中的 wsgen 从我的 @WebService java 类(从 Java 开始)生成 Web 服务工件。我的 Web 服务类注入了一个 @EJB。我已将 javaee-api 版本 6 作为依赖项包含在内。

在我将 javaee-api 范围更改为提供之前,一切正常。如果我不这样做,javaee-api.jar 将包含在我的 .war 文件中,这是我不想要的。

使用 provided 不会导致编译失败。 Someone else noticed this 但不在 maven 中。

这是我的 pom.xml 中的相关部分。

谢谢。

<build>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>jaxws-maven-plugin</artifactId>
      <version>1.12</version>
      <executions>
        <execution>
          <goals>
            <goal>wsgen</goal>
          </goals>
          <configuration>
            <sei>com.co.report.reports.ws.server.ReportService</sei>
            <genWsdl>false</genWsdl>
            <keep>true</keep>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
<dependencies>
  <dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <!--   Setting <scope>provided</scope> causes compile failure -->
    <scope>provided</scope>
  </dependency>

【问题讨论】:

    标签: maven java-ee-6 wsgen


    【解决方案1】:

    添加 javax:javaee-api:6.0 作为插件本身的依赖项。

    您可以在&lt;plugin&gt; 标签内添加&lt;dependencies&gt; 标签。

    更多详情请查看POM reference

    【讨论】:

    • 解决了。不过,仍然不清楚为什么它不会在 pom 依赖项中使用 provided 进行编译。
    • 当我这样做时,我的 javax.mail 包有问题(不包括在内)
    猜你喜欢
    • 1970-01-01
    • 2011-05-31
    • 2013-09-22
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 2014-07-13
    • 2013-10-27
    • 2011-03-24
    相关资源
    最近更新 更多