如何从 IntelliJ 正确构建 jars? [英] How to build jars from IntelliJ properly?

查看:28
本文介绍了如何从 IntelliJ 正确构建 jars?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含单个模块和一些依赖项的项目.我想在单独的目录中创建一个 jar,其中包含已编译的模块.此外,我希望在我的模块旁边存在依赖项.

I have a project that contains a single module, and some dependencies. I'd like to create a jar, in a separate directory, that contains the compiled module. In addition, I'd like to have the dependencies present beside my module.

无论我如何扭曲 IntelliJ 的构建 jar"过程,我的模块的输出都显示为空(除了 META-INF 文件).

No matter how I twist IntelliJ's "build jar" process, the output of my module appears empty (besides a META-INF file).

推荐答案

以下是使用 IntelliJ 10 构建 jar 的方法 http://blogs.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/

Here's how to build a jar with IntelliJ 10 http://blogs.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/

文件 -> 项目结构 -> 项目设置 -> Artifacts -> 点击绿色加号 -> Jar -> 来自具有依赖项的模块...

File -> Project Structure -> Project Settings -> Artifacts -> Click green plus sign -> Jar -> From modules with dependencies...

上面将骨架"设置为 jar 将保存到的位置.要实际构建和保存它,请执行以下操作:

The above sets the "skeleton" to where the jar will be saved to. To actually build and save it do the following:

解压到目标Jar

好的

构建 |构建工件 |构建

Build | Build Artifact | Build

尝试从中提取 .jar 文件

Try Extracting the .jar file from

项目名称 |出|文物|项目名称_jar |项目名称.jar

这篇关于如何从 IntelliJ 正确构建 jars?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆