java Intellij 在 jar 文件中包含 src 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4751417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 07:51:43  来源:igfitidea点击:

Intellij include src files in jar file

javabuildjarintellij-idea

提问by jdc0589

I remember a while back with eclipse or netbeans I was able to easily include my source files in my jar file. I have moved to intellij 10 community edition and find myself needing to do the same thing. Any hints?

我记得不久前使用 eclipse 或 netbeans 我能够轻松地将我的源文件包含在我的 jar 文件中。我已经转移到 Intellij 10 社区版,发现自己需要做同样的事情。任何提示?

回答by jdc0589

I figured it out...

我想到了...

Click the '+' button in the 'output layout' tab -> include directory contents -> select your src directory. That did it

单击“输出布局”选项卡中的“+”按钮 -> 包含目录内容 -> 选择您的 src 目录。做到了

回答by hvgotcodes

did you try this

你试过这个吗

http://blogs.jetbrains.com/idea/tag/artifacts/

http://blogs.jetbrains.com/idea/tag/artifacts/

basically you

基本上你

  1. right click on the project
  2. select Open Module Settings
  3. add a build artefact of type jar. You should see something like alt text

  4. Now in the build menu option you can build the jar.

  1. 右键单击项目
  2. 选择打开模块设置
  3. 添加 jar 类型的构建工件。你应该看到类似的东西 替代文字

  4. 现在在构建菜单选项中,您可以构建 jar。

回答by swapnil shashank

Navigate as follows :

导航如下:

(i) Go the "File" in the Top Menu Bar

(i) 转到顶部菜单栏中的“文件”

(ii) Select "Project Structure" from the File Menu

(ii) 从文件菜单中选择“项目结构”

(iii) Select "Artifacts" in Project Settings

(iii) 在项目设置中选择“Artifacts”

(iv) Select "Output Layout"

(iv) 选择“输出布局”

(v) Click on "+" , select "Directory Content" from the dropdown and choose "src" folder from the directories.

(v) 单击“+”,从下拉列表中选择“目录内容”,然后从目录中选择“src”文件夹。