The gradle properties file can be placed at 2 different location i.e GRADLE_USER_HOME directory and APPLICATION ROOT directory, but if the file is placed on both the location then GRADLE_USER_HOME directory takes precedence.
The same above mentioned properties can also be mentioned via command line( i.e system properties, e.g. when -Dgradle.user.home is set on the command line. )
Has directories in the conventional locations for source code
Contains a sample class and unit test, if there are no existing source or test files
Alternative test framework can be specified by supplying a --test-framework argument value. To use a different test framework, execute one of the following commands:
gradle init --type java-application --test-framework spock: Uses Spock for testing instead of JUnit
gradle init --type java-application --test-framework testng: Uses TestNG for testing instead of JUnit
You can specify the init type directly by using the below command
Gradle is based on the concept of task and you write these task in a file called build.gradle.
Below is a sample build.gradle file which has a task called helloWorld which prints the text ‘Hello world.’ on console.
Now to execute this build script we need to go to the directory where the build.gradle file is store and execute the below command command
gradle <task_name>
Now since our task name is helloWorldin the build.gradle file we will execute it with the command gradle helloWorld (-q for quitely) and below is the output of the command
You need to create a repository and get the URL of the repository. There are two types of URL https and ssh. For this demo we will use https. Example : https://github.com/tyson332/DemoRepository.git
Now we need to add the above remote URL into git and give it a name, command to do that is
git remote add <short_name> <repository_url>
You can remove the remote using the keyword remove
git remote remove <short_name>
You can change the url of the existing remote repository using set-url command
git remote set-url <short_name> <repository_url>
You can also rename the short name using the command rename
Note : When you clone a repository using an URL it automatically adds the remote for that url under the name of origin which is the default name provided by git.
Now lets push the files to the remote repository using the below command
git push -u <short_name> <branch_to_be_committed>
The -u attribute in the above command signifies that you need to save the configuration of committing files to repository of that branch always, so next time you need to push you can do just a git push and all the combination of repository url and branch is already maintained in the GIT configuration it automatically pushes it for you. You can also check this out in the local git configuration file (.git/config)
If you want more details about a remote you can run the command