Springboot package deployment code instance

Time:2020-8-23

This article mainly introduces the spring boot package deployment code example, the article through the example code introduction is very detailed, has the certain reference study value to everybody’s study or the work, needs the friend may refer to

  • First type it into war package or jar package
  • Using java – jar test1 – 0.0.1- SNAPSHOT.jar Run it

Common dependencies


<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <encoding>utf-8</encoding>
      </configuration>
    </plugin>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <configuration>
        <mainClass>com.royal.app.App</mainClass>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>repackage</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
  
  <resources>
   <resource>
    <directory>src/main/java</directory>
    <includes>
     <include>**/*.xml</include>
    </includes>
   </resource>
   <resource>
    <directory>src/main/resources</directory>
    <includes>
     <include>**/*.*</include>
    </includes>
   </resource>
  </resources>

</build>

Or use the following code to specify the JDK version


 <properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>
 </properties>

The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.