我使用 jaxws-maven-plugin 中的 wsgen 从我的 @WebService java 类(从 Java 开始)生成 Web 服务 Artifact 。我的 Web 服务类注入(inject)了一个 @EJB。我已将 javaee-api 版本 6 作为依赖项包含在内。
一切都工作正常,直到我将 javaee-api 范围更改为提供。如果我不这样做,javaee-api.jar 就会包含在我的 .war 文件中,这是我不想要的。
使用提供的不会导致编译失败。 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 - 使用 javaee-api 版本 6 提供的范围会导致 wsgen 在 Maven 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9421898/