FatJar

Maven项目使用打包时使用本地jar包库

蹲街弑〆低调 提交于 2020-02-26 01:03:27
在使用maven管理项目时,有时候我们可能会使用一些第三方的jar包依赖库,但是这些jar包依赖库又没有在共有的maven仓库。 通常只能下来放到本项目的lib目录下。但是我们打包时如果不做处理,那么打包后的fat jar中不会有lib文件夹中的相关jar包。 打包后无法运行起来,因此需要做特殊处理,让maven打包时能够把使用到外部jar打进去。主要就是在build中加resources <build> <resources> <resource> <directory>${project.basedir}/lib</directory> <targetPath>BOOT-INF/lib/</targetPath> <includes> <include>**/*.jar</include> </includes> /resource> </resources> </build> 当然也需要在编译插件上指定lib <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target>

How can I get the HOCON configuration file format to work in Vert.x deployed as fat jar?

旧城冷巷雨未停 提交于 2020-01-25 09:46:13
问题 I want to use the HOCON format for configuration in a Vert.x application deployed as a fat jar. I'm facing the same issue as described in this similar question. However I applied the gradle Plugin "io.vertx.vertx-plugin" (v1.0.1) and succeeded in getting the line io.vertx.config.hocon.HoconProcessor into META-INF/services/io.vertx.config.spi.ConfigProcessor in the jar. I still get the exception. What else could be required for the proper bundling of the HoconProcessor class in the jar? 来源:

How do I create an executable fat jar with Gradle with implementation dependencies

白昼怎懂夜的黑 提交于 2019-12-17 23:16:36
问题 I've got a simple project in Gradle 4.6 and would like to make an executable jar of it. I've tried shadow , gradle-fatjar-plugin , gradle-one-jar , spring-boot-gradle-plugin plugins but neither of them adds my dependencies declared as implementation (I don't have any compile ones). It works with compile e.g. for gradle-one-jar plugin but I would like to have implementation dependencies. Thank you very much! 回答1: You can use the following code. jar { manifest { attributes( 'Main-Class': 'com

Gradle - FatJar - Could not find or load main class

☆樱花仙子☆ 提交于 2019-12-03 19:28:32
问题 I know that question was asked a lot and has many answers, but i still get it and I don't understand why... I am trying to generate a .jar from a projet with dependencies with gradle. I have a class src/main/java/Launcher.java , in which I have my main method. there is my build.gradle plugins { id 'java' id 'application' } version '1.0-SNAPSHOT' sourceCompatibility = 1.8 mainClassName = 'Launcher' repositories { mavenCentral() } dependencies { compile 'commons-io:commons-io:2.1' compile 'io

Gradle - FatJar - Could not find or load main class

江枫思渺然 提交于 2019-11-30 08:59:39
I know that question was asked a lot and has many answers, but i still get it and I don't understand why... I am trying to generate a .jar from a projet with dependencies with gradle. I have a class src/main/java/Launcher.java , in which I have my main method. there is my build.gradle plugins { id 'java' id 'application' } version '1.0-SNAPSHOT' sourceCompatibility = 1.8 mainClassName = 'Launcher' repositories { mavenCentral() } dependencies { compile 'commons-io:commons-io:2.1' compile 'io.vertx:vertx-core:3.4.0' compile 'io.vertx:vertx-web:3.4.0' compile 'com.google.code.gson:gson:1.7.2'

JDK11/JavaFX: How do I make a fat jar without build/depdency management?

限于喜欢 提交于 2019-11-29 11:13:16
I think it goes without saying that I should be able to use Oracle's own JDK with JavaFX (from gluonhq) to build a distributable jar file that users can just USE. After an exhaustive search, much reading (24 hours or more over the last few months)and finally this Google search query: how to make a fat jar -maven -gradle -scala -eclipse -ant -docker -hadoop -netbeans -jerkar -phy -mozni -yogurt -pizza - throwing -python -bacon I'm absolutely at the end of the road. Why on earth is this so much work? How can I build a JavaFX application and give it to people that want to actually use it without

How do I create an executable fat jar with Gradle with implementation dependencies

送分小仙女□ 提交于 2019-11-29 01:05:58
I've got a simple project in Gradle 4.6 and would like to make an executable jar of it. I've tried shadow , gradle-fatjar-plugin , gradle-one-jar , spring-boot-gradle-plugin plugins but neither of them adds my dependencies declared as implementation (I don't have any compile ones). It works with compile e.g. for gradle-one-jar plugin but I would like to have implementation dependencies. Thank you very much! miskender You can use the following code. jar { manifest { attributes( 'Main-Class': 'com.package.YourClass' ) } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it :

JDK11/JavaFX: How do I make a fat jar without build/depdency management?

让人想犯罪 __ 提交于 2019-11-27 06:16:20
问题 I think it goes without saying that I should be able to use Oracle's own JDK with JavaFX (from gluonhq) to build a distributable jar file that users can just USE. After an exhaustive search, much reading (24 hours or more over the last few months)and finally this Google search query: how to make a fat jar -maven -gradle -scala -eclipse -ant -docker -hadoop -netbeans -jerkar -phy -mozni -yogurt -pizza - throwing -python -bacon I'm absolutely at the end of the road. Why on earth is this so much

浅谈 java 中构建可执行 jar 包的几种方式

一个人想着一个人 提交于 2019-11-26 19:59:51
有时候,由于项目的需要,我们会将源码编译后以工具包(class打成jar包)的形式对外提供,此时, 你的 jar 包不一定要是可执行的,只要能通过编译,能被别人以 import 的方式调用就行了。但还有的 情况是,我们的 jar 包是要可执行的,即能直接在 cmd 下直接运行。前者的打包很简单,在 eclipse 中, 直接选中要打包的 java 文件和其它资源、依赖文件, export → Java → JAR file 即可。需要注意的是, 这种方式导出的 jar 包是不可执行的,比如你执行如下的语句: java -jar test.jar java -classpath test.jar com.test_maven.App 会直接报错:无法找到主类或者找不到 xxx 依赖包/类,这是由于你没有定义 MANIFEST.MF 资源描述文件所致, 或者你直接把依赖的 jar 包打进了你最终的 jar,而这种嵌套的依赖 jar 包是不能直接被程序 import 识别的。 下面我们看看如何在 eclipse 中构建一个可执行的 jar 包。 (1)最简单的还是依赖于 eclipse 的导出功能 : export → java → Runnable JAR file,这种形式的导出 可以通过 lanuch configuration 指定一个 MainClass,并会自动生成