-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
59 lines (32 loc) · 1.4 KB
/
build.sh
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
#!/bin/bash
echo "Kompilowanie programu triangle-app"
##Enter the folder triangle-lib:
cd triangle-lib || exit
rm -d -r out
mkdir -p out/class
##Create .class files by compiling the project with the command:
javac -cp ./src/main/java ./src/main/java/pl/com/rbinternational/*.java -d ./out/class
##Create .jar file
jar cvf out/triangle-lib.jar -C ./out/class .
cd ..
cd triangle-app || exit
rm -d -r out
mkdir -p out/class
mkdir -p out/bin
mkdir -p out/libs
cp -r ../triangle-lib/out/*.jar out/libs
##Compile the files to ".class" format, which are located in the folder "/src/main/java/pl/com/rbinternational/*.java"
javac -cp ./src/main/java ./src/main/java/pl/com/rbinternational/*.java ./src/main/java/pl/com/rbinternational/*/*.java -d ./out/class -classpath ./out/libs/*.jar
##The contents of the file, if we want to compile the FAT Jar, we need the contents of the MANIFEST file, it must look as follows:
##Manifest-Version: 1.0
##Class-Path: .
##Main-Class: pl.com.rbinternational.Main
##For Jar in Jar, the MANIFEST.MF file should look like this:
##Manifest-Version: 1.0
##Class-Path: libs/triangle-lib.jar
##Main-Class: pl.com.rbinternational.Main
cd ../triangle-lib || exit
cp -r out/class/* ../triangle-app/out/class
cd ../triangle-app || exit
##Then we compile everything to a file in ".jar" format
jar cvfm out/bin/triangle-app.jar ./src/main/resources/META-INF/MANIFEST.MF -C out/class .