是否可以在Maven中区分wsdl Web服务的多种配置?
我有可以在one application
上运行的test, stage and prod environments
。而且我必须使用一种Web服务。 Web服务具有3 different wsdl locations
。对于test, stage and prod.
在Maven中有一种方法可以说是否要为产品构建我的应用程序,而仅将Webservice位置用于产品。舞台和测试也一样吗?
我有一个wsdl导入配置,该配置对于单个非动态部件可以正常工作。
<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中创建配置文件是构建具有不同范围的不同应用程序的一种可能性。
<profiles>
<profile>
<id>prod</id>
<build>
....
</build>
</profile>
<profile>
<id>test</id>
<build>
....
</build>
</profile>
</profiles>
在配置文件属性中,您可以设置依赖关系,资源,插件,配置等。
要构建特定的配置文件,您必须键入
mvn -P
,然后输入配置文件ID就我而言,它看起来像这样:
mvn -Ptest clean install
或mvn -Pprod clean install