0

I have a problem with my maven project. When I build my Jar, the dependency "BukkitLib" with <scope>compile</scope> will not be compiled in the Jar. In another project, this way (same structure of the pom.xml) works fine. Here is the pom.xml from my project

<?xml version="1.0" encoding="UTF-8"?>
<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>de.flammenfuchs</groupId>
    <artifactId>Farming</artifactId>
    <version>1.0</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!--Spigot API-->
        <dependency>
            <groupId>de.flammenfuchs</groupId>
            <artifactId>BukkitLib</artifactId>
            <version>1.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.16.5-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>de.varox</groupId>
            <artifactId>VaroxMatrix</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.20</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>

Some other information: Intellij Version: 2021.1.1 (Ultimate-Edition) OS: elementaryOS 5.1 (Hera) (based on Ubuntu) Java-Version: 11

My English is very basic, please give me easy or translatable (e. g. deepl) instructions.

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
  • "will not be compiled in the Jar" what you mean by this. Is there any error? – seenukarthi May 23 '21 at 18:55
  • ClassNotFoundException (de.flammenfuchs.bukkitlib.config.BukkitConfig) So the content of the dependency-project is not in the jar and the packages aren't there, when I use a decompiler – Flammenfuchs_YT May 23 '21 at 18:57
  • 2
    It's unclear what you mean by "be compiled in the jar". `compile` scope means the dependency is used at compile time, and that is all. If you want to generate a jar with a library *included in that jar*, this is not how that is done. There are a variety of ways to do *that*, e.g., https://stackoverflow.com/q/1729054/438992. – Dave Newton May 23 '21 at 18:58
  • I don't know why, I don't have the assembly-plugin or dependency-plugin and I think my (not best way) is easier then install these plugins, so I figured out my problem with making my lib as a plugin – Flammenfuchs_YT May 23 '21 at 21:16

0 Answers0