微服务编译、启动jar命令指定配置文件

nohup java -Xms512m -Xmx8g -Xmn512m -Xss512k -server -XX:+HeapDumpOnOutOfMemoryError -jar smp-bill-controller-1.0-SNAPSHOT.jar --spring.profiles.active=test > /dev/null 2>&1 &

 

蓝色表示指定配置文件为测试环境

微服务编译、启动jar命令指定配置文件_第1张图片

 

编译时指定配置文件

mvn clean package -DskipTests=true -P uat

前提是需要在pom.xml文件中添加

 

xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>

    <groupId>cn.net.yto.retail.service.productgroupId>
    <artifactId>e-productartifactId>
    <packaging>pompackaging>
    <version>1.0-SNAPSHOTversion>
    <modules>
        <module>e-product-controllermodule>
        <module>e-product-servicemodule>
        <module>e-product-mappermodule>
    modules>

    <properties>
        <cs.dir>${basedir}/..cs.dir>
        <java.version>1.8java.version>
        <yto-framework-dependencies.version>1.0.1yto-framework-dependencies.version>
        <components.version>1.0.0components.version>
        <mybatis-generator-core.version>1.3.5mybatis-generator-core.version>
        <maven-compiler-plugin.version>3.1maven-compiler-plugin.version>
        <maven-checkstyle-plugin.version>2.17maven-checkstyle-plugin.version>
        <maven-source-plugin.version>2.4maven-source-plugin.version>
    properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>net.ytoframeworkgroupId>
                <artifactId>yto-framework-dependenciesartifactId>
                <version>${yto-framework-dependencies.version}version>
                <type>pomtype>
                <scope>importscope>
            dependency>
            <dependency>
                <groupId>org.mybatis.generatorgroupId>
                <artifactId>mybatis-generator-coreartifactId>
                <version>${mybatis-generator-core.version}version>
            dependency>
            <dependency>
                <groupId>cn.net.yto.retail.componentsgroupId>
                <artifactId>e-components-utilsartifactId>
                <version>${components.version}version>
            dependency>
            <dependency>
                <groupId>cn.net.yto.retail.componentsgroupId>
                <artifactId>e-components-dtoartifactId>
                <version>${components.version}version>
            dependency>
            <dependency>
                <groupId>cn.net.yto.retail.componentsgroupId>
                <artifactId>e-components-cacheartifactId>
                <version>${components.version}version>
            dependency>
            <dependency>
                <groupId>cn.net.yto.retail.componentsgroupId>
                <artifactId>e-components-securityartifactId>
                <version>${components.version}version>
            dependency>
        dependencies>
    dependencyManagement>
    <build>
        
            
                ${project.basedir}/src/main/resources
                true
            
        
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.pluginsgroupId>
                    <artifactId>maven-compiler-pluginartifactId>
                    <version>${maven-compiler-plugin.version}version>
                plugin>
                <plugin>
                    <groupId>org.apache.maven.pluginsgroupId>
                    <artifactId>maven-checkstyle-pluginartifactId>
                    <version>${maven-checkstyle-plugin.version}version>
                plugin>
                <plugin>
                    <groupId>org.apache.maven.pluginsgroupId>
                    <artifactId>maven-source-pluginartifactId>
                    <version>${maven-source-plugin.version}version>
                plugin>
            plugins>
        pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-compiler-pluginartifactId>
                <configuration>
                    <source>${java.version}source>
                    <target>${java.version}target>
                configuration>
            plugin>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-source-pluginartifactId>
                <configuration>
                    <attach>trueattach>
                configuration>
                <executions>
                    <execution>
                        <phase>compilephase>
                        <goals>
                            <goal>jargoal>
                        goals>
                    execution>
                executions>
            plugin>
        plugins>
    build>
    
        
            dev
            
                dev
            
        
        
            test
            
                test
            
        
        
            uat
            
                uat
            
        
        
            prod
            
                prod
            
        
    
project>

 

转载于:https://www.cnblogs.com/gcgc/p/10563016.html

你可能感兴趣的:(微服务编译、启动jar命令指定配置文件)