Add artifact to module dependency after project evaluated


(guai) #1

I want to add some flatDir repos with my plugin and redirect some module deps so it could be found in that flatDirs
Artifacts in those dirs named like group-name.jar
So I need to set a new name to this module deps
When I do it from build.gradle script is works
But not when I do it from project.afterEvaluate hook which is added to the project by my plugin

def dep = null
dependencies {
	dep = providedCompile(group: 'ru.programpark.vector', name: 'common-deps', version: '1.0')
}
//dep.artifact {
//	name = 'ru-programpark-vector-common-deps'
//	type = extension = 'jar'
//} // this works if uncommented
project.afterEvaluate {
	dep.artifact {
		name = 'ru-programpark-vector-common-deps'
		type = extension = 'jar'
	} // this don't
}

What am I doing wrong? Is it a bug?
gradle 3.4 on win 10 + java 8