简体   繁体   English

axistools-maven-plugin 未从 WSDL 生成源

[英]axistools-maven-plugin not generating source from WSDL

I am using Apache Axis to generate the java source from my WSDL file.我正在使用 Apache 轴从我的 WSDL 文件中生成 java 源。 The maven run was successful without any errors but no generated classes. maven 运行成功,没有任何错误,但没有生成类。

Question : What am I missing here?问题:我在这里缺少什么?

<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.4</version>
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
                <configuration>
                    <sourceDirectory>/src/main/resources</sourceDirectory>
                    <outputDirectory>/src/main/java</outputDirectory>
                    <wsdlFiles>
                        <wsdlFile>thesourcewsdlfile.wsdl</wsdlFile>
                    </wsdlFiles>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

I am clearly not sure what is the problem with this configuration.我显然不确定这个配置有什么问题。

Try to define source and output directory bases on your maven project, that is, using standard maven properties to point to the right absolute path at runtime, changing your configuration as following: 尝试在maven项目上定义源和输出目录库,也就是说,使用标准maven属性在运行时指向正确的绝对路径,更改配置如下:

 <sourceDirectory>${basedir}/src/main/resources</sourceDirectory>
 <outputDirectory>${basedir}/src/main/java</outputDirectory>

Based on this configuration, the thesourcewsdlfile.wsdl is supposed to be located under src/main/resources/thesourcewsdlfile.wsdl 基于此配置, thesourcewsdlfile.wsdl应该位于src/main/resources/thesourcewsdlfile.wsdl

The full plugin configuration should hence be: 因此,完整的插件配置应该是:

<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>axistools-maven-plugin</artifactId>
        <version>1.4</version>
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals>
                    <goal>wsdl2java</goal>
                </goals>
                <configuration>
                    <sourceDirectory>${basedir}/src/main/resources</sourceDirectory>
                    <outputDirectory>${basedir}/src/main/java</outputDirectory>
                    <wsdlFiles>
                        <wsdlFile>thesourcewsdlfile.wsdl</wsdlFile>
                    </wsdlFiles>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

Moreover, the following dependencies must be added to the project: 此外,必须将以下依赖项添加到项目中:

<dependencies>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxrpc-api</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.1</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1</version>
    </dependency>
</dependencies>

As a general note, it would be much better to place generated sources under the target directory, since they are generated automatically and should not be added to the version control in use. 总的来说,将生成的源放在target目录下要好得多,因为它们是自动生成的,不应该添加到正在使用的版本控件中。 A standard location would then be any desired (meaningful) directory under ${project.build.directory}/generated-sources (where ${project.build.directory} is the standard property pointing to the target directory indeed). 然后,标准位置将是${project.build.directory}/generated-sources下的任何所需(有意义的)目录(其中${project.build.directory}确实是指向target目录的标准属性)。

IMHO you are missing the wsdl folder under resources , just add it and run:恕我直言,您缺少resources下的wsdl文件夹,只需添加并运行:

mvn clean generate-sources

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM