[英]maven can't find generated sources (mvn clean install)
I've just got the problem some hours ago and it always seemd to working until now. 几个小时前我才遇到问题,直到现在看来它一直都在起作用。
I generate code in my pom on the following way: 我通过以下方式在pom中生成代码:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<configuration>
<sourceDestDir>${basedir}/target/generated/java</sourceDestDir>
<keep>true</keep>
<verbose>true</verbose>
<extension>true</extension>
<wsdlDirectory>${basedir}/src/main/resources/META-INF</wsdlDirectory>
</configuration>
<executions>
<execution>
<id>ecad-ws</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>wsdl/ECadDocumentServiceWSDL.wsdl</wsdlFile>
</wsdlFiles>
<staleFile>${project.build.directory}/jaxws/stale/wsdl.ECadDocumentServiceWSDL.done</staleFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${basedir}/src/main/resources/META-INF/xsd</schemaDirectory>
<packageName>be.fgov.health.ecad.xmlstructure</packageName>
<outputDirectory>${basedir}/target/generated/java</outputDirectory>
</configuration>
</plugin>
and I use those generated classes in my project. 然后在项目中使用这些生成的类。 If I then do a "right click -> maven -> clean" + "right click -> maven -> install" everything is working.
如果然后执行“右键单击-> maven->清洁” +“右键单击-> maven->安装”,则一切正常。 But when I run mvn clean install -DskipTest=true, then maven can't find the generated sources.. I'm stuck for several hours already and can't really find it.
但是,当我运行mvn clean install -DskipTest = true时,maven无法找到生成的源。.我已经被困了几个小时了,无法真正找到它。 (doing this in Eclipse btw)
(在Eclipse btw中执行此操作)
EDIT: 编辑:
just figured out the following: If I remove the second plugin (to generate by xsd) I won't get any error.. If I put all the code that uses thoes generated classes in comment ofc. 只是想出了以下几点:如果我删除了第二个插件(由xsd生成),我不会得到任何错误。
Another EDIT: 另一个编辑:
I've changed the outputDirectory from the jaxb generation and now it's working. 我已经从jaxb一代更改了outputDirectory,现在它可以工作了。 Can anyone explain me why it can't be the same as the wsimport location?
谁能解释一下为什么它不能与wsimport位置相同?
By default, the jaxb2-maven-plugin
deletes the outputDirectory
before putting the generated classes inside. 默认情况下,
jaxb2-maven-plugin
在将生成的类放入内部之前会删除outputDirectory
。
You can control this behaviour with the attribute clearOutputDir
. 您可以使用属性
clearOutputDir
控制此行为。 Your plugin configuration would then look like : 您的插件配置如下所示:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${basedir}/src/main/resources/META-INF/xsd</schemaDirectory>
<packageName>be.fgov.health.ecad.xmlstructure</packageName>
<outputDirectory>${basedir}/target/generated/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.