Search code examples
javaeclipsemavenbukkitbuildpath

Is there a way to use multiple maven dependencies for one maven project in Eclipse?


I am developing a Bukkit plugin with the M2E plugin in Eclipse. I have a problem where the maven dependency (Bukkit 1.5.2 R1.0) is in two different locations depending on whether I am at school or not. At home the file tree is in my dropbox with the maven repo at C:/users/canon/.m2/repository/org/bukkit/bukkit-1.5.2-R1.0 but at school it is located at C:/users/nmeyer/.m2/repository/org/bukkit/bukkit-1.5.2-R1.0. I have been able to recreate the project with maven such that the maven repository is in the correct place on only one computer at a time, but not both at once. Is there a way that I can tell Maven to look in both these file locations for the maven repository so I do not have to keep identical versions of the same project configured for one or the other locations only?

Additional Note: whichever file path I create the maven project with will work and display correctly with the bukkit-1.5.2-R1.0 jar file tree correctly displayed under maven dependencies, but it will not work on a computer in the other location (home vs school).

Clarification: The Maven repository is defined in my pom.xml but i don't see where to find the maven repo path. I've attached my pom.xml because the format of it seems to be a little different than the posted possible answers took into account:

<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>
<groupId>com.nathanMeyer</groupId>
<artifactId>headInfo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
            <source>1.7</source>
            <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<repositories>
    <repository>
        <id>bukkit-repo</id>
        <url> http://repo.bukkit.org/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.bukkit</groupId>
        <artifactId>bukkit</artifactId>
        <version>1.5.2-R1.0</version>
        <type>jar</type>
        <scope>provided</scope>
    </dependency>
</dependencies> 


Solution

  • I figured out what the problem is, and it's so stupid that i didn't even think of it originally. Turns out that my school blocks bukkit.org as "games" and since school computer Eclipse hasn't had a chance to connect to that repository from the school computer since the repo http://repo.bukkit.org/content/groups/public/ was inaccessable.