使用 javaee-api 版本 6 提供的范围会导致 wsgen 在 Maven 中失败

发布于 2025-01-08 09:33:16 字数 1527 浏览 4 评论 0原文

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

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

使用提供的不应导致编译失败。 其他人注意到了这一点,但没有在 Maven 中注意到。

Here's the relevant section from my 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>

I use wsgen from the jaxws-maven-plugin to generate web service artifacts from my @WebService java class (start from Java). My web service class injects an @EJB. I've included the javaee-api version 6 as a dependency.

Everything was working fine until I changed the javaee-api scope to provided. If I don't do this the javaee-api.jar gets included in my .war file, which I do not want.

Using provided shouldn't cause a compile failure. Someone else noticed this but not in maven.

Here's the relevant section from my pom.xml.

Thanks.

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼泪都笑了 2025-01-15 09:33:16

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

您可以在 标记内添加 标记。

有关更多详细信息,请参阅 POM 参考

Add javax:javaee-api:6.0 as a dependency to the plugin itself.

You can add a <dependencies> tag inside a <plugin> tag.

Please see the POM reference for more detail.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文