我设置IntelliJ以将许可证包含在源代码中作为标题的注释。出于某种原因,IntelliJ在所有文件中重复了几个版权声明。
因此,目前所有文件都有一到五次(或更多次)重复的许可证标题,例如:
/*
* Copyright [2014] [John Doe]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright [2014] [John Doe]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
我找不到再次移除标题的功能。 IntelliJ是否提供这样的功能?我应该使用Linux板工具并替换tne字符串吗?我怎样才能安全地做到这一点?
答案 0 :(得分:1)
根据Creating Copyright Profiles - IntelliJ IDEA 13.1.0 Web Help(粗体是我的):
在检测评论中的版权的关键字文本框中,键入字符串,以在版权更新期间将版权声明与其他评论区分开来。
即。它必须是一个唯一的子串,足以可靠地识别版权资料中指定的版权声明。
答案 1 :(得分:0)
您可以使用与设置它们相同的方法删除重复项。
请按照以下步骤操作:
这将替换所有具有单一版权的重复项。调整它直到匹配。
答案 2 :(得分:-3)
极少需要从源文件中删除版权声明和许可证,因此编辑器/ IDE不太可能通过一次击键来提供功能。
如果版权声明/许可证相同,则您可以安全地删除其中一个 如果您是版权所有者,则可以删除所有这些通知。
要删除它们,只需选择文本并将其删除即可。