Getting settings object from the buildscript

Javier Villa

I am trying to access the settings object from the root project's build script.

The reason is I want to define a list in the settings.gradle file which will be a list of subprojects, kind of:

settings.gradle

projectNames = ['prjA', 'prjB']

Would like to do something like:

build.gradle (root project)

projectNames = settings.projectNames
// Use projectName in tasks

And then access it in build.gradle for various tasks, such as resolving those names into URLs to git-clone them. However I can't seem to find a way to declare some arbitrary groovy object which is visible between these two scripts. Note I may potentially like that list to be related but not equal to the project names. I guess the question sums up to sharing POGOs between those two files and accessing the settings object.

I'm pretty new to Gradle.

Peter Niederwieser

There isn't a way to get to the settings object from a build script. However, both scripts share a gradle object, which you could use to set an extra property in the settings script (e.g. gradle.ext.foo = "bar"), and read it in the build script (e.g. println gradle.foo).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Getting a File object from FileInputStream

From Dev

Getting A Selected Object from GridView

From Dev

Getting value from a collection object

From Dev

Getting an object from its address

From Dev

Getting A Selected Object from GridView

From Dev

Getting value from object in javascript

From Dev

Getting tag of object from UITapGestureRecognizer

From Dev

Getting Route object from GetResponseEvent

From Dev

Getting object from pin selection

From Dev

Getting a File object from FileInputStream

From Dev

getting objects from ArrayList<object>

From Dev

getting list from scala object

From Dev

getting specific data from an object

From Dev

Getting values from Object in JavaScript

From Dev

Getting object from field form

From Dev

php getting value from object

From Dev

Getting data from JSON Object

From Dev

add plugin to gradle buildscript from a local jar

From Dev

Keep getting [object] [Object] from variable

From Dev

Keep getting [object, Object] from array for $.each

From Dev

Getting an element from vector<object*> *object

From Dev

Getting particular object from nested complex object

From Dev

Qt: Issue getting the settings ini file from application/executable directory

From Dev

Getting ConnectionStrings config settings from appsettings.json

From Dev

Determine Object from Object.Property (used in persisting settings)

From Dev

Why is getting from Map slower than getting from object?

From Dev

Getting the current MediaTypeFormatter from the Request object, possible?

From Dev

Getting Object Properties From External js File

From Dev

ListView: getting an actual item object from ListViewItem

Related Related

HotTag

Archive