简体   繁体   English

Maven找不到生成的源(MVN全新安装)

[英]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.

相关问题 mvn全新安装找不到软件包 - mvn clean install doens't find package maven clean install等于mvn clean并在mvn安装后? - Maven clean install is equal mvn clean and after mvn install? Maven项目(Cucumber + TestNG + Selenium-Java)测试无法使用mvn clean install在命令行上运行测试 - Maven Project(Cucumber+TestNG+Selenium-Java] Test Can't Run test on command line with mvn clean install 第一次 mvn compile 找不到生成的源 - First mvn compile fails to find generated sources Maven Shade 插件:“mvn install”如何在本地存储库中包含通过“mvn package”生成的相同 jar? - Maven Shade Plugin: how 'mvn install' can include in the local repository the same jar generated through 'mvn package'? mvn clean install找不到工件 - mvn clean install Could not find artifact java maven exec-maven-plugin没有在mvn clean install上执行 - java maven exec-maven-plugin not executing on mvn clean install 运行mvn全新安装时出现Maven错误? - Getting maven error while running mvn clean install? 在Mvn Clean安装上找不到包Maven编译错误 - Package Not Found Maven Compile Error on Mvn Clean Install 从VM guest虚拟机到主机的Maven`mvn -PautoInstallPackage clean install`失败 - Maven `mvn -PautoInstallPackage clean install` fail from VM guest to host
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM