Solved How to properly use Maven?

Discussion in 'Spigot Plugin Development' started by Kozs, Feb 5, 2017.

  1. Never been one to use Maven, I decided to try it out today. Added some dependencies and when I go to start the server, the server can't seem to find the classes of my maven dependencies. Idk if I have to run compile it a specific way or I am just not understanding the concept of 'maven'

    Code (Text):

        <dependencies>
            <dependency>
                <groupId>com.zaxxer</groupId>
                <artifactId>HikariCP</artifactId>
                <version>LATEST</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.spigotmc</groupId>
                <artifactId>spigot-api</artifactId>
                <version>1.11.2-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    The programming works just fine, it understands the Maven libs and I dont have any issues IDE sided. I just get errors unable to find HikariCP classes.
     
  2. You need to shade it
     
  3. Well, i use this;
    HTML:
      <build>
      <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>

                <executions>
                    <execution>
                        <phase>package</phase>

                        <goals>
                            <goal>shade</goal>
                        </goals>

                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>org.inventivetalent:menubuilder</include>
                                    <include>org.inventivetalent:itembuilder</include>
                                    <include>org.inventivetalent:particleapi</include>
                                </includes>
                            </artifactSet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        </build>
    It is grabbed from a my plugin, you should change the include to com.zaxxer:HikariCP
    And i think you also need to shade Hikari's dependencies
     
  4. I got it to work but apparently Maven Eclipse is having issues. I have a pretty old Eclipse I believe, so that might be the reason. I get the 'SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.' error
     
  5. also add slf4j as dependencies
     
    • Winner Winner x 1