Skip to content

Commit

Permalink
maven打包 By foxlish
Browse files Browse the repository at this point in the history
  • Loading branch information
aiwenmo committed Jul 1, 2021
1 parent 1f78ff1 commit ea76fca
Show file tree
Hide file tree
Showing 14 changed files with 219 additions and 93 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/*
build
target/*
*.iml
*.lst
Expand Down
10 changes: 10 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo off

echo "Clean Project ..."
call mvn clean -f pom.xml

echo "Build Project ..."
call mvn package -f pom.xml -D"maven.test.skip=true"

:exit
pause
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

mvn clean package -Dmaven.test.skip=true
60 changes: 29 additions & 31 deletions dlink-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,50 +80,48 @@
</dependency>
</dependencies>
<build>
<finalName>dlink-admin-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>*.**</exclude>
<exclude>*/*.xml</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib/</classpathPrefix>
<useUniqueVersions>false</useUniqueVersions>
<mainClass>com.dlink.Dlink</mainClass>
</manifest>
<manifestEntries>
<Class-Path>./config/</Class-Path>
</manifestEntries>
</archive>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<finalName>dlink</finalName>
</configuration>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.resource.version}</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<id>copy-static</id>
<phase>validate</phase>
<goals>
<goal>single</goal>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources/static</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<!-- 因为dlink-web打包目录在项目跟目录,所以从这里复制 -->
<directory>../dlink-web/dist</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
</plugin>
</plugins>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
</project>
20 changes: 8 additions & 12 deletions dlink-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,28 @@
<artifactId>dlink-assembly</artifactId>
<packaging>pom</packaging>

<properties>
<package.version>${project.version}</package.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<finalName>dlink</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.parent.artifactId}-release-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/build/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
76 changes: 55 additions & 21 deletions dlink-assembly/src/main/assembly/package.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,75 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin-${package.version}</id>
<assembly>
<id>${project.version}</id>

<formats>
<format>dir</format>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<baseDirectory>dlink</baseDirectory>

<includeBaseDirectory>true</includeBaseDirectory>

<fileSets>
<!-- 打包dlink-doc中的bin目录到 打包目录下 -->
<fileSet>
<directory>${project.parent.basedir}/dlink-doc/bin</directory>
<outputDirectory>./</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>

<!-- 打包dlink-doc中的配置文件到打包目录/sql下 -->
<fileSet>
<directory>${project.parent.basedir}/dlink-doc/sql</directory>
<outputDirectory>sql</outputDirectory>
<includes>
<include>*.sql</include>
</includes>
</fileSet>

<!-- 打包dlink-admin中的配置文件到打包目录/config下 -->
<fileSet>
<directory>${project.parent.basedir}/dlink-admin/src/main/resources/
</directory>
<outputDirectory>config</outputDirectory>
<includes>
<include>application.yml</include>
</includes>
</fileSet>

<!-- 将模块dlink-admin的jar文件放到打包目录下 -->
<fileSet>
<directory>${project.parent.basedir}/dlink-admin/target
</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>dlink-admin-${project.version}.jar</include>
</includes>
</fileSet>

<!-- 打包dlink主要代码-->
<!-- 将模块dlink-client的jar文件放到打包目录/lib下 -->
<fileSet>
<directory>../dlink-admin/target/dlink-service/</directory>
<directory>${project.parent.basedir}/dlink-client/dlink-client-1.12/target</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>**/*.*</include>
<include>dlink-client-1.12-${project.version}.jar</include>
</includes>
<outputDirectory>dlink</outputDirectory>
</fileSet>

<!-- 打包dlink-client Jar包-->
<!-- 将模块dlink-connectors的jar文件放到打包目录/lib下 -->
<fileSet>
<directory>../dlink-client/dlink-client-1.12/target/</directory>
<directory>${project.parent.basedir}/dlink-connectors/dlink-connector-jdbc/target</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
<include>dlink-connector-jdbc-${project.version}.jar</include>
</includes>
<outputDirectory>dlink/lib/</outputDirectory>
</fileSet>

<!-- 打包dlink-connectors Jar包-->
<!-- 将模块dlink-function的jar文件放到打包目录/lib下 -->
<fileSet>
<directory>../dlink-connectors/dlink-connectors-jdbc/target/</directory>
<directory>${project.parent.basedir}/dlink-function/target
</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
<include>dlink-function-${project.version}.jar</include>
</includes>
<outputDirectory>dlink/lib/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
</assembly>
2 changes: 2 additions & 0 deletions dlink-client/dlink-client-1.12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>dlink-client-1.12</artifactId>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -19,6 +20,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.12</junit.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
2 changes: 2 additions & 0 deletions dlink-client/dlink-client-1.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>dlink-client-1.13</artifactId>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -19,6 +20,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.12</junit.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
4 changes: 3 additions & 1 deletion dlink-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
<groupId>com.dlink</groupId>
<version>0.3.0-SANPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>dlink-client</artifactId>

<modules>
<module>dlink-client-1.12</module>
<module>dlink-client-1.13</module>
</modules>
<artifactId>dlink-client</artifactId>
</project>
9 changes: 5 additions & 4 deletions dlink-connectors/dlink-connector-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>dlink-connector-jdbc</artifactId>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -21,12 +22,14 @@
<postgres.version>42.2.10</postgres.version>
<otj-pg-embedded.version>0.13.3</otj-pg-embedded.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
Expand All @@ -43,7 +46,6 @@
</dependency>

<!-- Postgres dependencies -->

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand All @@ -52,7 +54,6 @@
</dependency>

<!-- test dependencies -->

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils_${scala.binary.version}</artifactId>
Expand Down Expand Up @@ -141,7 +142,7 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!--<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Expand All @@ -153,5 +154,5 @@
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</build>-->
</project>
20 changes: 11 additions & 9 deletions dlink-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>dlink-core</artifactId>

<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.12</junit.version>
</properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.12</junit.version>
</properties>

<dependencies>
<dependency>
<groupId>cn.hutool</groupId>
Expand All @@ -35,17 +37,17 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.12</artifactId>
<!--<scope>provided</scope>-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-connector-jdbc</artifactId>
<!--<scope>provided</scope>-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-function</artifactId>
<!--<scope>provided</scope>-->
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit ea76fca

Please sign in to comment.