【发布时间】:2013-03-25 21:47:24
【问题描述】:
我已添加:
<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 模板(工具/模板/Java/Java 类(以及您希望的任何其他)/在编辑器中打开(按钮)):
变化:
...
* @author ${user}
...
到
...
* @author ${project.property.user}
...
然后更改许可证文件(工具/模板/许可证/您选择的许可证/在编辑器中打开(按钮)):
...
${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 版本中,这将不是必需的。
【问题讨论】:
标签: maven licensing netbeans-7.3