'how to set up my java maven project so it will export

I have a Java Swing project that's working fine from within eclipse. When I attempt to export it as a runnable jar, I get the following errors:

'additional details' from export to runnable jar selection

I don't know how to keep eclipse from looking for classfiles from my 'sandbox' sources; they don't figure in the program. I don't know if that's the fatal error that's preventing the creation of the runnable jar.

I don't know how to eliminate the 'duplicate entry' messages, there are hundreds of them. All the org/apache/log4j, org/apache/batik, etc. These are all brought in by maven, I don't know who uses them but it isn't in my code. The pom file is:

<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>DrivingRecordReader</groupId>
  <artifactId>DrivingRecordReader</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
  <dependencies>
    <!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
    <dependency>
        <groupId>net.sourceforge.tess4j</groupId>
        <artifactId>tess4j</artifactId>
        <version>4.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.pdfbox</groupId>
        <artifactId>pdfbox</artifactId>
        <version>2.0.25</version>
    </dependency>
    <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-ooxml</artifactId>
         <version>5.0.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.17.1</version>
    </dependency>
  </dependencies>
</project>

So I only depend on 4 things: tess4j, pdfbox, apache poi, and apache logging. The build path for the project in eclipse only references a utility library of my own; I do not define any other external jars, letting maven take care of that.

When I select 'export to runnable jar', it cranks for a long time, then displays the following:

Error pop-up after eclipse export to runnable jar

I can run the jar, but don't know how to verify that it has all that it's supposed to have in it.

How is the eclipse project supposed to be set up so that I avoid hundreds of 'duplicate entry' calls, and can configure sample code directories to be skipped for packaging a runnable jar? And can someone tell from this what the blocking problem is?



Solution 1:[1]

as you use maven there is property <packaging>jar</packaging> you can put it after property then from cmd u can run mvn clean package or from eclipse right click -> run as -> run configuraton -> select maven -> new (most top left) -> inside goals -> clean package

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tricksSpecialist