vert.x - Choose Verticle name to start from Maven shell -



have maven based vert-x application contains single java verticle. @ moment i'm starting application with:

java -jar jarfile.jar 

now need add verticle project. how choose verticle start maven ? thanks

there deploymentoptions in vertx , vertx provides multiple verticles deployment option.

let's consider have mainverticle , verticle demoverticle :

 public class mainverticle extends abstractverticle {    @override   public void start(future<void> startfuture) throws exception {      vertx = this.getvertx();        // can configure deployment option    final deploymentoptions deployoptions1 = new deploymentoptions();    // using below way can deploy multiple verticles     vertx.deployverticle(demoverticle.class.getname(), deployoptions1 , deployresult -> {                 if (deployresult.succeeded()) {                     log.info(" [success]  --> " + deployresult.result());                 } else {                     log.error(" [error] --> " + deployresult.cause());                 }             });    } } 

in pom.xml have define starting main class in shade plugin, in above example mainverticle deploying other verticles

 <build>   .   .   . <plugins>         <!-- shade plugin assemble runnable fat jar -->         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-shade-plugin</artifactid>             <version>2.3</version>             <executions>                 <execution>                     <phase>package</phase>                     <goals>                         <goal>shade</goal>                     </goals>                     <configuration>                         <transformers>                             <transformer                                 implementation="org.apache.maven.plugins.shade.resource.manifestresourcetransformer">                                 <manifestentries>                                     <main-class>${main.class}</main-class>                                     <main-verticle>com.path-of-your-package.mainverticle</main-verticle>                                 </manifestentries>                             </transformer>                             <transformer                                 implementation="org.apache.maven.plugins.shade.resource.appendingtransformer">                                 <resource>meta-inf/services/io.vertx.core.spi.verticlefactory</resource>                             </transformer>                             <transformer                                 implementation="org.apache.maven.plugins.shade.resource.appendingtransformer">                                 <resource>meta-inf/services/org.opensaml.core.config.initializer</resource>                             </transformer>                         </transformers>                         <artifactset>                         </artifactset>                         <filters>                             <filter>                                 <artifact>*:*</artifact>                                 <excludes>                                     <exclude>meta-inf/*.sf</exclude>                                     <exclude>meta-inf/*.dsa</exclude>                                     <exclude>meta-inf/*.rsa</exclude>                                 </excludes>                             </filter>                         </filters>                         <outputfile>${project.build.directory}/${project.artifactid}-${project.version}-fat.jar</outputfile>                     </configuration>                 </execution>             </executions>         </plugin>    .   .   .   </build> 

i hope :)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -