Building a runnable jar with Maven 2

前端 未结 5 786
猫巷女王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:20

    Maven is not packaging your dependencies inside your jar file, because you don't usually do this with Java programs.

    Instead you deliver the dependencies together with your jar file and mention them in the Class-Path header of the Manifest.

    To go this route, you'll need to enable the addClasspath property (documented here) for the maven-jar-plugin.

    If you really want to include all your dependencies in your jar file, then you can use the Maven Assembly plugin to create a jar-with-dependencies.

提交回复
热议问题