Skip to content

Commit 7559665

Browse files
committed
modified project to support Gradle 5.5, taken aspect project out, introduced annotationprocessor
1 parent 86f45b6 commit 7559665

File tree

13 files changed

+39
-37
lines changed

13 files changed

+39
-37
lines changed

README.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ See the file Contributing.adoc for more information on how you can contribute to
2222

2323

2424
== Building and Deploying
25-
This is a Gradle multi-module project. Build it from scratch using:
25+
This is a Gradle multi-module project. Currently it can be compiled with Gradle 5.x and JDK 8. Build it from scratch using:
2626
----
2727
gradle clean build
2828
----

build.gradle

+1-6
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,9 @@ subprojects {
186186
maven { url "https://repo.spring.io/libs-snapshot" }
187187
maven { url "http://repo.spring.io/milestone" }
188188
maven { url "https://repo.spring.io/libs-milestone" }
189-
maven { url "https://maven.eveoh.nl/content/repositories/releases" }
190189
}
191190
}
192191

193192
tasks.withType(JavaCompile) {
194193
options.encoding = "UTF-8"
195-
}
196-
197-
task wrapper(type: Wrapper) {
198-
gradleVersion = '4.0'
199-
}
194+
}

chapter05-aspectj-aspects/README.adoc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== How to build
2+
3+
Use Gradle 4.0 to build this project. The gradle-aspectj is compatible only with this version of Gradle and
4+
an alternative plugin to support compiling of of AspectJ files (with aj extension" is not available at teh moment.
5+
6+
Since AspectJ files support with Spring will not be in future versions of this book, this module will be removed altogether.
7+
8+
=== Observation
9+
10+
IntelliJ IDEA still does not know how to handle aspects, thus my recommendation to run the examples in the command line is to
11+
follow the next steps:
12+
13+
* build the project with `gradle clean build -x test --refresh-dependencies`
14+
* go to `chapter05-aspectj-aspects/`
15+
* execute `gradle copyDependencies`
16+
* go to: `aspectj-aspects/build/libs`
17+
* execute `java -jar aspectj-aspects-5.0-SNAPSHOT.jar` and you should see the following: `The Prefix foobar! The Suffix foo`

chapter05/aspectj-aspects/build.gradle chapter05-aspectj-aspects/build.gradle

+10
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,22 @@ buildscript {
88
maven { url "http://repo.spring.io/milestone" }
99
maven { url "https://repo.spring.io/libs-milestone" }
1010
maven { url "https://maven.eveoh.nl/content/repositories/releases" }
11+
maven { url "https://maven.eveoh.nl/content/repositories/releases" }
1112
}
1213

1314
dependencies {
1415
classpath "nl.eveoh:gradle-aspectj:2.0"
1516
}
1617
}
18+
19+
repositories {
20+
mavenCentral()
21+
}
22+
23+
project.ext {
24+
aspectjVersion = '1.9.3'
25+
}
26+
1727
apply plugin: 'aspectj'
1828

1929
jar {

chapter05-aspectj-aspects/settings.gradle

Whitespace-only changes.

chapter08/jpa-criteria/README.adoc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== Observation
2+
3+
Gradle 5.x supports annotation processors. IntelliJ IDEA does too, but they must be enabled for the project.
4+
Go to IntelliJ IDEA menu > Build, Execution, Deployment > Compiler > Annotation Processor.
5+
6+
On the right check `Enable annotation processing` and make sure `Obtain processors from project classpath` is selected.
7+
8+
Even if IntelliJ will complain about classes missing, the tests still can be run.

chapter08/jpa-criteria/build.gradle

+2-29
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,8 @@
11
apply plugin: 'idea'
22

3-
sourceSets {
4-
generated
5-
}
6-
7-
sourceSets.generated.java.srcDirs = ['src/main/generated']
8-
9-
configurations {
10-
querydslapt
11-
}
12-
133
dependencies {
14-
compile hibernate.querydslapt, hibernate.jpaModelGen
15-
}
16-
17-
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
18-
source = sourceSets.main.java
19-
classpath = configurations.compile + configurations.querydslapt
20-
options.compilerArgs = [
21-
"-proc:only",
22-
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor"
23-
]
24-
destinationDir = sourceSets.generated.java.srcDirs.iterator().next()
25-
}
26-
27-
compileJava.dependsOn generateQueryDSL
28-
29-
idea {
30-
module {
31-
sourceDirs += file('src/main/generated')
32-
}
4+
annotationProcessor hibernate.jpaModelGen
5+
compile hibernate.querydslapt
336
}
347

358
jar {

settings.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ include 'chapter04:boot-web'
4949
include 'chapter05:after-returning-advice-keygen'
5050
include 'chapter05:annotation-pointcut'
5151
include 'chapter05:aop-namespace'
52-
include 'chapter05:aspectj-aspects'
5352
include 'chapter05:aspectj-annotations'
5453
include 'chapter05:aspectj-regex-pointcuts'
5554
include 'chapter05:cflow-pointcuts'

0 commit comments

Comments
 (0)