-1

Three ways to pack

I've tried three ways eclieps can be packaged as jars. The third works, but the lib folder is separated from the jar, which is very inconvenient, and I just need to export a full jar

This is my source code link:https://gitee.com/huangliusong/demo2

How do you export an executable jar?

  • It's the same question, but it doesn't provide an answer: https://stackoverflow.com/questions/28193970/create-a-single-executable-jar-from-a-spring-based-java-application/53497152#53497152 – huangliusong Nov 27 '18 at 10:14

3 Answers3

0

Try out this might work for you.

 <plugin>
      <artifactId>maven-dependency-plugin</artifactId>
         <executions>
               <execution>
                     <id>unpack-dependencies</id>
                     <phase>generate-resources</phase>
                     <goals>
                          <goal>unpack-dependencies</goal>
                     </goals>
                </execution>
           </executions>
        </plugin>
Dark Knight
  • 8,218
  • 4
  • 39
  • 58
0

You may export a runnable jar from eclipse. follow the below steps:

  1. Run your project using the class that contains main method to ensure that everything is working fine and as expected.

  2. right click on the project and click on "Export" option.

  3. A window will pop-up, select "Runnable JAR file" option and click on "next" button.refer this screenshot

  4. In the next window, Under the "Library handling" section select the check box against "Package required libraries into generated JAR", fill rest of the information as you were doing already and click on "next" button. refer this screenshot

Uday Kumar
  • 126
  • 12
0
log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.springframework.context.support.ClassPathXmlApplicationContext@22d8cfe0: startup date [Tue Nov 27 17:16:05 CST 2018]; root of context hierarchy
org.springframework.context.support.ClassPathXmlApplicationContext@22d8cfe0
org.springframework.context.support.ClassPathXmlApplicationContext@22d8cfe0
tt run
tt
time:792ms

It is successful if it runs in eclipes!