-
Notifications
You must be signed in to change notification settings - Fork 12
Creating a project
This guide will follow the development of a project called SimplePvp and can be read as a follow-along while you are creating your plugin. The goal is to create a plugin that will track kills and deaths for each player.
Note: Unless specified, all commands are to be run in your project's root directory.
You can check your current directory with "pwd" on unix based machines or "cd" on windows.
To start working with Anvil, create a new Gradle project in your IDE of choice (we recommend IntelliJ IDEA).
- File > New > Project
- Select
Gradle
- Use
Java 1.8
asproject SDK
- Make sure
Kotlin DSL buildscript
is disabled - Make sure only
java
is selected underAdditional Libraries and Frameworks
- Click next
- Pick an
ArtifactId
andGroupId
for your project (name is usually the same asArtifactId
- Click finish
Note: If you are on windows, use "gradlew" instead of "./gradlew" for the rest of the guide.
You should now be looking at an empty project. The first thing we will do is update Gradle to the latest version by running the following commands in the terminal.
Note: Gradle 6.1.1 is the latest version at the time of this writing. If there is a later one available, use that instead.
./gradlew wrapper --gradle-version 6.1.1
./gradlew wrapper
While not strictly necessary, it is recommended that you create a git repository for your project. If you do not have git installed, please install git. If you choose to not use git or do not wish to use Anvil via git submodule, please skip to the next section.
To start with git, run
git init
This initializes an empty git repository in your current directory. The next step is to add Anvil as a git submodule. To do this, run
git submodule add https://github.com/MilSpecSG/Anvil
This adds Anvil as a submodule to your current project so that you can use it later.
The next step is to add a .gitignore
file. This tells git which files to ignore when making commits. You can just copy and paste it from here and put it in your root project directory.
Note: If you see the message "You can configure Gradle wrapper to use distribution with sources. It will provide..." above the `build.gradle` file in Intellij,
go to Preferences > Build, Execution, Deployment > Build Tools > Gradle and
set "Use Gradle from" to "'wrapper' task in Gradle build script". Click Apply and Ok to save your changes.
Please head on over to Multiplatform design to continue.