illuminati
illuminati

Reputation: 191

dependencies should not point at files within the project directory

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

Upvotes: 19

Views: 74927

Answers (4)

KNS
KNS

Reputation: 1

This answer work for me:

    <dependency>
        <groupId>com.kns.apps.msa</groupId>
        <artifactId>common-pack</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${pom.basedir}/lib/common-pack.jar</systemPath>
    </dependency>

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

     

Upvotes: 0

You need add this plugin

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

Upvotes: 0

Olesea Lip
Olesea Lip

Reputation: 1

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

Upvotes: 0

hfhc2
hfhc2

Reputation: 4421

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

Upvotes: 12

Related Questions