From 98ecac17c2c80a5f914fc93d1e3b7d2d337d1908 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Sun, 21 Mar 2021 20:27:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.0.2=E3=80=91=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BC=80=E6=BA=90=E5=8D=8F=E8=AE=AEappend=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rule/util/LicenseTitleAppenderUtil.java | 34 ++----------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/util/LicenseTitleAppenderUtil.java b/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/util/LicenseTitleAppenderUtil.java index 80a6fb704..0e2f4e919 100644 --- a/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/util/LicenseTitleAppenderUtil.java +++ b/kernel-a-rule/src/main/java/cn/stylefeng/roses/kernel/rule/util/LicenseTitleAppenderUtil.java @@ -21,15 +21,14 @@ public class LicenseTitleAppenderUtil { * @author fengshuonan * @date 2021/3/21 20:25 */ - private static void append() { - String directoryPath = "D:\\temp"; - List files = FileUtil.loopFiles(directoryPath); + public static void append(String codeDirectory, String licenseHeader) { + List files = FileUtil.loopFiles(codeDirectory); for (File file : files) { if (file.getName().endsWith(".java")) { List strings = FileUtil.readLines(file, CharsetUtil.UTF_8); if (!strings.get(0).equals("/*")) { ArrayList newLines = new ArrayList<>(); - newLines.add(getTitle()); + newLines.add(licenseHeader); newLines.addAll(strings); FileUtil.writeUtf8Lines(newLines, file); } @@ -37,31 +36,4 @@ public class LicenseTitleAppenderUtil { } } - private static String getTitle() { - return "/*\n" + - " * Copyright [2020-2030] [https://www.stylefeng.cn]\n" + - " *\n" + - " * Licensed under the Apache License, Version 2.0 (the \"License\");\n" + - " * you may not use this file except in compliance with the License.\n" + - " * You may obtain a copy of the License at\n" + - " *\n" + - " * http://www.apache.org/licenses/LICENSE-2.0\n" + - " *\n" + - " * Unless required by applicable law or agreed to in writing, software\n" + - " * distributed under the License is distributed on an \"AS IS\" BASIS,\n" + - " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + - " * See the License for the specific language governing permissions and\n" + - " * limitations under the License.\n" + - " *\n" + - " * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:\n" + - " *\n" + - " * 1.请不要删除和修改根目录下的LICENSE文件。\n" + - " * 2.请不要删除和修改Guns源码头部的版权声明。\n" + - " * 3.请保留源码和相关描述文件的项目出处,作者声明等。\n" + - " * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns\n" + - " * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns\n" + - " * 6.若您的项目无法满足以上几点,可申请商业授权\n" + - " */"; - } - }