Building a runnable jar with Maven 2

前端 未结 5 801
猫巷女王i
猫巷女王i 2020-11-28 18:31

I\'m relatively new to the Maven mantra, but I\'m trying to build a command-line runnable jar with Maven. I\'ve setup my dependencies, but when I run mvn install

5条回答
  •  余生分开走
    2020-11-28 19:21

    Just add the below code in pom.xml and Run as: maven:install . The jar will be created in target folder of eclipse which can be used as "java -jar Hello.jar" . but make sure that name of main class is given com.abc.HelloWorld.java

    
    
    
    org.apache.maven.plugins
    maven-shade-plugin
    
    
    package
    
    shade
    
    
    HelloW
    
    
    
    com.abc.HelloWorld.java
    1
    
    
    
    
    
    
    
    
    
    
    

提交回复
热议问题