Skip to content

Commit

Permalink
#7 fix commonService file move error
Browse files Browse the repository at this point in the history
  • Loading branch information
gclayburg committed Jul 9, 2021
1 parent a9d2ccc commit 0df268c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 77 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

## [1.4.1] - 2021-7-9
Bug fixes for newer gradle and spring boot versions

### Fixed
- using a commonService configuration on spring boot 2.4 would fail ([#7][i7])
- expandBootJar fails with gradle 7.0.2 ([#8][i8])

### Notes
- This version is compatible with spring boot 1.5 and higher. This plugin has been tested with versions up to 2.5.2.
- This version is compatible with projects using gradle versions 4.10 and higher. It has been tested with versions up to 7.0.2

## [1.4.0] - 2020-3-14
Older releases with release notes can be found on github [releases][releases]

## [1.3.4] - 2020-3-11
Older releases with release notes can be found on github [releases][releases]

## [1.3.3] - 2020-3-10
Older releases with release notes can be found on github [releases][releases]

## [1.3.1] - 2018-3-9
Older releases with release notes can be found on github [releases][releases]

## [1.2.1] - 2018-2-18
Older releases with release notes can be found on github [releases][releases]

## [1.1.1] - 2018-1-26
Older releases with release notes can be found on github [releases][releases]

## [1.1.0] - 2017-10-17
Older releases with release notes can be found on github [releases][releases]

[i7]: https://github.com/gclayburg/dockerPreparePlugin/issues/7
[i8]: https://github.com/gclayburg/dockerPreparePlugin/issues/8
[releases]: https://github.com/gclayburg/dockerPreparePlugin/releases
12 changes: 9 additions & 3 deletions src/main/groovy/com/garyclayburg/docker/DependencyMover.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ class DependencyMover {
some dependencies might only exist in providedRuntime configuration
*/
alreadyMovedJarfileNames.add(commonJarFile.name)
project.getLogger().info("common $configurationName dependency: "+commonJarFile.name)
project.ant.move(file: settings.dockerBuildDependenciesDirectory + partialPath + commonJarFile.name,
tofile: settings.commonServiceDependenciesDirectory + partialPath + commonJarFile.name)
project.getLogger().info("commonService $configurationName dependency: "+commonJarFile.name)
String srcFilename = settings.dockerBuildDependenciesDirectory + partialPath + commonJarFile.name
File srcFile = new File(srcFilename)
if (srcFile.exists()) {
project.ant.move(file: srcFilename,
tofile: settings.commonServiceDependenciesDirectory + partialPath + commonJarFile.name)
} else {
project.getLogger().info("cannot move file that doesn't exist: $srcFilename")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,80 +80,6 @@ test {
useJUnitPlatform()
}
//task buildImage(type: DockerBuildImage, dependsOn: 'dockerLayerPrepare') {
// description = 'Package application as Docker image'
// group = 'Docker'
// inputDir = project.file(dockerprepare.dockerBuildDirectory)
// images.add('registry:5000/' + rootProject.name +':latest')
//}
"""
when:
BuildResult result = GradleRunner.create()
.withProjectDir(testProjectDir.root)
.withArguments('build', '--stacktrace', '--info')
.withPluginClasspath()
.build()
println "build output is:"
println result.output

// def count = new File(testProjectDir.root,
// 'build/docker/commonServiceDependenciesLayer1/BOOT-INF/lib')
// .listFiles().size()

then:
result.output.contains('SUCCESSFUL')
result.task(':dockerLayerPrepare').outcome == SUCCESS
result.task(':expandBootJar').outcome == SUCCESS

// count == 30
}

@SuppressWarnings('UnnecessaryQualifiedReference')
@IgnoreIf({ !SpecRoot.isUsingModernGradle() })
def 'spring boot 2.4.2 with snapshots and docker buildimage'() {
given:
buildFile << """
//import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
plugins {
id 'org.springframework.boot' version '2.4.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
// id "com.gorylenko.gradle-git-properties" version '1.5.1'
id 'groovy'
id 'com.garyclayburg.dockerprepare'
// id 'com.bmuschko.docker-remote-api' version '6.4.0'
}
group = 'com.garyclayburg'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
// mavenLocal()
}
dockerprepare {
// commonService = ['org.springframework.boot:spring-boot-starter-web']
snapshotLayer = true
}
dependencies {
// implementation group: 'com.garyclayburg', name:'upbanner-starter', version: '2.1.2-SNAPSHOT'
// implementation 'com.github.oshi:oshi-core:5.3.6'
implementation 'org.codehaus.groovy:groovy-all:3.0.4'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
// developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
//task buildImage(type: DockerBuildImage, dependsOn: 'dockerLayerPrepare') {
// description = 'Package application as Docker image'
// group = 'Docker'
Expand Down

0 comments on commit 0df268c

Please sign in to comment.