【发布时间】:2011-06-13 11:50:21
【问题描述】:
我正在尝试让 maven 3 针对两个 Web 服务端点运行 wsgen。一个是“生产”端点,位于 src/main/java 下,另一个是“测试”端点,位于 src/test/java 下。
问题是,wsgen 没有找到“测试”sei 类,因为(大概)它在类路径上只有 src/main/java。无法使用 jaxws-maven-plugin 直接设置 wsgen 类路径(它没有配置元素)。我尝试绑定到 generate-test-sources 阶段,但没有任何乐趣
这是 pom sn-p:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<!-- this works fine -->
<execution>
<id>Production</id>
<configuration>
<genWsdl>true</genWsdl>
<verbose>true</verbose>
<protocol>soap1.1</protocol>
<sei>com.foo.ws.ProductionEndPoint</sei>
<sourceDestDir>${project.build.directory}/jaxws/wsgen/src</sourceDestDir>
<destDir>${project.build.directory}/jaxws/wsgen/classes</destDir>
<packageName>com.foo.ws</packageName>
</configuration>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
<!-- this fails with Class Not Found on the sei class -->
<execution>
<phase>generate-test-sources</phase>
<id>Test</id>
<configuration>
<genWsdl>true</genWsdl>
<verbose>true</verbose>
<protocol>soap1.1</protocol>
<sei>com.foo.ws.TestEndPoint</sei>
<sourceDestDir>${project.build.directory}/jaxws/wsgen/src</sourceDestDir>
<destDir>${project.build.directory}/jaxws/wsgen/classes</destDir>
<packageName>com.foo.ws.test</packageName>
</configuration>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.1.4</version>
</dependency>
</dependencies>
</plugin>
</plugin>
</build>
【问题讨论】:
-
哦,我也尝试了 wsgen-test 目标,但是虽然将生成的代码放在目标目录下,但它不会在执行之前将 src/test/java 放在类路径中跨度>