IDEA 20191.3 添加 Apache License, Version 2.0

  1. 打开 IDEA 的 配置(Settings), 搜索 Code Template
    找到 Class
    Default:为所有项目添加
    Project:仅为本项目添加

     
  2. 在 Apache License, Version 2.0 查看说明:


    复制内容:
     
       Copyright [yyyy] [name of copyright owner]
    
       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.

    添加到 Class 最上面:



    点击应用(Apply)即可。
    上图中有自定义参数:
     
    这是每次创建新Java类时使用的内置模板,方法是选择New | Java类|其中一个项目视图中的弹出菜单中的类。
    该模板是可编辑的。
    除了Java表达式和注释之外,您还可以使用预定义变量(下面列出),然后将这些变量像宏一样展开到相应的值中。
    也可以以${<VARIABLE_NAME>}格式指定任意数量的自定义变量。
    在这种情况下,在创建新文件之前,系统将提示您一个对话框,您可以在其中为所有自定义变量定义特定值。
    使用#parse指令,您可以在“包含”选项卡中包含模板,方法是将所需模板的全名指定为引号中的参数。例如:#parse("File Header.java")
    预定义变量将采用以下值:
    
    ${PACKAGE_NAME}        创建新类的包的名称
    ${NAME}                您在“创建新类”对话框中指定的新类的名称
    ${USER}                当前用户系统登录名
    ${DATE}                当前系统日期
    ${TIME}                当前系统时间
    ${YEAR}                今年
    ${MONTH}               这个月
    ${MONTH_NAME_SHORT}    当前月份名称的前3个字母。示例:Jan,Feb等
    ${MONTH_NAME_FULL}     当月的全名。示例:1月,2月等
    ${DAY}                 当月的当天
    ${HOUR}                当前时间
    ${MINUTE}              当前分钟
    ${PROJECT_NAME}        当前项目的名称
  3. 新建 Class 如图所示:

     
  4.  
发布了94 篇原创文章 · 获赞 32 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/qq_32596527/article/details/94381841