Skip to content

Commit 6de7044

Browse files
committed
migrate from maven to gradle
1 parent 0400dd6 commit 6de7044

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+580
-144
lines changed

.gitignore

Lines changed: 163 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,166 @@
1+
### Java template
2+
# Compiled class file
3+
*.class
4+
5+
# Log file
6+
*.log
7+
8+
# BlueJ files
9+
*.ctxt
10+
11+
# Mobile Tools for Java (J2ME)
12+
.mtj.tmp/
13+
14+
# Package Files #
15+
*.jar
16+
*.war
17+
*.nar
18+
*.ear
19+
*.zip
20+
*.tar.gz
21+
*.rar
22+
23+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
24+
hs_err_pid*
25+
26+
### Kotlin template
27+
# Compiled class file
28+
*.class
29+
30+
# Log file
31+
*.log
32+
33+
# BlueJ files
34+
*.ctxt
35+
36+
# Mobile Tools for Java (J2ME)
37+
.mtj.tmp/
38+
39+
# Package Files #
40+
*.jar
41+
*.war
42+
*.nar
43+
*.ear
44+
*.zip
45+
*.tar.gz
46+
*.rar
47+
48+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
49+
hs_err_pid*
50+
51+
### Maven template
152
target/
2-
!.mvn/wrapper/maven-wrapper.jar
3-
!**/src/main/**/target/
4-
!**/src/test/**/target/
53+
pom.xml.tag
54+
pom.xml.releaseBackup
55+
pom.xml.versionsBackup
56+
pom.xml.next
57+
release.properties
58+
dependency-reduced-pom.xml
59+
buildNumber.properties
60+
.mvn/timing.properties
61+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
62+
.mvn/wrapper/maven-wrapper.jar
563

6-
### IntelliJ IDEA ###
7-
.idea/
64+
### Gradle template
65+
.gradle
66+
**/build/
67+
!src/**/build/
68+
69+
# Ignore Gradle GUI config
70+
gradle-app.setting
71+
72+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
73+
!gradle-wrapper.jar
74+
75+
# Cache of project
76+
.gradletasknamecache
77+
78+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
79+
# gradle/wrapper/gradle-wrapper.properties
80+
81+
### VisualStudioCode template
82+
.vscode/*
83+
!.vscode/settings.json
84+
!.vscode/tasks.json
85+
!.vscode/launch.json
86+
!.vscode/extensions.json
87+
*.code-workspace
88+
89+
# Local History for Visual Studio Code
90+
.history/
91+
92+
### JetBrains template
93+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
94+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
95+
96+
# User-specific stuff
97+
.idea/**/workspace.xml
98+
.idea/**/tasks.xml
99+
.idea/**/usage.statistics.xml
100+
.idea/**/dictionaries
101+
.idea/**/shelf
102+
103+
# Generated files
104+
.idea/**/contentModel.xml
105+
106+
# Sensitive or high-churn files
107+
.idea/**/dataSources/
108+
.idea/**/dataSources.ids
109+
.idea/**/dataSources.local.xml
110+
.idea/**/sqlDataSources.xml
111+
.idea/**/dynamic.xml
112+
.idea/**/uiDesigner.xml
113+
.idea/**/dbnavigator.xml
114+
115+
# Gradle
116+
.idea/**/gradle.xml
117+
.idea/**/libraries
118+
119+
# Gradle and Maven with auto-import
120+
# When using Gradle or Maven with auto-import, you should exclude module files,
121+
# since they will be recreated, and may cause churn. Uncomment if using
122+
# auto-import.
123+
# .idea/artifacts
124+
# .idea/compiler.xml
125+
# .idea/jarRepositories.xml
126+
# .idea/modules.xml
127+
# .idea/*.iml
128+
# .idea/modules
129+
# *.iml
130+
# *.ipr
131+
132+
# CMake
133+
cmake-build-*/
134+
135+
# Mongo Explorer plugin
136+
.idea/**/mongoSettings.xml
137+
138+
# File-based project format
8139
*.iws
9-
*.iml
10-
*.ipr
11-
12-
### Eclipse ###
13-
.apt_generated
14-
.classpath
15-
.factorypath
16-
.project
17-
.settings
18-
.springBeans
19-
.sts4-cache
20-
21-
### NetBeans ###
22-
/nbproject/private/
23-
/nbbuild/
24-
/dist/
25-
/nbdist/
26-
/.nb-gradle/
27-
build/
28-
!**/src/main/**/build/
29-
!**/src/test/**/build/
30-
31-
### VS Code ###
32-
.vscode/
33-
34-
### Mac OS ###
35-
.DS_Store
140+
141+
# IntelliJ
142+
out/
143+
144+
# mpeltonen/sbt-idea plugin
145+
.idea_modules/
146+
147+
# JIRA plugin
148+
atlassian-ide-plugin.xml
149+
150+
# Cursive Clojure plugin
151+
.idea/replstate.xml
152+
153+
# Crashlytics plugin (for Android Studio and IntelliJ)
154+
com_crashlytics_export_strings.xml
155+
crashlytics.properties
156+
crashlytics-build.properties
157+
fabric.properties
158+
159+
# Editor-based Rest Client
160+
.idea/httpRequests
161+
162+
# Android studio 3.1+ serialized cache file
163+
.idea/caches/build_file_checksums.ser
164+
165+
### Others
166+
.idea/

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ This repository contains the code examples from the book [Modern Java in Action]
66

77
## Table of Contents
88

9-
- Chapter 1. Java 8, 9, 10, and 11: what's happening? | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter01)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter01))
10-
- Chapter 2. Passing code with behavior parameterization | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter02)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter02))
11-
- Chapter 3. Lambda expressions | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter03)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter03))
12-
- Chapter 4. Introducing streams | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter04)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter04))
13-
- Chapter 5. Working with streams | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter05)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter05))
14-
- Chapter 6. Collecting data with streams | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter06)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter06))
15-
- Chapter 7. Parallel data processing and performance | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter07)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter07))
16-
- Chapter 8. Collection API enhancements | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter08)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter08))
17-
- Chapter 9. Refactoring, testing, and debugging | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter09)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter09))
18-
- Chapter 10. Domain-specific languages using lambdas | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter10)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter10))
19-
- Chapter 11. Using Optional as a better alternative to null | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter11)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/test/com/example/demo/chapter11))
9+
- Chapter 1. Java 8, 9, 10, and 11: what's happening? | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter01)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter01))
10+
- Chapter 2. Passing code with behavior parameterization | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter02)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter02))
11+
- Chapter 3. Lambda expressions | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter03)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter03))
12+
- Chapter 4. Introducing streams | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter04)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter04))
13+
- Chapter 5. Working with streams | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter05)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter05))
14+
- Chapter 6. Collecting data with streams | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter06)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter06))
15+
- Chapter 7. Parallel data processing and performance | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter07)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter07))
16+
- Chapter 8. Collection API enhancements | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter08)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter08))
17+
- Chapter 9. Refactoring, testing, and debugging | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter09)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter09))
18+
- Chapter 10. Domain-specific languages using lambdas | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter10)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter10))
19+
- Chapter 11. Using Optional as a better alternative to null | [java](https://github.com/codejsha/modern-java-in-action/tree/main/src/main/java/com/example/demo/chapter11)([test](https://github.com/codejsha/modern-java-in-action/tree/main/src/test/java/com/example/demo/chapter11))
2020

2121
(work in progress)
2222

build.gradle.kts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
plugins {
2+
id("java")
3+
}
4+
5+
group = "org.example"
6+
version = "1.0"
7+
8+
java {
9+
sourceCompatibility = JavaVersion.VERSION_17
10+
targetCompatibility = JavaVersion.VERSION_17
11+
}
12+
13+
sourceSets {
14+
main {
15+
java {
16+
srcDirs("src/main/java")
17+
}
18+
resources {
19+
srcDirs("src/main/resources")
20+
}
21+
}
22+
test {
23+
java {
24+
srcDirs("src/test/java")
25+
}
26+
resources {
27+
srcDirs("src/test/resources")
28+
}
29+
}
30+
}
31+
32+
repositories {
33+
mavenLocal()
34+
mavenCentral()
35+
}
36+
37+
dependencies {
38+
implementation("org.projectlombok:lombok:1.18.24")
39+
implementation("org.slf4j:slf4j-api:2.0.3")
40+
implementation("org.apache.logging.log4j:log4j-api:2.19.0")
41+
implementation("org.apache.logging.log4j:log4j-core:2.19.0")
42+
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.19.0")
43+
implementation("com.google.guava:guava:31.1-jre")
44+
implementation("org.javatuples:javatuples:1.2")
45+
implementation("org.openjdk.jmh:jmh-core:1.35")
46+
implementation("org.openjdk.jmh:jmh-generator-annprocess:1.35")
47+
annotationProcessor("org.projectlombok:lombok:1.18.24")
48+
49+
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")
50+
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.0")
51+
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.0")
52+
testImplementation("org.hamcrest:hamcrest-library:2.2")
53+
testImplementation("org.mockito:mockito-junit-jupiter:4.8.0")
54+
testAnnotationProcessor("org.projectlombok:lombok:1.18.24")
55+
}
56+
57+
tasks {
58+
withType<Test> {
59+
useJUnitPlatform()
60+
}
61+
withType<JavaCompile> {
62+
options.encoding = "UTF-8"
63+
}
64+
}

gradle/wrapper/gradle-wrapper.jar

58.4 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)