-
Notifications
You must be signed in to change notification settings - Fork 113
Setup (Legacy 1.X)
Because JDA-Utilities is dependent on the JDA library itself, projects making use of it must also setup and provide JDA in their project.
The "Using A Dependency Manager" tab below provides a basic setup that includes both JDA and JDA-Utilities.
If you are still unsure how to setup JDA, visit the setup page of the JDA wiki here.
The necessary snippets for adding JDA-Utilities as a dependency in a Gradle or Maven project can be found below.
Replace LATEST
with the corresponding JDA and JDA-Utilities version numbers, and you'll be good
to go after refreshing your dependencies.
If you use gradle as a dependency manager you'll need to do the following:
-
Add this to your
repositories
block.repositories { jcenter() }
-
Add these to your
dependencies
block:dependencies { compile 'com.jagrosh:JDA-Utilities:LATEST' compile 'net.dv8tion:JDA:LATEST' }
If you use maven as a dependency manager you'll need to do the following:
-
Add this to your
<repositories>
block:<repository> <id>central</id> <name>bintray</name> <url>http://jcenter.bintray.com</url> </repository>
-
Add these to your
<dependencies>
block:<dependency> <groupId>com.jagrosh</groupId> <artifactId>JDA-Utilities</artifactId> <version>LATEST</version> <scope>compile</scope> </dependency>
<dependency> <groupId>net.dv8tion</groupId> <artifactId>JDA</artifactId> <version>LATEST</version> </dependency>
If you do not use a dependency manager, you'll need to download the latest versions of the following:
For those who want to use a single part of JDA-Utilites but don't want to include the entire dependency in their project the following snippets can be used to exclude parts of JDA-Utilities from compilation.
IMPORTANT: The following snippets use the
shadow
orshade
plugins for Gradle or Maven, respectively, and assume that you use them for compiling your project.If you do not have these plugins as part of your
build.gradle
orpom.xml
, the following will not work.
In order for the resource to be removed properly,
you will need to run the shadowJar
task via your IDE's gradle tab
or via commandline such as gradle shadowJar
or gradlew shadowJar
if you're using a gradle wrapper.
The generated .jar
can be found in build/libs
.
shadowJar {
// Other shadowJar configurations
exclude("full/package/name/**") // A whole package
exclude("full/package/name/AndResourceFileName**") // A single class
}
// Anything not excluded will be compiled
<project>
<!-- Other code -->
<build>
<plugins>
<plugin>
<groupId>org.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>VERSION</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<!-- Other filters if needed -->
<filter>
<artifact>com.jagrosh:JDA-Utilities:LATEST</artifact>
<includes>
<!-- Include a full package -->
<include>full/package/name/**</include>
<!-- Include a single class or file -->
<include>full/package/name/AndResourceFileName.**</include>
</includes>
<excludes>
<!-- Exclude a full package -->
<exclude>full/package/name/**</exclude>
<!-- Exclude a single class or file -->
<exclude>full/package/name/AndResourceFileName.**</exclude>
</excludes>
</filter>
<!-- Other filters if needed -->
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Other code -->
</project>
IMPORTANT: All of the following should be prefixed with com/jagrosh/jdautilities/
-
commandclient/**
- CommandClient and Command related resources -
menu/**
- Menus -
waiter/**
- EventWaiter -
utils/FinderUtil.**
- FinderUtil -
utils/SafeIdUtil.**
- SafeIdUtil
-
Once again, the snippets above require the
shadow
orshade
plugins for Gradle or Maven, respectively. -
If you exclude
waiter/**
there is no reason to havemenu/**
either so make sure to exclude them both. -
You can exclude specific menu types by affixing the name of the menu package name to the end of
menu/
. For example if you want to include/exclude a specific menu such asPaginator
, you can do use the pathnamemenu/pagination/**
. -
DO NOT try to cherry pick resources out of
commandclient/**
as internally removing anything in the package while retaining the rest will result in compilation failures and/orNoClassDefFoundError
s.