I am having an issue when trying to add gretty to a build script. I get the following error:
“> Cannot change strategy of configuration ‘:overlays’ after it has been resolved.”
When not applying the gretty plugin, I am able to build the project without error. It seems to be a gretty issue, so I have added the same question on their message board as well. I am just hoping that there might be some help found here explaining the error a little bit so that I can better understand where the issue is. Thanks in advance.
Here is a pared down version of the build file that still creates the error message:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:1.4.0'
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'org.akhikhl.gretty'
version = '2'
archivesBaseName = 'service'
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
configurations {
overlays
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
overlays 'org.eclipse.jetty:jetty-distribution:9.3.9.v20160517@zip'
}
task overlayJetty(type: Copy) {
def bundleRoot = 'build/bundle/project-' + project.version + '-bundle'
def jettySrc = configurations.overlays.find {
it.absolutePath.contains('jetty')
}
from zipTree(jettySrc)
into bundleRoot
includeEmptyDirs false
exclude('**/README.TXT')
exclude('**/VERSION.txt')
exclude('**/license-eplv10-aslv20.html')
exclude('**/notice.html')
exclude('**/demo-base/**')
exclude('**/webapps/**')
exclude('**/start.ini')
eachFile {
def path = it.relativePath.pathString
path = path.replaceFirst('jetty-distribution-9.3.9.v20160517/', '')
it.setRelativePath(RelativePath.parse(it.relativePath.isFile(), path))
}
}
task archiveBundle(type: Zip, dependsOn: overlayJetty) {
from 'build/bundle'
archiveName 'stream-service-' + project.version + '-bundle.zip'
}
task bundle(dependsOn: archiveBundle)