-
开启多线程
打开 IDEA 设置:文件 > 设置 > 构建、执行、部署 > 构建工具 > Maven - 找到“线程计数”,设置为多线程模式(可根据个人电脑的配置设置线程数量,我设置的是 10 个线程)

-
将IDEA的构建/运行委托给MVAEN
IDEA 默认使用其内置的构建工具执行构建,可以将其委托给 Maven,以获得更好的性能: - 打开 IDEA 设置:文件 > 设置 > 构建、执行、部署 > 构建工具 > Maven - 勾选“将 IDE 构建/运行委托给 Maven”

-
添加配置文件
要进一步优化构建,可以通过添加 Maven 扩展和缓存配置来提高构建效率
3.1 在项目根目录下创建 .mvn 文件夹
3.2 在.maven文件夹下添加 extensions.xml 文件,内容如下<extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd"> <extension> <groupId>org.apache.maven.extensions</groupId> <artifactId>maven-build-cache-extension</artifactId> <version>1.1.0</version> </extension> </extensions>3.3 在.maven文件夹下添加 maven-build-cache-config.xml 文件,内容如下
<?xml version="1.0" encoding="UTF-8" ?> <!--- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You 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. --> <cache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0" xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd"> <!-- Template Maven build cache configuration --> <configuration> <enabled>true</enabled> <hashAlgorithm>SHA-256</hashAlgorithm> <validateXml>true</validateXml> <remote enabled="false"> <url>http://host:port</url> </remote> <local> <location>.build-cache</location> <maxBuildsCached>3</maxBuildsCached> </local> <projectVersioning adjustMetaInf="true"/> </configuration> <input> <global> <glob> {*.java,*.groovy,*.yaml,*.svcd,*.proto,*assembly.xml,assembly*.xml,*logback.xml,*.vm,*.ini,*.jks,*.properties,*.sh,*.bat} </glob> <includes> <include>src/</include> </includes> <excludes> <exclude>pom.xml</exclude> </excludes> </global> <plugins> <plugin artifactId="codegen"> <effectivePom> <excludeProperties> <excludeProperty>111</excludeProperty> </excludeProperties> </effectivePom> <dirScan mode="auto"> <excludes> <exclude tagName="outputDirectory"/> <exclude tagName="directory"/> </excludes> <tagScanConfigs> <tagScanConfig tagName="someProperty" glob="*.java" recursive="false"/> </tagScanConfigs> </dirScan> <executions> <execution> <execIds> <execId>1</execId> <execId>2</execId> </execIds> <dirScan mode="auto"> <includes> <include tagName="protolocation" recursive="false" glob="*.proto"/> </includes> </dirScan> </execution> </executions> </plugin> </plugins> </input> <executionControl> <runAlways> <plugins> <plugin artifactId="maven-failsafe-plugin"/> <plugin artifactId="flatten-maven-plugin"/> </plugins> <executions> <execution artifactId="maven-deploy-plugin"> <execIds> <execId>my-execution-id</execId> </execIds> </execution> </executions> <goalsLists> <goalsList artifactId="maven-install-plugin"> <goals> <goal>install</goal> </goals> </goalsList> <goalsList artifactId="maven-deploy-plugin"> <goals> <goal>deploy</goal> </goals> </goalsList> <goalsList artifactId="bb-sdk-codegen"> <goals> <goal>deploy-local</goal> </goals> </goalsList> </goalsLists> </runAlways> <reconcile logAllProperties="true"> <plugins> <plugin artifactId="maven-compiler-plugin" goal="compile"> <reconciles> <reconcile propertyName="source"/> <reconcile propertyName="target"/> <reconcile propertyName="debug"/> <reconcile propertyName="debuglevel"/> </reconciles> <!-- whitelist of logged properties--> <logs> <log propertyName="includes"/> <log propertyName="excludes"/> <log propertyName="argLine"/> </logs> </plugin> <plugin artifactId="duplicate-finder-maven-plugin" goal="check"> <reconciles> <reconcile propertyName="skip" skipValue="true"/> <reconcile propertyName="quiet" skipValue="true"/> </reconciles> </plugin> <plugin artifactId="maven-enforcer-plugin" goal="enforce"> <reconciles> <reconcile propertyName="skip" skipValue="true"/> </reconciles> <!-- blacklisted from logging properties--> <nologs> <nolog propertyName="redundantProperty"/> <nolog propertyName="redundantProperty2"/> </nologs> </plugin> </plugins> </reconcile> </executionControl> </cache>
解决IDEA构建速度慢的问题
于 2021-10-20 12:41:13 首次发布
这篇博客列举了多个Docker镜像站的URL,包括阿里云、网易云、百度云和上海交大、南京大学的镜像站,方便用户获取Docker镜像。此外,还提到了Docker中国官方镜像站已关闭以及中国科技大学的镜像站仅供内部访问的情况。

864

被折叠的 条评论
为什么被折叠?



