如何在Netbeans的jar中为maven项目打包源代码? [英] How to package sources in a jar in Netbeans for maven projects?

查看:319
本文介绍了如何在Netbeans的jar中为maven项目打包源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Netbeans中构建maven项目(Java)时,默认情况下会忽略源代码。
如何在Netbeans的jar中为maven项目打包资源?

When building maven projects (Java) in Netbeans, by default, sources are left out. How to package sources in a jar in Netbeans for maven projects?

类似于:

myproject.jar
myproject-sources.jar


推荐答案

你可以用两种方式完成。

You can do it in two ways.

第一种方式 - 项目属性


  1. 右键单击项目> 属性

  2. 转到> 操作

  3. 添加自定义的(单击添加自定义... )用于单独操作或通过选择它将其添加到现有操作(例如,使用依赖项构建)。

  4. 执行目标中 menu,添加 source:jar

  1. Right click on the project > Properties
  2. Go to > Actions
  3. Either add a custom one (click Add custom...) for a separate action or add it to an existing one (e.g. Build with dependencies) by selecting it.
  4. In the Execute Goals menu, add source:jar





第二种方式 - 自定义目标


  1. 右键单击项目> 自定义> 目标

  2. 目标:输入来源:jar

  3. 要使此永久化,请选中复选框记住为并为其命名。

  4. 运行它:右键单击项目> 自定义> 名称您选择了

  1. Right click on the project > Custom > Goals
  2. In Goals: type source:jar
  3. To make this permanent, select the checkbox Remember as and give it a name.
  4. Run it: Right click on the project > Custom > the name you selected


注意:对于这两种方式,当你输入源代码时,Netbeans会提出很多选择,尝试使用其他很酷的选项!

Note: For both ways, when you type source, Netbeans suggest many options, try them for other cool options!

这篇关于如何在Netbeans的jar中为maven项目打包源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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