How to package sources in a jar in Netbeans for maven projects?

*爱你&永不变心* 提交于 2019-12-13 02:24:22

问题


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?

Something like:

myproject.jar
myproject-sources.jar

回答1:


You can do it in two ways.


First way - Project Properties

  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

Second way - Custom Goals

  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

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



来源:https://stackoverflow.com/questions/31728907/how-to-package-sources-in-a-jar-in-netbeans-for-maven-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!