Springboot package and run the project

Start...

1, first met in springboot Bowen basis of the previous chapter on the new three profiles:
(1) the .application-dev.yml

server:
  port: 7001

(2) .application-test.yml

server:
  port: 7002

(3) .application-prod.yml

server:
  port: 7003

2, a packaging of the modified pom

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <mainClass>com.kyy.boot.SpringbootApp</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <!--<appendAssemblyId>false</appendAssemblyId>-->
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.kyy.boot.SpringbootApp</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

3, packing

mvn -Dmaven.test.skip=true assembly:assembly

4, run

java -jar kjxb-springboot-1.0-SNAPSHOT.jar -Dspring.profiles.active=prod

...End

Guess you like

Origin blog.51cto.com/11147669/2407999