2

I recently downloaded the source for MassiveCore.Factions off GitHub (Downloaded as ZIP) and I imported this Project as an "Existing Maven Project" in Eclipse. I edited what I needed from the project but I am not sure what is the best practice to add dependencies to this project.

The goal is to have the Jar file which is compiled placed in the directory server/plugins/ along with other Jar files (some which this project depends on). This is the POM that is included with the GitHub download:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<name>Factions</name>
<url>http://www.massivecraft.com/factions</url>

<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>2.7.5</version>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
    <defaultGoal>install</defaultGoal>
    <finalName>Factions</finalName>
    <sourceDirectory>${basedir}/src/main/java/</sourceDirectory>
    <resources>
        <resource>
            <targetPath>.</targetPath>
            <directory>${basedir}/src/main/resources/</directory>
            <filtering>true</filtering>
            <includes>
                <include>*.yml</include>
                <include>*.md</include>
                <include>*.txt</include>
            </includes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.massivecraft</groupId>
        <artifactId>MassiveCore</artifactId>
        <version>LATEST</version>
    </dependency>
    <dependency>
        <groupId>org.dthielke</groupId>
        <artifactId>HeroChat</artifactId>
        <version>5.6.7</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/HeroChat-5.6.7.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>com.griefcraft</groupId>
        <artifactId>LWC</artifactId>
        <version>4.4.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/LWC-4.4.0.jar</systemPath>
    </dependency>
</dependencies>

At first glance I have a few questions regarding this POM file and would like input:

  1. Some of the dependencies include a System Path that should be included in a /lib file for compile time, but for runtime, some of them are included in the same directory as the Factions plugin itself. Can I just assume that everything will work out in runtime if I leave the files as is according to the POM in compile time?

  2. I need to add an extra dependency named bukkit. There are a few bukkit Jars in the server files and will need to test which one it is. However, there is only one that resides in the server/plugins/ directory. If it isn't in that directory, how would I go about trying to compile then if the Jar file will eventually be in a different directory.

  3. There is a dependency for MassiveCraft.MassiveCore in the POM file but doesn't include a System Path nor was it in the GitHub download. I have the file but how would I handle this situation based on this dependency?

Hayden
  • 2,902
  • 2
  • 15
  • 29
  • 1 is not a question, and there's nothing wrong with the approach. If it's what you meant though, read [compiling dependencies into the jar (making fat jars)](http://stackoverflow.com/q/574594/3622940). For 2, you should create your own shell script to assemble the final dependency location, and address this by using a Module POM specified by the top-level POM, unless there is a maven plugin that does this, which is unlikely. For 3, you do not need to manage the dependency for compiling, as Maven will take care of the compilation for you. Download the jar files from their site instead. – Unihedron Jan 08 '15 at 12:53

0 Answers0