Created
December 7, 2015 06:47
-
-
Save datherra/082ecc1633d8a1b273d7 to your computer and use it in GitHub Desktop.
Gradle Download file / dependencies outside of repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext { | |
wlsInstaller = 'wls1036_dev.zip' | |
wlsInstallerSourceUrl = "http://mysever/content/com/oracle/weblogic/wls/10.3.6/${wlsInstaller}" | |
localEnvDir = "${projectDir}/.local" | |
wlsInstallerDestPath = "${localEnvDir}/${wlsInstaller}" | |
wlsHome = "${localEnvDir}/wls1036_dev/" | |
} | |
def download(String remoteUrl, String localUrl) { | |
def localFile = new FileOutputStream(localUrl) | |
def out = new BufferedOutputStream(localFile) | |
out << new URL(remoteUrl).openStream() | |
out.close() | |
} | |
task downloadWebLogic { | |
description 'Fetches WLS Dev edition from HTTP Server' | |
outputs.file wlsInstallerDestPath // skip task if up-to-date | |
doLast { | |
file(localEnvDir).mkdir() | |
download(wlsInstallerSourceUrl, wlsInstallerDestPath) | |
} | |
} | |
task extractWeblogic(type: Copy, dependsOn: downloadWebLogic) { | |
description 'Unpacks previously downloaded WLS Dev edition' | |
from zipTree(wlsInstallerDestPath) | |
into wlsHome | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment