Giter VIP home page Giter VIP logo

maven-plugin-starter's Introduction

Maven Plugin Stater

A spring boot applicaiton quick running script.

What this?

With the rapid development of spring boot, the deployment of a service is now simpler and easier, especially the rise of microservices, docker containerization. Make the spring boot jar advantage more and more only need to use java -jar xxx.jar to start. But at the same time, for traditional enterprises and companies, do not introduce docker containerized deployment plan, and want to use jar package to start independently will encounter the following problems

  1. If you need to implement custom jvm parameters or background hangs, you need to manually write the script (each console write code is too tired)
  2. The configuration file modification in the jar is very troublesome (sometimes it needs operation and maintenance to maintain the configuration. If you have problems with the configuration, you need to repackage it. It is too time-consuming to encounter the turtle speed network copy package)
  3. A server has multiple microservices running, and it doesn't know what service is a certain process (it is known through port checking, but this seems a bit cumbersome).

In summary, this gadget automatically generates startup, stop, and restart scripts after the project is compiled. The deployment package operation and maintenance generated by the user after compilation can be run with only two lines of commands.

1: unzip xxx.war

2:sh xxx/bin/start.sh.

Note:Use tomcat war package is not within the scope of this discussion deployment.

The compiled directory structure of the project:

├── META-INF
├── WEB-INF
│   ├── classes
│   └── lib
└── bin
    ├── restart.sh
    ├── start.sh
    └── stop.sh

Feature

  • Automatically generate startup scripts during the packaging process
  • No code intrusion, no need to increase jar package dependencies
  • Support jvm parameter custom configuration
  • Support personalized startup class lookup
  • Support remote debug,jmx
  • Jps command can display the service name

Quick Start

  1. Set the package mode to war in the pom file.
	<packaging>war</packaging>
  1. The following configuration is introduced under the plugins that set the pom.xml file.
<plugin>
    <groupId>com.uyoqu.framework</groupId>
	<artifactId>maven-plugin-starter</artifactId>
	<version>1.0.0</version>
    <executions>
        <execution>
        <phase>package</phase>
        <goals>
            <goal>bin</goal>
        </goals>
        </execution>
    </executions>
</plugin> 

The plug-in supports configuration. It can specify the startup main function and jvm parameters. For Spring boot, it supports automatic query of MainClass without manual filling.

example:

<plugin>
    <groupId>com.uyoqu.framework</groupId>
	<artifactId>maven-plugin-starter</artifactId>
	<version>1.0.0</version>
    <executions>
        <execution>
        <phase>package</phase>
        <goals>
            <goal>bin</goal>
        </goals>
        </execution>      
    </executions>
  	<configuration>
            <jvms>
                <jvm>-server</jvm>
                <jvm>-Xmx512m</jvm>
            </jvms>
            <mainClass>com.xxx.xxx</mainClass>
            <matchClass>App</matchClass>
     </configuration>
</plugin>        

Note

  • The jvm parameter is configured in jvms. If the user does not perform this configuration, the default parameters will be filled in the bin script.
  • The matchClass parameter can be configured to support rules for finding matches.
  • If the mainClass is not configured, the default class with the @SpringBootApplication annotation is found.
  • There can only be one startup class, and if it matches more than one, it will report an error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.