-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
78 lines (63 loc) · 3.26 KB
/
README.txt
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
This is a standalone java application to update jar on remote server.
Its source code is in https://github.com/atline/jarupdater.git
There are 2 kinds of ways you can use it.
1. Use the release.
1.1 Compile the release
a) mvn clean assembly:assembly
b) you will get a folder in target/jarupdater-1.0-bin, something like:
jarupdater-1.0
├── README.txt
├── updater
│ ├── commons-codec-1.9.jar
│ ├── commons-io-1.3.2.jar
│ ├── commons-logging-1.2.jar
│ ├── httpclient-4.5.2.jar
│ ├── httpcore-4.4.4.jar
│ ├── jarupdater-1.0.jar
│ └── settings.conf
└── updatesite
├── amqp-client-3.6.2.jar
├── bin
│ ├── gen_version.py
│ └── md5sum.exe
├── jarupdater_example-1.0.jar
└── version.txt
1.2 Move the updatesite to one of your http server, delete the sample jars & put you own jars in updatesite
1.3 cd bin, python gen_version.py, this will generate a new version.txt in updatesite, its structure is something like:
version=2016-06-27-16-07-50
amqp-client-3.6.2.jar=401ddf2d0e5a4ed2a0f464ca830d7ae1
jarupdater_example-1.0.jar=daba7024d1d97374a8c467b85ccd7dbf
1.4 change settings.conf, the default is:
updatesite=http://127.0.0.1/updatesite
jarrepo=../lib
the updatesite means the local updater needs to fetch the jars from this website
the jarrepo means the local updater will fetch the jars and put them in ../lib, this path is based on the jarupdater-1.0.jar in updater
1.5 in your java launch script you can use something like following if you put your script in a bin directory
#!/usr/bin/env bash
declare APP_HOME="$(cd "$(cd "$(dirname "$0")"; pwd -P)"/..; pwd)"
[ -n "$UPDATER_CLASSPATH" ] || UPDATER_CLASSPATH="$APP_HOME/updater/*"
[ -n "$APP_CLASSPATH" ] || APP_CLASSPATH="$APP_HOME/lib/*"
# update jar
java -cp "$UPDATER_CLASSPATH" org.atline.jarupdater.AppMain
# run app with new jar
java -cp "$APP_CLASSPATH" org.atline.jarupdater_example.MyApp "$@"
NOTE: only when version in version.txt in remote changes, will the local updater download the jars, and it only download the jar which md5sum changes
if local has a jar which do not specified in version.txt, the local updater will automatically delete the local one, so be careful
2. Use jarupdater in your maven project.
You can add following to your pom.xml:
<repositories>
<repository>
<id>atline-maven-repo</id>
<url>https://raw.githubusercontent.com/atline/maven-repo/master/repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.atline.jarupdater</groupId>
<artifactId>jarupdater</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
This will download jarupdater and its dependency when you use maven.
There is a sample code to describe the usage in the folder of jarupdater_example at https://github.com/atline/examples.git
(End)