IDEA使用copyright

qixiaobo發表於2018-01-05

title: IDEA使用copyright tags:

  • IDEA
  • CopyRight
  • 版權 categories: idea date: 2017-11-30 01:54:19

背景

用了那麼多的開源元件可能大家都會發現基本上各個元件都會在程式碼前面註釋版權宣告

比如Mybatis宣告如下

    /**
     *    Copyright 2009-2016 the original author or authors.
     *
     *    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.
     */
複製程式碼

那麼在IDEA下免我們如何使用版權呢?

步驟

  1. 在設定中找到copyright
    123835_MW5Z_871390.png
  2. 新建新的profile 【定義copyright text】
    123851_3dJ5_871390.png
  3. 定義完成後使用validate進行校驗 [針對老的copyright也支援一鍵替換]
  4. 返回修改scope為使用profile
    123907_wboI_871390.png
  5. 在code選單欄選擇update copyright
    123925_Tu6E_871390.png
  6. 程式碼中都會生成如下版權宣告
        /*
         * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
         * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
         * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
         * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
         * Vestibulum commodo. Ut rhoncus gravida arcu.
         */
複製程式碼
 
複製程式碼

相關文章