私が追加しました:
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
を pom ファイルに追加すると、作成した新しいソース ファイルごとに Apache ライセンスがきちんと表示されます。ただし、ライセンス テキストは次のように表示されます。
/*
* Copyright 2013 MyUserName.
*
* Licensed under the Apache License, Version 2.0 (the "License");
...
*/
なりたい
/*
* Copyright 2013 OldCurmudgeon <--- Note the new name.
*
* Licensed under the Apache License, Version 2.0 (the "License");
...
*/
このフィールドは、プロパティから取得されたように見えますが{user}
、テンプレートが示唆しています。プロジェクトごとに変更する方法はありますか?
以下の提供されたオプションをいくつか試した後の答え。
pomファイルの変更については正しかった。
私は Apache-2.0 ライセンスを選択しました。明らかに、選択したライセンスを調整する必要があります。
pom ファイルに追加します。
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
Java テンプレートを変更します(Tools/Templates/Java/Java Class(および必要に応じてその他)/Open In Editor(button)) :
変化する:
...
* @author ${user}
...
に
...
* @author ${project.property.user}
...
次に、ライセンス ファイルを変更します(Tools/Templates/Licences/The license you selected/Open In Editor(button)) :
...
${licensePrefix}Copyright ${date?date?string("yyyy")} ${project.organization!user}.
...
に
...
${licensePrefix}Copyright ${date?date?string("yyyy")} ${project.property.user}.
...
次に、pom ファイルに追加します。
<properties>
<!-- For the License -->
<user>OldCurmudgeon</user>
</properties>
これで完了です。ライセンスファイルを変更しなければならなかったのは残念です。おそらく、NetBeans の今後のリリースでは、これは必要なくなるでしょう。