Gradle basic, command
create project structure
1
| gradle init --type java-application --dsl kotlin
|
command
install
1
2
3
4
| # archlinux
sudo pacman -S gradle
# mac
brew install gradle
|
windows install gradle
1
| scoop install main/gradle-bin
|
download latest version of gradle from http://www.gradle.org/downloads.html
extract the gradle package
sudo emacs ~/.bashrc
add the gradle to path.
set PATH=$JAVA_HOME/bin:/home/wiloon/program/gradle-1.0-milestone-3/bin:$PATH
export PATH
restart the system
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| # 更新依赖包
gradle build --refresh-dependencies
# publish to maven
gradle publish
# create project structure
mkdir java21
gradle init \
--type java-application \
--dsl kotlin \
--test-framework junit-jupiter \
--package com.wiloon.java21 \
--project-name java21 \
--no-split-project \
--java-version 21
gradle init --type java-library --project-name jvm-library --dsl kotlin
gradle init --type java-library
gradle init --type java-application
#check module dependency
gradle dependencies --configuration compileClasspath
gradle :core:dependencies
#specifies the build file.
gradle -b xxx/xxx/build.gradle
#The Application Plugin
#apply plugin: 'application'
# 打包-tar
gradle distTar
gradle distZip
# 安装到本地
gradle installDist
#convert maven project to gradle project
gradle init --type pom
#eclipse
gradle eclipse
gradle cleanEclipse
#idea gradle idea
gradle cleanIdea
#skip test gradle build -x test
#load local jars compile files('libs/jfx-2.3.8.jar')
|
// project dependency
dependencies {
compile project(":project-name”)
}
// 设置 maven 库地址
repositories {
maven { url 'http://maven.oschina.net/content/groups/public/' }
}
exclude jar
compile(“comxxx:xxx:xxx”) {
exclude group: ‘ch.qos.logback’, module: ‘logback-classic’
}
gralde > maven
https://www.huaweicloud.com/articles/5a4acb62fa2204db2dc7b08b8b151d32.html
http://stackoverflow.com/questions/20707543/gradle-how-to-exclude-jar-from-a-war