Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Problem: Version loading in build does not use groovy-style
Browse files Browse the repository at this point in the history
Solution:Use more groovy-escue way to read version properties
  • Loading branch information
msteinhoff committed Jan 6, 2017
1 parent b59d25a commit 1c049b2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,16 @@ ext {
mockitoVersion = '1.10.19'
}

def versionPropsFile = file('version.properties')
def versionFileContent = new File('version.properties').text
def versionDropwizardVersion
def versionProjectVersion
def versionIsSnapshot

if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
versionDropwizardVersion = versionProps['DROPWIZARD_VERSION']
versionProjectVersion = versionProps['PROJECT_VERSION'].toInteger()
versionIsSnapshot = versionProps['SNAPSHOT'].toBoolean()
} else {
throw new GradleException("Could not read version.properties!")
}
def Properties versionProps = new Properties()
versionProps.load(new StringReader(versionFileContent))
versionDropwizardVersion = versionProps['DROPWIZARD_VERSION']
versionProjectVersion = versionProps['PROJECT_VERSION'].toInteger()
versionIsSnapshot = versionProps['SNAPSHOT'].toBoolean()

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down

0 comments on commit 1c049b2

Please sign in to comment.