-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2f6158
commit e8a3355
Showing
20 changed files
with
1,029 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
app_common/src/main/java/com/justin/app/common/AppCommonApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.justin.app.common; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class AppCommonApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(AppCommonApplication.class, args); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
app_common/src/main/java/com/justin/app/common/config/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.justin.app.common.config; | ||
|
||
public class Config { | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
app_common/src/main/java/com/justin/app/common/datasource/Datasource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.justin.app.common.datasource; | ||
|
||
public class Datasource { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#JPAÅäÖÃ | ||
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8 | ||
spring.datasource.username=root | ||
spring.datasource.password=abc@123456 | ||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
spring.datasource.max-active=20 | ||
spring.datasource.max-idle=8 | ||
spring.datasource.min-idle=8 | ||
spring.datasource.initial-size=10 | ||
spring.jpa.database=MYSQL | ||
spring.jpa.show-sql=true | ||
spring.jpa.open-in-view=false | ||
spring.jpa.generate-ddl=true | ||
#spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.hibernate.ddl-auto=create-drop | ||
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy |
16 changes: 16 additions & 0 deletions
16
app_one/src/main/java/com/justin/app/one/AppApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.justin.app.one; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* SpringBoot start class. | ||
*/ | ||
@SpringBootApplication | ||
public class AppApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(AppApplication.class, args); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&useUnicode=true&characterEncoding=utf8 | ||
spring.datasource.username=root | ||
spring.datasource.password=abc@123456 | ||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
spring.datasource.max-active=20 | ||
spring.datasource.max-idle=8 | ||
spring.datasource.min-idle=8 | ||
spring.datasource.initial-size=10 | ||
spring.jpa.database=MYSQL | ||
spring.jpa.show-sql=true | ||
spring.jpa.open-in-view=false | ||
spring.jpa.generate-ddl=true | ||
#spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.hibernate.ddl-auto=create-drop | ||
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy |
16 changes: 16 additions & 0 deletions
16
app_two/src/main/java/com/justin/app/two/AppApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.justin.app.two; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
/** | ||
* | ||
*/ | ||
@SpringBootApplication | ||
public class AppApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(AppApplication.class, args); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&useUnicode=true&characterEncoding=utf8 | ||
spring.datasource.username=root | ||
spring.datasource.password=abc@123456 | ||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
spring.datasource.max-active=20 | ||
spring.datasource.max-idle=8 | ||
spring.datasource.min-idle=8 | ||
spring.datasource.initial-size=10 | ||
spring.jpa.database=MYSQL | ||
spring.jpa.show-sql=true | ||
spring.jpa.open-in-view=false | ||
spring.jpa.generate-ddl=true | ||
#spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.hibernate.ddl-auto=create-drop | ||
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
//==================定制化1:仓库、编译、插件、公共依赖start================== | ||
buildscript { | ||
//全局声明变量 | ||
ext { | ||
//maven公共仓库 | ||
maven_public_repo_url="https://maven.aliyun.com/repository/public/" | ||
|
||
//gradle插件中心 | ||
gradle_repo_url="https://plugins.gradle.org/m2/" | ||
|
||
//maven应用系统私有仓库 | ||
//maven_private_dev_repo_url="https://maven.aliyun.com/repository/spring/" | ||
|
||
//DEV SNAPSHOTS依赖仓库 | ||
//maven_snapshots_dev_repo_url="https://oss.sonatype.org/content/repositories/snapshots/" | ||
|
||
//插件目录(放在工程目录下,也可以单独存放到资源服务器,指定访问文件的具体url) | ||
template_dir="/template/gradle/v1" | ||
|
||
//编译目录(相对路径) | ||
output_dir="build" | ||
} | ||
|
||
//全局仓库: 自上而下寻找依赖 | ||
repositories { | ||
//maven本地仓库: 优先加载 | ||
mavenLocal() | ||
|
||
//maven仓库中心 | ||
mavenCentral() | ||
|
||
//jcenter仓库中心 | ||
//jcenter()和mavenCentral()是两个独立的仓库,两者毫无关系,jcenter()有的mavenCentral()可能没有,反之亦然。 | ||
jcenter() | ||
|
||
//google仓库中心 | ||
//google() | ||
|
||
//maven远程仓库: 阿里云或公司私服仓库 | ||
maven { | ||
url = maven_public_repo_url | ||
url = gradle_repo_url | ||
//url = maven_private_dev_repo_url | ||
//url = maven_snapshots_dev_repo_url | ||
} | ||
} | ||
|
||
//全局公共依赖 | ||
apply from: template_dir+'/buildscript.gradle',to: buildscript | ||
} | ||
//==================定制化1:仓库、编译、插件、公共依赖end================== | ||
|
||
//Java插件: 未配置时api、implementation无法加载 | ||
plugins { | ||
id 'java' | ||
id 'java-library' | ||
} | ||
|
||
//==================定制化2:配置构建主入口、全局功能函数start================== | ||
//自定义全局工具定制化: 自动构建主入口+配置全局功能函数 | ||
apply from: template_dir+'/functions.gradle' | ||
//==================定制化2:配置构建主入口、全局功能函数end================== | ||
|
||
|
||
//=======================定制化3:gradle子项目模块start========================= | ||
//common project | ||
project(':app_common'){ | ||
apply from: '..'+template_dir+'/build_java.gradle' | ||
apply from: '..'+template_dir+'/junit.gradle' | ||
} | ||
|
||
//app_one project | ||
project(':app_one'){ | ||
apply from: '..'+template_dir+'/build_java.gradle' | ||
apply from: '..'+template_dir+'/junit.gradle' | ||
} | ||
|
||
//app_two project | ||
project(':app_two'){ | ||
apply from: '..'+template_dir+'/build_java.gradle' | ||
apply from: '..'+template_dir+'/junit.gradle' | ||
} | ||
//=======================定制化3:gradle子项目模块end========================= | ||
|
||
//=======================定制化4:子项目定义依赖start========================= | ||
apply from: 'dependencies.gradle' | ||
//=======================定制化4:子项目定义依赖end========================= | ||
//setSysSnapshotsRepo | ||
//待扩展... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
//========================Gradle工程子模块依赖jar包及版本控制========================= | ||
//===========参数说明start========= | ||
//api: 依赖暴露,其他模块都可见 | ||
//implementation: 表示依赖屏蔽,仅自己模块内可见 | ||
//===========参数说明end=========== | ||
|
||
|
||
|
||
//公共子模块依赖定义:app_common | ||
project(':app_common'){//app_common公共项目子模块: 作为jar工程供其他子模块引用,其他无须重复定义相关jar包 | ||
dependencies{ | ||
//依赖仓库jar包 | ||
api 'org.springframework.boot:spring-boot:2.4.3' | ||
api 'org.springframework.boot:spring-boot-starter-web:2.4.3' | ||
api 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3' | ||
api 'mysql:mysql-connector-java:5.1.47' | ||
|
||
//依赖第三方jar包:指定工程资源lib目录下所有依赖包 | ||
api fileTree(dir:'src/main/resources/lib',includes: ['*.jar']) | ||
|
||
//引入 mybatis-generator 插件 | ||
//apply plugin: "com.arenagod.gradle.MybatisGenerator" | ||
|
||
//测试依赖:仅供测试用,仅当前模块生效,不会加载到打包版本中,PS: 根据实际需要定义 | ||
testImplementation 'junit:junit:4.11' | ||
} | ||
} | ||
|
||
//独立子模块依赖定义: app_one | ||
project(':app_one'){ | ||
dependencies{ | ||
//模块依赖: 指定某个模块进行依赖 | ||
implementation project(':app_common') | ||
|
||
//依赖第三方jar包:指定工程资源lib目录下所有依赖包 | ||
compile fileTree(dir:'src/main/resources/lib',includes: ['*.jar']) | ||
|
||
//依赖排除(包级别):exclude的内容将不会被该jar包引用,PS: 根据实际需要定义 | ||
testImplementation (('org.springframework:spring-test:5.3.3')) { | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
} | ||
|
||
//依赖排除(模块级别):exclude的内容将不会被该jar包引用,PS: 根据实际需要定义 | ||
implementation (project(':app_common')) { | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
} | ||
|
||
//测试依赖:仅供测试用,仅当前模块生效,不会加载到打包版本中,PS: 根据实际需要定义 | ||
testImplementation 'junit:junit:4.11' | ||
testImplementation 'org.mybatis.generator:mybatis-generator-core:1.3.7' | ||
} | ||
|
||
//依赖排除(全局级别):exclude的内容将不会被该jar包引用,PS: 当要排除的依赖范围很广时,可采用该方式 | ||
configurations.all { | ||
exclude group: 'org.springframework', module: 'spring-core' | ||
} | ||
} | ||
|
||
//独立子模块依赖定义: app_two | ||
project(':app_two'){ | ||
dependencies{ | ||
//模块依赖: 指定某个模块进行依赖 | ||
implementation project(':app_common') | ||
|
||
//依赖第三方jar包:指定工程资源lib目录下所有依赖包 | ||
compile fileTree(dir:'src/main/resources/lib',includes: ['*.jar']) | ||
|
||
//依赖排除(包级别):exclude的内容将不会被该jar包引用,PS: 根据实际需要定义 | ||
testImplementation (('org.springframework:spring-test:5.3.3')) { | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
} | ||
|
||
//依赖排除(模块级别):exclude的内容将不会被该jar包引用,PS: 根据实际需要定义 | ||
implementation (project(':app_common')) { | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
exclude group: 'org.springframework', module: 'mock' | ||
} | ||
|
||
//测试依赖:仅供测试用,仅当前模块生效,不会加载到打包版本中,PS: 根据实际需要定义 | ||
testImplementation 'junit:junit:4.11' | ||
testImplementation 'org.mybatis.generator:mybatis-generator-core:1.3.7' | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
###########################Gradle构建模块全局属性定义########################### | ||
default.appVersion=1.0.0 | ||
default.compileType=java | ||
default.groupId=com.justin | ||
default.javaTargetVersion=1.8 | ||
default.jdkVerdor=openJDK | ||
default.jdkVersion=jdk1.8.0_101 | ||
|
||
|
||
###########################Gradle构建子模块属性定义########################### | ||
app_common.artifactId=app_common | ||
app_common.packageType=jar | ||
#app_common.packageType=war | ||
#app_common.packageType=bootJar | ||
#app_common.packageType=bootWar | ||
|
||
###########################Gradle构建子模块属性定义########################### | ||
app_one.artifactId=app_one | ||
app_one.packageType=jar | ||
#app_one.packageType=war | ||
#app_one.packageType=bootJar | ||
#app_one.packageType=bootWar | ||
#app_one.bootStartClass=com.justin.app.one.AppApplication | ||
|
||
###########################Gradle构建子模块属性定义########################### | ||
app_two.artifactId=app_two | ||
app_two.packageType=jar | ||
#app_two.packageType=war | ||
#app_two.packageType=bootJar | ||
#app_two.packageType=bootWar | ||
#app_two.bootStartClass=com.justin.app.two.AppApplication |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.