Bläddra i källkod

Merge branch 'release/1.6.5'

tianyunperfect 4 år sedan
förälder
incheckning
00f2a76e68

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@
 # Compiled class file
 *.class
 .idea
+.github
 *.iml
 # Log file
 *.log

+ 5 - 0
CHANGELOG.md

@@ -1,5 +1,10 @@
 # 版本升级日志
 
+## 1.6.5 - 2020年11月11日
+
+- 更新打包方式
+- 增加util
+
 ## 1.6.4 - 2020年10月23日
 
 - 规范项目和模块命名规则

+ 18 - 0
rename.sh

@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+# com.alvin 公司名
+# memory  项目名
+
+if [ ! "$2" ]
+then
+  echo "请输入公司名和项目名"
+  exit 1
+fi
+
+companyName="$1"
+groupName="$2"
+
+# 修改文件
+dirName=`pwd | xargs basename`
+cd ..
+mv ${dirName} ${companyName}-parent

+ 3 - 1
springboot-common/src/main/java/com/alvin/common/entity/Result.java

@@ -54,7 +54,9 @@ public class Result<T> implements Serializable {
     }
     //endregion
 
-
+    public static <T> Result<T> byObject(T t) {
+        return byObject(t,ResultCode.UNKNOW);
+    }
     /**
      * 通过对象输出结果
      * 当对象为 true 或者不为 null 的时候返回正常

+ 3 - 3
springboot-main/bin/boot.sh

@@ -39,9 +39,7 @@ JAVA_OPTS="$JAVA_OPTS -server "
 # 垃圾收集器、设置分层编译、
 JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC -XX:+TieredCompilation"
 # 自定义配置文件和lib目录,多个目录用冒号分割
-# 已修改为分离 lib和 resource,所以 Dloader.path暂时不用
-#JAVA_OPTS="$JAVA_OPTS -Dloader.path=config -Djava.io.tmpdir=./tmp "
-JAVA_OPTS="$JAVA_OPTS -Djava.io.tmpdir=./tmp "
+JAVA_OPTS="$JAVA_OPTS -Dloader.path=config -Djava.io.tmpdir=./ "
 # 服务器模式、兼容IPV4、编码(避免乱码)、禁止代码调用gc、
 JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8  -XX:+DisableExplicitGC"
 # gc 日志
@@ -115,6 +113,8 @@ stop() {
         echo "${APP_NAME} process stop"
       fi
     done
+    # 删除临时文件
+    rm -rf ./tomcat.*
   else
     echo "There is not the process of ${APP_NAME}"
   fi

+ 1 - 80
springboot-main/pom.xml

@@ -13,92 +13,13 @@
 
     <build>
         <plugins>
-            <!-- 分离lib -->
-            <plugin>
-                <!--这个插件就是把依赖的jar包复制出来放到编译后的target/lib目录,并且在打包时候排除内部依赖-->
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-dependencies</id>
-                        <phase>prepare-package</phase>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
-                            <overWriteReleases>false</overWriteReleases>
-                            <overWriteSnapshots>false</overWriteSnapshots>
-                            <overWriteIfNewer>true</overWriteIfNewer>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <!-- 分离资源文件 -->
-            <plugin>
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-resources</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals>
-                        <configuration>
-                            <resources>
-                                <resource>
-                                    <directory>src/main/resources</directory>
-                                </resource>
-                            </resources>
-                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <!--打包jar-->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <configuration>
-                    <archive>
-                        <!-- 指定资源文件目录,与打包的jar文件同级目录 -->
-                        <manifestEntries>
-                            <Class-Path>resources/</Class-Path>
-                        </manifestEntries>
-                        <manifest>
-                            <addClasspath>true</addClasspath>
-                            <classpathPrefix>lib/</classpathPrefix>
-                            <mainClass>com.alvin.Application</mainClass>
-                        </manifest>
-                    </archive>
-                    <!-- 打包时忽略的文件(也就是不打进jar包里的文件),本例将resources下的.yml、.xml、.db文件全部排除 -->
-                    <excludes>
-                        <exclude>**/*.yml</exclude>
-                        <exclude>**/*.xml</exclude>
-                        <exclude>**/*.db</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-            <!-- spring boot repackage -->
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
+                    <fork>true</fork>
                     <layout>ZIP</layout>
-                    <includes>
-                        <include>
-                            <groupId>non-exists</groupId>
-                            <artifactId>non-exists</artifactId>
-                        </include>
-                    </includes>
                 </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
             </plugin>
         </plugins>
     </build>

+ 2 - 1
springboot-main/src/main/java/com/alvin/Application.java

@@ -15,9 +15,10 @@ public class Application implements CommandLineRunner {
     }
 
 
-
     @Override
     public void run(String... args) throws Exception {
+
         System.out.println("启动成功");
     }
+
 }

+ 23 - 0
springboot-main/src/main/java/com/alvin/controller/BaseController.java

@@ -0,0 +1,23 @@
+package com.alvin.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.ModelAttribute;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Controller
+@CrossOrigin
+public class BaseController {
+    @Autowired
+    protected HttpServletRequest request;
+    @Autowired
+    protected HttpServletResponse response;
+
+    @ModelAttribute
+    public void setReqAndRes(HttpServletRequest request, HttpServletResponse response){
+
+    }
+}