File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/main/groovy/com/chillycheesy/modulo/tasks Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import org.gradle.api.Project
5
5
6
6
class RunModuloServer implements ModuloTask {
7
7
8
+ private final def LINK = ' https://s01.oss.sonatype.org/content/repositories/releases/com/chillycheesy/modulo-server/'
9
+
8
10
private ModuleExtension moduleExtension
9
11
10
12
RunModuloServer (ModuleExtension moduleExtension ) {
@@ -17,7 +19,25 @@ class RunModuloServer implements ModuloTask {
17
19
group = ' modulo'
18
20
description = ' Run the Modulo server.'
19
21
doLast {
22
+ final File file = new File (" modulo/modulo-server-${ moduleExtension.version} .jar" )
23
+ if (! file. exists()) downloadFile(file)
24
+ // //////////////////////////////////////////////////////////////////////////////////////////////
25
+ }
26
+ }
27
+ }
20
28
29
+ private def downloadFile (File file ) {
30
+ def url = " $LINK :${ moduleExtension.version} /${ file.getName()} "
31
+ new URL (url). openConnection(). with { connection ->
32
+ connection. instanceFollowRedirects = false
33
+ url = connection. getHeaderField(" Location" )
34
+ if (! url) {
35
+ file. withOutputStream { outputStream ->
36
+ connection. inputStream. with { inputStream ->
37
+ outputStream << inputStream
38
+ inputStream. close()
39
+ }
40
+ }
21
41
}
22
42
}
23
43
}
You can’t perform that action at this time.
0 commit comments