项目配置
你好呀,我的老朋友!我是老寇,欢迎来到老寇IoT云平台!
# 🚀 一键修改项目模块
注意:根据自己的系统修改,window使用反斜杠'\',linux使用斜杠'/'
// 新模块名称
private static final String NEW_MODULE_NAME = "newlaokou";
// 新分组ID
private static final String NEW_GROUP_ID = "cn.org.laokou";
// 新包名路径[Linux]
private static final String NEW_PACKAGE_PATH_LINUX = "/cn/org/laokou/";
// 新包名路径[Window]
private static final String NEW_PACKAGE_PATH_WINDOW = "\\\\cn\\\\org\\\\laokou\\\\";
// 新包名名称
private static final String NEW_PACKAGE_NAME = "cn.org.laokou";
// 新项目名称
private static final String NEW_PROJECT_NAME = "New-KCloud-Platform-IoT";
# 🚀 一键修改版本号
# 使用
mvn versions:set -P dev
# 提交
mvn versions:commit -P dev
# 回滚
mvn versions:revert -P dev
# 🚀 代码规范检查
注意:项目已启用代码规范检查
跳过代码规范检查
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
注意:目前做了协议头、未使用的依赖和匹配句子末尾的格式校验,都有注释,请自行阅读,而且链接也放在上面,自行对照即可
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"https://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- https://checkstyle.sourceforge.io/property_types.html -->
<!-- 字符集 -->
<property name="charset" value="UTF-8"/>
<!-- 检查级别 -->
<property name="severity" value="error"/>
<!-- 抑制过滤器 https://checkstyle.sourceforge.io/filters/suppressionfilter.html#SuppressionFilter -->
<module name="SuppressionFilter">
<property name="file" value="checkstyle/checkstyle-suppressions.xml"/>
<property name="optional" value="false"/>
</module>
<!-- 检查协议头 https://checkstyle.sourceforge.io/checks/header/regexpheader.html -->
<module name="RegexpHeader">
<property name="headerFile" value="checkstyle/checkstyle-header.txt"/>
<property name="fileExtensions" value="java"/>
</module>
<module name="TreeWalker">
<!-- 匹配句子末尾的格式 https://checkstyle.sourceforge.io/checks/javadoc/javadocstyle.html#JavadocStyle -->
<module name="JavadocStyleCheck">
<property name="endOfSentenceFormat" value="([.?!。?!][ \t\n\r\f<])|([.?!。?!]$)"/>
</module>
<!-- 排除导入的未使用的依赖 https://checkstyle.sourceforge.io/checks/imports/unusedimports.html -->
<module name="UnusedImports">
<!-- true忽略文档依赖,false不忽略文档依赖 -->
<property name="processJavadoc" value="true"/>
</module>
</module>
</module>
注意:协议头验证,需要创建checkstyle-header.txt
^\Q/*\E$
^\Q * Copyright (c) \E20\d\d\-20\d\d\Q KCloud-Platform-IoT Author or Authors. All Rights Reserved.\E$
^\Q *\E$
^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$
^\Q * you may not use this file except in compliance with the License.\E$
^\Q * You may obtain a copy of the License at\E$
^\Q *\E$
^\Q * http://www.apache.org/licenses/LICENSE-2.0\E$
^\Q *\E$
^\Q * Unless required by applicable law or agreed to in writing, software\E$
^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$
^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$
^\Q * See the License for the specific language governing permissions and\E$
^\Q * limitations under the License.\E$
^\Q *\E$
^\Q */\E$
^$
^.*$
注意:checkstyle-suppressions.xml可以用来排除不扫描的文件,比如排除mapstruct生成的代码
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<!-- https://checkstyle.sourceforge.io/filters/suppressionfilter.html -->
<!-- 跳过 org.laokou.auth.convertor.XXXConvertorImpl.java 代码规范检查 -->
<suppress files="[\\/]org[\\/]laokou[\\/]auth[\\/]convertor[\\/].*ConvertorImpl.java" checks=".*"/>
</suppressions>
我是老寇,我们下次再见啦!
上次更新: 2/9/2026, 2:54:22 PM