18

I looked up the issue before hand and seen others with similar problems but none of the solutions worked for me.

I am a complete noob with Maven but I just imported a project from GitHub. Now I am having problems with getting the dependencies to work. When I clean it gives me the following errors.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further         details.
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-api:jar:API
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:bukkit:jar should not point at files within the project directory, ${project.basedir}/lib/bukkit-1.8.6-R0.1-SNAPSHOT.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_7_R3:jar:v1_7_R3
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.7.9-R0.2-SNAPSHOT.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_7_R4:jar:v1_7_R4
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.7.10-R0.1.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_8_R1:jar:v1_8_R1
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_8_R2:jar:v1_8_R2
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.3.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_8_R3:jar:v1_8_R3
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.4.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:SkyWarsReloadedPlugin:jar:V2.8
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:bukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.4.jar will be unresolvable by dependent projects @ line 72, column 25
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 

I believe this is different from the original error which was telling me it could not find it, so I went ahead and downloaded all .jar files and put it in the correct places. Now I have no clue what to do.

The other problem I have is whenever I try to edit or add a class it doesn't act like a regular jar file. I cant do like Main.instance.stacticMethod() when I type Main. it just sits there.

If you need any additional files, please let me know.

Also if anyone knows any good tutorial videos on maven

illuminati
  • 181
  • 1
  • 1
  • 3
  • 2
    These are not errors, they are warnings and do not fail the build. Since you are building a project you imported from a 3rd party, you can safely ignore them (or tell the 3rd party that their Maven build got some warnings _they_ should not ignore). – Tunaki Sep 03 '15 at 20:27
  • Being a self-declared _"noob",_ have you considered to start at the [Maven Users Centre](https://maven.apache.org/users/index.html) with its _5 minutes_ and _Getting Started_ tutorials? – Gerold Broser Sep 03 '15 at 20:34
  • @Tunaki I think the original dev didn't setup maven right. https://github.com/walrusone/SkyWarsReloaded – illuminati Sep 03 '15 at 22:06
  • @GeroldBroser I'll check that out, thanks for the response. – illuminati Sep 03 '15 at 22:07

3 Answers3

12

The point of maven is that you should not have to download the dependencies. Just clone the project. You should see a file pom.xml in the root directory. Then enter

mvn compile

This should compile the software and download the dependencies in the progress. The dependencies are not stored in the project folder, they are put in ~/.m2/... using the default config.

Edit: The warnings seem to be a problem caused by the maintainers of the project not understanding maven correctly. They seem to have added jars to the project instead of dependencies.

Next edit: Consider for example the file pom.xml in the v1_8_R3 module: it links to jars in the base directory:

<dependency>
  <groupId>org.bukkit</groupId>
  <artifactId>craftbukkit</artifactId>
  <version>1.8.4-R0.1-SNAPSHOT</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/lib/craftbukkit-1.8.4.jar</systemPath>
  <type>jar</type>
  <optional>true</optional>
</dependency>

using system paths is generally discouraged. The correct way would have been for the devs to ship the jar as a separate artifact. See this question and the related answers

hfhc2
  • 4,182
  • 2
  • 27
  • 56
  • 2
    It is actually `.m2`, not `.m2e` :) – Tunaki Sep 03 '15 at 20:28
  • Thanks for the response! I also thought this, cause thats what I heard was Maven was to make it so I didn't have to find the dependencies. Here's the Github so that you can confirm. https://github.com/walrusone/SkyWarsReloaded – illuminati Sep 03 '15 at 21:27
  • 2
    While you are hoping not to install any libraries, you MAY have to due to availability. This happened to me with Spring, Lombok and Java 10. Still looking for a solution to this problem... – chrips Sep 11 '18 at 00:52
  • 1
    Why Maven do not support. Every organization doesn't have a private Maven Library – BJ5 Sep 27 '19 at 10:07
0

For me the trick was to use ${pom.basedir} instead of ${project.basedir}. Though pom.* is deprecated with Maven 3.

Gayan Mettananda
  • 1,498
  • 14
  • 21
0

You need add this plugin

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>