0

I tried to build an executable jar file in Maven and my folder structure is as follows

enter image description here

Here is my pom.xml code

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.polarion.example.job</groupId>
    <artifactId>job</artifactId>
    
    <!-- Output to jar format -->
    <packaging>jar</packaging>
    
    <version>1.0-SNAPSHOT</version>
    <name>job</name>
    <url>http://maven.apache.org</url>

    <properties>
        <jdk.version>11.0.11</jdk.version>
    </properties>

    <build>
        <finalName>job</finalName>
        <plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                  <archive>
                    <manifest>
                    <addClasspath>true</addClasspath>
                    <mainClass>com.polarion.example.job.OverdueJobUnitFactory</mainClass>
                    </manifest>
                  </archive>
                </configuration>
            </plugin>
    </plugins>
    </build>

</project>

When I build pom.xml, with "clean package" I see the following folders in the executable jar file.

enter image description here

But I want a jar file that includes a sub-folder from the src as followings

enter image description here

Note: I already tried to make folder structure src/main/java but it didn't help either

Thanks in Advance

Gokul
  • 931
  • 7
  • 16

0 Answers0