In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how Gradle transfers parameters to virtual machines". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to transfer parameters to virtual machines by Gradle".
The parameters passed by Gradle to the virtual machine are most reliable through the-D command, for example, gradlew-Dparam.key1=value1 uses ext,-P or systemProp to pass attributes, which can not be effectively passed to the virtual machine after testing.
Reference: create a file called gradle.properties under the root of the project, where you define the required properties. When Gradle builds a Gradle domain object (that is, an project object instance), these attributes are automatically added to the project object instance and called directly as their properties.
Defined in the ext block in build.gradle. Ext is precisely an attribute of the Gradle domain object. We can add custom attributes to the ext object, and other code snippets in Build.gradle can be used.
You can see from the above that the ext object is actually an instance of the DefaultExtraPropertiesExtension object.
Create attributes for Gradle in real time with-D or-P on the command line. The-D attribute is passed to the jvm that starts the Gradle and is used by the jvm as a system property.
The-P attribute is loaded directly into the Gradle realm object.
Create system properties in the Gradle configuration file. I just mentioned that properties can be created in gradle.properties files, and we can also create system properties. If there is a systemProp. The attribute of the prefix is recognized as a system attribute. The system attributes or environment variables of a special prefix are automatically added to the Gradle realm object.
If there is an environment variable to ORG_GRADLE_PROJECT. Is prefixed, then the variable is automatically added to the Gradle realm object. Similarly, if there are system properties with org.gradle.project. Is prefixed, then it will also be automatically added to the Gradl domain object. One of the purposes of this feature is to hide some sensitive information. For example, the password information needs to be passed in when executing the Gradle script, and it will be seen by others if it is transmitted in the form of-P. Save this attribute as an environment variable, and only the system administrator has the right to access and modify it. When running Gralde, this environment variable is automatically added to the Gradle object and used, isolating the shaded data without affecting the use of other users. (other users can set this property in the-P way).
Thank you for your reading, the above is the content of "how to transmit parameters to virtual machines by Gradle". After the study of this article, I believe you have a deeper understanding of how to transfer parameters to virtual machines by Gradle, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.