Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8bc11d456 | ||
|
|
1ea7fa968b | ||
|
|
c892fec45b | ||
|
|
7e94ea54a8 |
@@ -9,6 +9,9 @@ deploy-jar:
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
script:
|
||||
- cd springboot-launcher
|
||||
- mvn clean install
|
||||
- cd ..
|
||||
- mvn clean deploy -Dmaven.test.skip -DaltDeploymentRepository=master::default::file:/usr/local/nginx/html/kepai-repo
|
||||
- cd /usr/local/nginx/html/kepai-repo
|
||||
- git checkout master
|
||||
|
||||
38
pom.xml
38
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -28,6 +28,7 @@
|
||||
<module>springboot-message</module>
|
||||
<module>springboot-encrypt</module>
|
||||
<module>springboot-annotation</module>
|
||||
<module>springboot-launcher</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
@@ -57,55 +58,55 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-db-migration</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -126,6 +127,18 @@
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>launcher-maven-plugin</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>initScript</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
@@ -134,10 +147,7 @@
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
<!-- 打包后的jar可直接执行 -->
|
||||
<executable>true</executable>
|
||||
<embeddedLaunchScriptProperties>
|
||||
<logFolder>/dev</logFolder>
|
||||
<logFilename>null</logFilename>
|
||||
</embeddedLaunchScriptProperties>
|
||||
<embeddedLaunchScript>${basedir}/target/launchScript</embeddedLaunchScript>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
@@ -37,12 +37,13 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>launcher-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<embeddedLaunchScript>../script/launchScript</embeddedLaunchScript>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-db-migration</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
|
||||
32
springboot-launcher/pom.xml
Normal file
32
springboot-launcher/pom.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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.0</modelVersion>
|
||||
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>launcher-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>0.0.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-annotations</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.tiesheng.launcher;
|
||||
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 指定调用本类execute()方法的目标
|
||||
**/
|
||||
@Mojo(name = "initScript", defaultPhase = LifecyclePhase.PREPARE_PACKAGE)
|
||||
public class CopyLauncherScriptMojo extends AbstractMojo {
|
||||
|
||||
@Parameter(defaultValue = "${basedir}/target", required = true)
|
||||
private File outputDirectory;
|
||||
|
||||
public void setOutputDirectory(File outputDirectory) {
|
||||
this.outputDirectory = outputDirectory;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws MojoExecutionException {
|
||||
try {
|
||||
copy("launchScript");
|
||||
} catch (IOException e) {
|
||||
throw new MojoExecutionException("copy launchScript error!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 复制脚本
|
||||
*
|
||||
* @param filename
|
||||
* @throws IOException
|
||||
*/
|
||||
private void copy(String filename) throws IOException {
|
||||
InputStream inputStream = getClass().getResourceAsStream("/" + filename);
|
||||
BufferedWriter writer = null;
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
||||
File target = new File(outputDirectory + "/" + filename);
|
||||
target.setExecutable(true, false);
|
||||
target.setWritable(true, false);
|
||||
target.setReadable(true, false);
|
||||
writer = new BufferedWriter(new FileWriter(target));
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
writer.write(line);
|
||||
writer.newLine();
|
||||
}
|
||||
writer.flush();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,7 +105,7 @@ await_file() {
|
||||
}
|
||||
|
||||
# Determine the script mode
|
||||
action="run"
|
||||
action="config"
|
||||
if [[ "$MODE" == "auto" && -n "$init_script" ]] || [[ "$MODE" == "service" ]]; then
|
||||
action="$1"
|
||||
shift
|
||||
@@ -220,6 +220,21 @@ run() {
|
||||
return "$result"
|
||||
}
|
||||
|
||||
config() {
|
||||
|
||||
## 设置自启动
|
||||
ln -s $jarfile /etc/init.d/$1
|
||||
chkconfig --add $1
|
||||
|
||||
## 生成配置文件
|
||||
working_dir=$(dirname "$jarfile")
|
||||
conf_file="$working_dir/$configfile"
|
||||
echo "LOG_FOLDER=/dev" > $conf_file
|
||||
echo "LOG_FILENAME=null" >> $conf_file
|
||||
echo "RUN_ARGS='--server.port=$2 --spring.profiles.active=$3'" >> $conf_file
|
||||
echo "JAVA_OPTS='-Dfile.encoding=utf-8'" >> $conf_file
|
||||
}
|
||||
|
||||
# Call the appropriate action function
|
||||
case "$action" in
|
||||
start)
|
||||
@@ -232,8 +247,10 @@ status)
|
||||
status "$@"; exit $?;;
|
||||
run)
|
||||
run "$@"; exit $?;;
|
||||
config)
|
||||
config "$1" "$2" "$3" ; exit $?;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status|run}"; exit 1;
|
||||
echo "Usage: $0 {start|stop|restart|status|run|config}"; exit 1;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.1.9</version>
|
||||
<version>0.2.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user