0

Today, I updated my maven project. As a result, any of my exported jars do not work anymore because for some reason the "app" package is now exported into the root directory of my jar, instead of the src directory.

My buildpath has not changed.

as you can see the app package is in the root

As you can see, the app package is in the root directory. This folder contains all classes of the package.

But also, the app package is in the src folder. However it only contains my messages.properties file.

enter image description here

I export my runnable jars via Export > Export runnable jar, as I always do.

My pom.xml:

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>BMAnalyze</groupId>
<artifactId>BMAnalyze</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
        <resource>
            <directory>src</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.10.1</version>
            <configuration>
                <release>19</release>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.12.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>4.4</version>
    </dependency>

    <!-- JavaFx -->
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-base</artifactId>
        <version>19</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>19</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-graphics </artifactId>
        <version>19</version>
        <classifier>win</classifier>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>19</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-web</artifactId>
        <version>19</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-media</artifactId>
        <version>19</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-swing</artifactId>
        <version>19</version>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
        <version>2.0.27</version>
    </dependency>
    <dependency>
        <groupId>com.github.dhorions</groupId>
        <artifactId>boxable</artifactId>
        <version>1.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.6</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>2.0.6</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>31.1-jre</version>
    </dependency>
</dependencies>

Maybe someone can help me with this? Let me know if you need more information. Thank you

Dahlin
  • 157
  • 1
  • 11
  • 3
    Do not change the defaults which means changing the src directory. Keep the convention. Meaning your java source files should be located in `src/main/java/` and the unit tests should be located in `src/test/java/`... – khmarbaise Dec 19 '22 at 21:55
  • I have never heard of subpackages? And I cant seem to create them in Eclipse – Dahlin Dec 20 '22 at 19:24
  • Your setup is wrong... I see things like `Main.jar/src/` and folders `app`, `logic` and `model` instead of `main` and `test` (default layout in a Maven project; convention)`... and what do you mean by `I have never heard of subpackages?`? – khmarbaise Dec 21 '22 at 10:44
  • you said src/main/java/, but right in the src folder the package are created. main/java would be folders? I have never heard of that. – Dahlin Dec 21 '22 at 18:57
  • I strongly recommend to read this: https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html – khmarbaise Dec 21 '22 at 23:28

0 Answers0