So im trying to find a work around for this: Publish not picking up version and group
From what I can tell, it seems that not all non-gradle core plugins make a reference to project.version, but in fact make a copy of the object. Therefore, when the value of project.version
is updated later in the configuration phase, those plugins don’t pick up the change. (just a guess there).
So, since in my environment, putting the project.group
and project.version
values in the build.gradle is absolutely out of the question, I need to come up with another solution.
I have been reading up on the lifecycle. It seems that what i really need to do is attach the code that goes to our inventory system to get the project.group value, and the -P parameter for the version from our CI (We don’t use snapshot schemes, each build is issued a hard version number) into the Init phase, instead of the configure. Basically so that part is already done before configure starts. Thinking is, if that code already updates the project.version and project.group before the config, that the other plugins that don’t pick up changes will have them and i can move on to other things.
So i have been playing. Questions are.
1 - is there a way to take a block of code and label it “Run in init”. In order for this code to run, the project objects would have to exist already.
2 - In lieu of that, why doesn’t this work
rootProject.version = "1.0"
rootProject.group = "tryme"
When i put it in the settings.gradle. i get
No such property: version for class: org.gradle.initialization.DefaultProjectDescriptor