How to include Apache Commons IO

Discussion in 'Spigot Plugin Development' started by Jaume, May 6, 2017.

  1. How can I include the Apache Commons IO library in my plugin? I've read in the bukkit forums to include it in my jar, but I don't know how. Is it possible? I already know how to add it as an external JAR in eclipse.
  2. I would suggest using Maven for dependency managment
    • Agree Agree x 1
    • Winner Winner x 1
  3. Use either maven or gradle to do this.

    Code (XML):

    Code (Groovy):
    repositories {

    dependencies {
        compile 'commons-io:commons-io:2.5'
  4. How would I have to do it? Assume I have no previous experience working with Maven.
  5. How to do it? As I just said, I have no prior experience in this stuff. I think we posted at the same time.

    EDIT: I see there's lot of information on the Internet. I'm OK for now, I'll bump if I need to. Thanks!
    #5 Jaume, May 6, 2017
    Last edited: May 6, 2017
  6. If you use Eclipse, I cannot help, as last time I properly used Eclipse was at least 4 years ago.
    If you use IntelliJ, you'd just add it as a framework.
    • Like Like x 1
  7. OK so I'm now trying to figure out how to properly write my pom.xml file. Any help? :D

    EDIT: I want apache commons io and spigot as dependencies.
  8. Last time I used eclipse maven and git was a mess.

    @topic I recommend switching to intelliJ idea.
  9. Ok so now I have the Apache Commons IO library working thanks to Maven. However, Eclipse does not recognize classes from the plugin project itself. It shows the usual quick fix (import me.jabamun01. etc etc) but it does nothing as the import is already there and not working. I've tried to restart Eclipse.

    EDIT: Looks like it's fixed, the package declaration was missing or something. Anyway, when extracting through maven build it says it will create an empty jar because "no content was marked for inclusion". What does that mean?
    My pom.xml i got form a template:
    Code (Text):
    <project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
    <description>A Plants Vs Zombies Spigot plugin</description>

        <!-- Removes warnings -->
        <!-- Used in plugin.yml -->
        <!-- Also used in plugin.yml -->
        <!-- Uses the properties in this file for plugin.yml and config.yml -->
            <!-- Sets the Java version to 8 -->
            <!-- Sets the custom JARfile name (Project name without spaces is good) -->
    <!-- This is the spigot repository, if you need others look them up -->
    <!-- Spigot dependency version, if you need others look them up -->

    #9 Jaume, May 6, 2017
    Last edited: May 6, 2017