yucheng 3 lat temu
rodzic
commit
fdb2bc7aed
5 zmienionych plików z 118 dodań i 70 usunięć
  1. 10 0
      fm-package/README.md
  2. 31 0
      fm-package/pom.xml
  3. 2 0
      fm-parent/README.md
  4. 74 70
      fm-parent/pom.xml
  5. 1 0
      pom.xml

+ 10 - 0
fm-package/README.md

@@ -0,0 +1,10 @@
+fm-package 包版本管理
+============ 
+
+说明
+---------------
+应用服务打包的pom依赖
+- 支持config拷贝
+
+最新变化
+---------------

+ 31 - 0
fm-package/pom.xml

@@ -0,0 +1,31 @@
+<?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">
+    <parent>
+        <artifactId>fm-parent</artifactId>
+        <groupId>com.persagy</groupId>
+        <version>3.0.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>fm-package</artifactId>
+    <version>3.0.0</version>
+    <packaging>pom</packaging>
+
+    <!-- 插件配置 -->
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>com.persagy.ServerApplication</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 2 - 0
fm-parent/README.md

@@ -3,6 +3,8 @@ fm-parent 包版本管理
 
 说明
 ---------------
+公共依赖的pom
+- 生成代码jar包的组件继承此pom。应用服务应继承fm-package。
 
 最新变化
 ---------------

+ 74 - 70
fm-parent/pom.xml

@@ -27,6 +27,7 @@
         <fm.version>3.0.0</fm.version>
         <platform.version>1.0.0</platform.version>
         <mybatis-plus.version>3.3.1</mybatis-plus.version>
+        <dynamic-datasource.version>3.3.2</dynamic-datasource.version>
         <tomcat-jdbc.version>9.0.31</tomcat-jdbc.version>
         <HikariCP.version>3.2.0</HikariCP.version>
         <mysql.version>8.0.15</mysql.version>
@@ -35,7 +36,12 @@
         <spring-data.version>2.1.17.RELEASE</spring-data.version>
         <spring-data-jpa.version>2.0.11.RELEASE</spring-data-jpa.version>
         <mapstruct.version>1.2.0.Final</mapstruct.version>
-        <druid-spring-boot-starter.version>1.1.22</druid-spring-boot-starter.version>
+        <druid.version>1.1.22</druid.version>
+        <!-- Plugins -->
+        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
+        <spring-boot-maven-plugin.version>2.4.3</spring-boot-maven-plugin.version>
+        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
+        <maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
     </properties>
 
     <dependencyManagement>
@@ -52,6 +58,16 @@
             </dependency>
             <dependency>
                 <groupId>com.persagy</groupId>
+                <artifactId>fm-mybatis</artifactId>
+                <version>${fm.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.persagy</groupId>
+                <artifactId>fm-translate</artifactId>
+                <version>${fm.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.persagy</groupId>
                 <artifactId>integrated-common-core</artifactId>
                 <version>${platform.version}</version>
             </dependency>
@@ -81,6 +97,11 @@
                 <artifactId>mybatis-plus-boot-starter</artifactId>
                 <version>${mybatis-plus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+                <version>${dynamic-datasource.version}</version>
+            </dependency>
             <!-- mapstruct 优雅的进行bean与dto的转换 -->
             <dependency>
                 <groupId>org.mapstruct</groupId>
@@ -96,7 +117,7 @@
             <dependency>
                 <groupId>com.alibaba</groupId>
                 <artifactId>druid-spring-boot-starter</artifactId>
-                <version>${druid-spring-boot-starter.version}</version>
+                <version>${druid.version}</version>
             </dependency>
             <!-- 以下是数据库连接池版本管理,建议使用provided方式引入-->
             <dependency>
@@ -218,108 +239,91 @@
 
     <!-- 插件配置 -->
     <build>
+        <finalName>${project.artifactId}</finalName>
         <pluginManagement>
             <plugins>
                 <!-- compiler插件, 设定JDK版本 -->
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
-                    <version>3.7.0</version>
+                    <version>${maven-compiler-plugin.version}</version>
                     <configuration>
                         <source>${java.version}</source>
                         <target>${java.version}</target>
+                        <encoding>UTF-8</encoding>
+                        <skip>true</skip>
                         <showWarnings>true</showWarnings>
                     </configuration>
                 </plugin>
-                <!-- resource插件 -->
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-resources-plugin</artifactId>
-                    <version>3.0.2</version>
-                </plugin>
-
-                <!-- test插件, 仅测试名称为*Test的类, 使用支持分组测试的surefire-junit47 driver -->
                 <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.20.1</version>
-                    <configuration>
-                        <includes>
-                            <include>**/*Test.java</include>
-                            <include>**/*Test.scala</include>
-                        </includes>
-                        <skipTests>true</skipTests>
-                    </configuration>
-                    <dependencies>
-                        <dependency>
-                            <groupId>org.apache.maven.surefire</groupId>
-                            <artifactId>surefire-junit4</artifactId>
-                            <version>2.18.1</version>
-                        </dependency>
-                    </dependencies>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-maven-plugin</artifactId>
+                    <version>${spring-boot-maven-plugin.version}</version>
                 </plugin>
-
-                <!-- war打包插件, 设定war包名称不带版本号 -->
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-war-plugin</artifactId>
-                    <version>3.2.3</version>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <version>${maven-source-plugin.version}</version>
                     <configuration>
-                        <warName>${project.artifactId}${fm.version}</warName>
-                        <failOnMissingWebXml>false</failOnMissingWebXml>
+                        <attach>true</attach>
                     </configuration>
-                </plugin>
-
-                <!-- jar打包相关插件 -->
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-jar-plugin</artifactId>
-                    <version>3.1.0</version>
                     <executions>
                         <execution>
+                            <phase>compile</phase>
                             <goals>
-                                <goal>test-jar</goal>
+                                <goal>jar</goal>
                             </goals>
                         </execution>
                     </executions>
-                    <configuration>
-                        <archive>
-                            <manifest>
-                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
-                            </manifest>
-                        </archive>
-                    </configuration>
                 </plugin>
+                <!-- resource插件 -->
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-source-plugin</artifactId>
-                    <version>3.0.1</version>
-                    <configuration>
-                        <attach>true</attach>
-                    </configuration>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>${maven-resources-plugin.version}</version>
                     <executions>
                         <execution>
-                            <phase>compile</phase>
+                            <id>copy-resources</id>
+                            <phase>package</phase>
                             <goals>
-                                <goal>jar</goal>
+                                <goal>copy-resources</goal>
                             </goals>
+                            <configuration>
+                                <resources>
+                                    <resource>
+                                        <directory>src/main/resources/</directory>
+                                        <includes>
+                                            <include>**/*.yml</include>
+                                        </includes>
+                                    </resource>
+                                    <resource>
+                                        <directory>${project.build.directory}</directory>
+                                        <includes>
+                                            <include>**/version.txt</include>
+                                        </includes>
+                                    </resource>
+                                </resources>
+                                <outputDirectory>${project.build.directory}/config</outputDirectory>
+                            </configuration>
+                        </execution>
+                        <!--拷贝启动脚本-->
+                        <execution>
+                            <id>copy-version</id>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>copy-resources</goal>
+                            </goals>
+                            <configuration>
+                                <resources>
+                                    <resource>
+                                        <directory>src/script</directory>
+                                    </resource>
+                                </resources>
+                                <outputDirectory>${project.build.directory}</outputDirectory>
+                            </configuration>
                         </execution>
                     </executions>
                 </plugin>
-
-                <!-- clean插件 -->
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-clean-plugin</artifactId>
-                    <version>3.0.0</version>
-                </plugin>
-
-                <!-- install插件 -->
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-install-plugin</artifactId>
-                    <version>2.5.2</version>
-                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>

+ 1 - 0
pom.xml

@@ -26,5 +26,6 @@
         <module>fm-translate</module>
         <module>fm-mybatis</module>
         <module>fm-screw</module>
+        <module>fm-package</module>
     </modules>
 </project>