Maven: extract files from jar

前端 未结 1 1341
青春惊慌失措
青春惊慌失措 2020-12-17 21:18

I\'m developing a client application of a WebService and I have the corresponding WSDL file inside a jar.

I\'m using ant to generate the java code from the wsdl with

相关标签:
1条回答
  • 2020-12-17 21:40

    Answering to my own question, the approach I used was to extract the files from the jar.

    Actually I use maven to build the project and the antrun plugin to generate the sources from the wsdl, so I used the maven-dependency-plugin to unpack the files from the jar:

                <!-- extract WSDL and XSD from dependency jar -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>unpack</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>unpack</goal>
                            </goals>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>my.company</groupId>
                                        <artifactId>my.artifact</artifactId>
                                        <version>1.0</version>
                                        <outputDirectory>${project.build.directory}/wsdl</outputDirectory>
                                        <includes>**\/*.xsd, **\/*.wsdl</includes>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
    
    0 讨论(0)
提交回复
热议问题