Setup a Gradle Build Job¶
This page will explain to you how to setup a build job for your Maven Project.
Creating the Job¶
Note
You can skip these steps should you already have a project set up on the CI and instead directly go to Configuration.
- Go to
https://ci.codemc.io/job/{user|organization}/newJob
- Enter a name for your new project and select Freestyle project. Press the OK button at the bottom.
- Jenkins should now create a new Job for you and redirect you to its configuration page once done.
Configuration¶
We recommend to set the following settings for your project:
Source Code Management¶
- In the Source Code Management Section, select Git
- Press Add Repository.
- Enter your repository's URL in the Repository URL field.
- If you only want specific branches to trigger a Build can you add a Branch Specifier by pressing Add Brnach, if there isn't already one set.
Build Triggers¶
This is optional
You can setup automatic Builds for GitHub, GitLab, or any other supported Repository Host.
Tutorials can be found in the Integration Pages of this documenation.
- In the Build Triggers Section, check Poll SCM
- Put
*/10 * * * *
in the large text field to set CodeMC to check your remote repository every 10 minutes.
Build Environment¶
This is optional
We recommend enabling Add timestamps to the Console Output.
Build¶
Important
In order to build a project with JDK 8, you need to use a workaround.
- In the Build Section, press the Add build step button and select Invoke Gradle script from the dropdown menu.
- Press the Use Gradle Wrapper Radio Button.
- Make sure Make gradlew executable is selected.
- Add your tasks in the Tasks field. Those are usually
clean build
,clean shadowJar
or similar.- You can deploy your artifacts to the CodeMC Nexus. A tutorial can be found here.
Post-build Actions¶
- Press the Add post-build action button and select Archive the artifacts from the dropdown menu.
- Assuming a default build-directory, set
build/libs/*.jar
(**/build/libs/*.jar
for multi-module projects) as the value of the Files to archive field.
Final Steps¶
- Press the Save Button to save your changes, which will redirect you to your Project's Job page.
- To start a new Build, press the Build Now button.
- CodeMC will now queue a new Build to be made.
To see the console of your job, press the rotating icon next to the build number in the Build History Section.