-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.maven
More file actions
63 lines (54 loc) · 1.9 KB
/
Makefile.maven
File metadata and controls
63 lines (54 loc) · 1.9 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
MVN := ./mvnw
MAVEN_ARGS := $(MAVEN_ARGS) --no-transfer-progress
MAVEN_ARTIFACT_ID := $(shell $(MVN) $(MAVEN_ARGS) --quiet help:evaluate -DforceStdout -Dexpression=project.artifactId)
MAVEN_APP_VERSION := $(shell $(MVN) $(MAVEN_ARGS) --quiet help:evaluate -DforceStdout -Dexpression=project.version)
MAVEN_JDK_VERSION := $(shell $(MVN) $(MAVEN_ARGS) --quiet help:evaluate -DforceStdout -Dexpression=maven.compiler.target)
ifdef SILENT
MAVEN_ARGS := $(MAVEN_ARGS) --quiet
endif
.PHONY: app/deps
## Download all required dependencies
app/deps:
$(MVN) $(MAVEN_ARGS) dependency:go-offline
.PHONY: app
## Build the target/app.jar
app:
$(MVN) $(MAVEN_ARGS) package -DskipTests
install --mode=444 "target/$(MAVEN_ARTIFACT_ID)-$(MAVEN_APP_VERSION)-standalone.jar" "target/app.jar"
.PHONY: app/test
## Execute Unit Tests
app/test:
$(MVN) $(MAVEN_ARGS) test
.PHONY: app/IT
## Execute Unit Tests and Integration Tests
app/IT:
$(MVN) $(MAVEN_ARGS) verify
.PHONY: app/classpath
app/classpath:
$(MVN) $(MAVEN_ARGS) dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile="./target/class.path"
.PHONY: app/jre/modules
app/jre/modules: app app/classpath
test -f ./target/class.path \
&& jdeps \
--class-path "$(shell cat "./target/class.path")" \
--multi-release base \
--ignore-missing-deps \
--print-module-deps \
"target/app.jar" > "./target/jre.modules" \
|| jdeps \
--multi-release base \
--ignore-missing-deps \
--print-module-deps \
"target/app.jar" > "./target/jre.modules"
.PHONY: app/jre
## Build smallest JRE able to run the app, including utilities (JDWP, JMX, JFR)
app/jre: app/jre/modules
$(eval JRE_MODULES="$(shell cat "./target/jre.modules"),jdk.jdwp.agent,jdk.jfr,jdk.management.jfr,jdk.management.agent")
jlink \
--strip-debug \
--output "target/jre" \
--add-modules $(JRE_MODULES)
.PHONY: app/clean
## Clean the target directory
app/clean:
$(RM) -r target