Pārlūkot izejas kodu

打包问题修改

anderx 2 gadi atpakaļ
vecāks
revīzija
22350e1c72

+ 1 - 1
ruoyi-admin/mvn clean package -P prod.cmd

@@ -1 +1 @@
-mvn clean package -P prod
+mvn clean install package -P prod

+ 23 - 4
ruoyi-admin/pom.xml

@@ -68,14 +68,14 @@
         <!--开发-->
         <profile>
             <id>dev</id>
-            <properties>
-                <!-- 环境标识,需要与配置文件的名称相对应 -->
-                <activatedEnv>dev</activatedEnv>
-            </properties>
             <activation>
                 <!-- 默认环境 -->
                 <activeByDefault>true</activeByDefault>
             </activation>
+            <properties>
+                <!-- 环境标识,需要与配置文件的名称相对应 -->
+                <activatedEnv>druid-dev</activatedEnv>
+            </properties>
         </profile>
         <!--生产-->
         <profile>
@@ -88,6 +88,25 @@
 
 
     <build>
+        <resources>
+            <!-- 将所有application开头的yaml文件排除,可以排除多个 -->
+            <resource>
+                <directory>src/main/resources</directory>
+                <excludes>
+                    <exclude>application*.yml</exclude>
+                </excludes>
+            </resource>
+
+            <!-- 根据激活条件引入打包所需的配置文件,可以引入多个 -->
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>application.yml</include>
+                    <include>application-${activatedEnv}.yml</include>
+                </includes>
+            </resource>
+        </resources>
         <finalName>kede-yfdk</finalName>
         <plugins>
             <plugin>

+ 2 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -5,8 +5,8 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-#    active: druid-dev
-    active: druid-prod
+    active: @activatedEnv@
+#    active: druid-prod
   #   文件上传
   servlet:
     multipart: