@contribute
2016-06-06T08:27:59.000000Z
字数 750
阅读 1266
翻译
Maven verticle 工厂是verticle工厂的一个实现,能在运行期从maven仓库中动态加载服务。
在构建你的应用时,如果不想把服务依赖打包至你的应用,那么Maven verticle工厂对你非常有用。
Vert.x 从classpath选择VerticleFactory
实现,所以你只需确保vertx-maven-service-factory此jar包在类路径中。首先你需要添加Maven verticle工厂只你的应用的classpath中。如果你使用fat jar,你可以使用以下依赖:
- maven
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-maven-service-factory</artifactId>
<version>3.2.1</version>
</dependency>
compile 'io.vertx:vertx-maven-service-factory:3.2.1'
当在部署服务时,这个VerticleFactory
使用前缀maven:
来选择它。服务标识符是由包含服务的artifact的maven协调
The service identifier is made up of the Maven co-ordinates of the artifact that contains the service, e.g. com.mycompany:main-services:1.2 followed by a double colon :: followed by the service name.
例如,com.mycompany:main-services:1.2
后面跟随::
,后面才是服务名。