【发布时间】:2015-09-25 18:38:49
【问题描述】:
将 Eclipse Luna 与 m2eclipse 结合使用,我有一个父 Maven 项目 (facturas_root) 和两个继承自它的 Maven 模块(sharepoint_ws 和 api_sharepoint)。
sharepoint_ws 仅用于生成 JAXWS 类以连接到 Sharepoint WebServices,因此我下载了相关的 WSDL 并将其包含为项目的资源。在generate-sources 阶段,它可以正常工作并生成target\generated-sources\ws-consume\mypackage\ 中的源。
现在,问题是我让api_sharepoint 导入了sharepoint_ws 依赖项,但它没有检测到任何类。我认为这是因为生成的类不在src/main/java,所以我添加了一个插件将它们复制到那里。现在,问题是sharepoint_ws在编译阶段,找到了每个类的两次源文件,并抛出错误。
我的 pom.xml -> 构建
<plugins>
<!-- clean /src/main/java and /target/generated-sources -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/src/main/java/es</directory>
</fileset>
<fileset>
<directory>${basedir}/target/generated-sources</directory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
<!-- generate jaxws -->
<plugin>
<groupId>org.jboss.ws.plugins</groupId>
<artifactId>maven-jaxws-tools-plugin</artifactId>
<version>1.1.2.Final</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsconsume</goal>
</goals>
<configuration>
<wsdls>
<wsdl>${basedir}/resources/lists.wsdl</wsdl>
</wsdls>
<targetPackage>es.ssib.otic.facturas.sharepoint_ws</targetPackage>
<outputDirectory>${basedir}/target/generated-sources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy sources -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/generated-sources/wsconsume</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
为了尝试排除target/generated-sources,我添加了这个:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<configuration>
<excludes>
<exclude>**/target/generated-sources/*.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
如上所述,我确实评论了“复制”插件,依赖于sharepoint_ws 的模块没有任何可用的类;我确实使用它,但在
[错误] /C:/Users/s004256/workspace/facturas_root/sharepoint_ws/src/main/java/es/ssib/otic/facturas/sharepoint_ws/DeleteList.java:[34,8] 重复类:es。 ssib.otic.facturas.sharepoint_ws.DeleteList
对于每个生成的列表。
【问题讨论】: