Skip to content

Commit

Permalink
Fix wrapper and clean up build script
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuschko committed Feb 11, 2017
1 parent 35e1559 commit a182808
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 46 deletions.
50 changes: 14 additions & 36 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
group = 'org.examples.java'
version = '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin:'application'
apply plugin: 'com.bmuschko.docker-remote-api'

import com.bmuschko.gradle.docker.tasks.container.*
import com.bmuschko.gradle.docker.tasks.image.*

mainClassName = "org.examples.java.App"

buildscript {
repositories {
jcenter()
Expand All @@ -20,35 +8,25 @@ buildscript {
}
}

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.bmuschko.docker-java-application'

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
}
group = 'org.examples.java'
version = '1.0-SNAPSHOT'

jar {
manifest {
attributes 'Main-Class': 'org.examples.java.App'
}
}
mainClassName = "org.examples.java.App"

task createDockerfile(type: Dockerfile) {
destFile = project.file('build/Dockerfile')
from 'openjdk'
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}

task copyDockerArtifacts(type: Copy) {
dependsOn build

from('build/libs') {
include "docker-java-sample-${project.version}.war"
docker {
javaApplication {
baseImage = 'openjdk:latest'
tag = 'hellojava'
}
}

task buildImage(type: DockerBuildImage) {
dependsOn copyDockerArtifacts
inputDir = project.file('build/docker')
tag = 'hellojava'
}

}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Oct 07 19:44:20 CEST 2016
#Sat Feb 11 09:39:35 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
19 changes: 11 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
Expand Down Expand Up @@ -154,16 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save ( ) {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"

0 comments on commit a182808

Please sign in to comment.