我已在首选项中注册了版权配置文件并将其设置为默认值。我还为该配置文件注册了一个范围,设置为“全部”。我可以通过执行“cmd+N(生成)-> 版权”将其添加到文件中。
我不想为我创建的每个新课程手动执行此操作。从现在开始,如何将其自动添加到所有新课程中?
我已在首选项中注册了版权配置文件并将其设置为默认值。我还为该配置文件注册了一个范围,设置为“全部”。我可以通过执行“cmd+N(生成)-> 版权”将其添加到文件中。
我不想为我创建的每个新课程手动执行此操作。从现在开始,如何将其自动添加到所有新课程中?
您必须为您的项目设置默认项目版权。
转到File | Settings | Editor | Copyright
,新建后Copyright Profile
,必须从下拉列表中选择它作为Default project copyright
。
您必须为每个项目设置它,但一旦设置,它应该自动插入到该项目中创建的每个新文件的顶部。
Copyright is not added automatically to the new files, you can use the Update Copyright action on the project root node in the Project View to add/update it for all the files at once or you can enable Update Copyright option in the Commit Project
dialog to be sure that files shared via VCS always have the most recent copyright.
UPDATE: I've verified that copyright is added automatically for me, however it may be hard to notice that it was actually added as by default it appears at the very top of the file and is collapsed, editor also doesn't scroll to the top and remains where it was. If you scroll editor up and unfold the top comment, you should be able to see the automatically added copyright. You can also change the Location in files setting per file type to see that it's added when the new file is created.
Here is the screencast showing that it works.
转到文件->设置->版权->版权配置文件并添加新的版权配置文件。验证它并单击Apply,如下图所示,
然后转到File->Settings->Copyright并选择新输入的配置文件作为Default project copyright并单击OK,如下图所示
更多信息可以在IntelliJ IDEA 设置中找到。(现在应该可以了。如果版权仍然没有自动进入文件,请输入“Alt+Insert”并选择版权)
如果文件中已经存在版权消息,则这可能会导致重复版权消息。 如果您没有现有的评论(或者您可以写太多)并且急于发表评论,这里有一个快速的方法来让他们进入。
注意:在 Android Studio 上使用
参考:https ://www.jetbrains.com/help/idea/2016.1/generating-and-updating-copyright-notice.html#d1722070e316寻找更新版权声明