使用maven-jaxb2-plugin从多个wsdl文件生成类

时间:2016-05-03 10:45:03

标签: maven wsdl jaxb2 maven-jaxb2-plugin

我可以从一个wsdl文件生成类,如下所示:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.12.3</version>
    <configuration>
        <schemaLanguage>WSDL</schemaLanguage>
        <schemaDirectory>src/main/resources</schemaDirectory>
        <schemaIncludes>
            <include>bwl_1_1.wsdl</include>
        </schemaIncludes>
        <generatePackage>bwl.wsdl</generatePackage>
        <generateDirectory>${project.build.directory}/generated-sources/bwl</generateDirectory>
    </configuration>
</plugin>

当我尝试使用多个<plugin>时,只会生成其中一个<executions>。我发现如果我想从多个文件生成类,我应该使用<configuration>。但是,当我将<executions>包装到 <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.12.3</version> <executions> <execution> <id>bwl</id> <goals> <goal>generate</goal> </goals> <configuration> <schemaLanguage>WSDL</schemaLanguage> <schemaDirectory>src/main/resources</schemaDirectory> <schemaIncludes> <include>bwl_1_1.wsdl</include> </schemaIncludes> <generatePackage>bwl.wsdl</generatePackage> <generateDirectory>${project.build.directory}/generated-sources/bwl</generateDirectory> </configuration> </execution> <execution> <id>score</id> <goals> <goal>generate</goal> </goals> <configuration> <schemaLanguage>WSDL</schemaLanguage> <schemaDirectory>src/main/resources</schemaDirectory> <schemaIncludes> <include>score_1_1.wsdl</include> </schemaIncludes> <generatePackage>score.wsdl</generatePackage> <generateDirectory>${project.build.directory}/generated-sources/score</generateDirectory> </configuration> </execution> </executions> </plugin> 中时,它不再生成,实际上它会从目录中的xsd文件生成一些内容...

我的工作没有尝试:

extension UITextField {
    static func textFieldWithFont(font : UIFont, tintColor : UIColor) -> UITextField {
        let textField = UITextField()
        textField.tintColor = tintColor
        textField.font = font
        return textField
    }
}

谢谢。

1 个答案:

答案 0 :(得分:1)

${basedir}标记中的路径前添加<schemaDirectory>,如下所示

  

<schemaDirectory>${basedir}/src/main/resources</schemaDirectory>

然后它应该工作!