如何在一个pom.xml中区分不同的wsdl位置-Maven [英] How to distinguish between different wsdl locations in one pom.xml - Maven

查看:114
本文介绍了如何在一个pom.xml中区分不同的wsdl位置-Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Maven中区分多个wsdl Web服务配置?

Is there a possibility to distinguish between multiple configurations of wsdl webservices in maven?

我有可以在test, stage and prod environments上运行的one application.而且我必须使用一种Web服务.该Web服务具有3 different wsdl locations.对于test, stage and prod.

I have one application which can run on test, stage and prod environments. And I have to use one webservice. The webservice has 3 different wsdl locations. For test, stage and prod.

maven中是否有一种方法可以说是否要为产品构建应用程序,只需将Webservice位置用于产品即可.舞台和测试也一样吗?

我有一个wsdl导入配置,该配置对于单个非动态零件可以很好地工作.

I have a wsdl import configuration which works fine for a single non-dynamical part.

<plugin>
 <groupId>org.jvnet.jax-ws-commons</groupId>
 <artifactId>jaxws-maven-plugin</artifactId>
 <version>2.3</version>
 <executions>
     <execution>
         <goals>
             <goal>wsimport</goal>
         </goals>
         <configuration>
             <wsdlFiles>
                 <wsdlFile>wsdlFile_live.wsdl</wsdlFile>
             </wsdlFiles>
             <vmArgs>
                 <vmArg>-Djavax.xml.accessExternalDTD=all</vmArg>
                 <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
             </vmArgs>
             <packageName>com.example.schema</packageName>
             <wsdlLocation>http://liveLocation/?wsdl</wsdlLocation>

         </configuration>
         <id>wsimport-generate-_live.wsdl</id>
         <phase>generate-sources</phase>
     </execution>
 </executions>
 <dependencies>
     <dependency>
         <groupId>javax.xml</groupId>
         <artifactId>webservices-api</artifactId>
         <version>2.0.1</version>
     </dependency>
 </dependencies>
 <configuration>
     <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
     <xnocompile>true</xnocompile>
     <verbose>true</verbose>
     <extension>true</extension>
     <catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
 </configuration>

推荐答案

在maven中创建配置文件是构建具有不同范围的不同应用程序的一种可能性.

Creating profiles in maven is one possibility to build different applications with different scopes.

<profiles>
    <profile>
        <id>prod</id>
        <build>
         ....
       </build>
    </profile>
    <profile>
        <id>test</id>
        <build>
            ....
       </build>
    </profile>  
</profiles>

在配置文件属性中,您可以设置依赖性资源插件配置等.

In the profile property you can set dependencies, resourves, plugins, configurations and so on.

要构建特定的配置文件,您必须键入mvn -P,然后输入配置文件ID

To build a specific profile you have to type mvn -P followed by the profile ID

在我看来,它是这样的:mvn -Ptest clean installmvn -Pprod clean install

In my case it looks like this: mvn -Ptest clean install or mvn -Pprod clean install

这篇关于如何在一个pom.xml中区分不同的wsdl位置-Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆