NetBeans配置本地maven
在菜單欄的Tools
中單擊Options
,進入到設置頁面。
如下圖所示,設置NetBeans使用本地已有的Maven Home。Maven軟件可以從Apache官網上下載。
雖然,在本地的maven/conf/settings.xml
中已經配置了軟件包的下載路徑(Maven Repository),但是在NetBeans中再設置一步更穩妥,如下圖所示:
NetBeans設置自定義模板
在菜單欄的Tools
中單擊Templates
,進入到模板設置頁面,如下圖所示:
可以根據自己的想法,修改模板,比如改成下面的樣子(添加了一句名言,在類上添加了一些文檔註釋):
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">
<#if package?? && package != "">
package ${package};
</#if>
/*
當你選擇了一種語言,意味着你還選擇了一組技術、一個社區。
---- Joshua Bloch, Effective Java作者
*/
/**
* 描述:
* <br/>
* 創建時間: ${date} ${time}
* @author ${user}
*/
public class ${name} {
}
上面的${user}, ${name}
什麼的,其實可以在user.properties
文件中設置,如下圖所示:
可以在文檔中添加如下內容:
#
# Here, or in other properties files in this directory, you can define
# various properties that you want to make available to the template
# processor while creating various templates.
#
# uncomment the next line and specify your user name to be used in new templates
#user=Your Name <your.name at your.org>
user=ShiJunzhiCome
NetBeans鼠標懸停顯示Javadoc
我們可以按住Ctrl並使鼠標懸停在類或方法上等,然後Javadoc懸浮窗口就會出現。
NetBeans代碼自動提示
在菜單欄的Tools
中單擊Options
,進入到模板設置頁面,如下圖所示:
這樣,就會有代碼自動提示了。