最近改用gradle,idea不知道为什么编译特别慢,甚至比maven还慢,不知道是不是使用方式不正确。有没有指点一下。
- build.gradle 文件
plugins {
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
}
group 'org.carter'
version '1.0-SNAPSHOT'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'com.h2database:h2:2.1.214'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0'
//jedis
implementation 'redis.clients:jedis:3.2.0'
implementation('cn.hutool:hutool-all:5.8.12')
// lombok,编译有效,打包无效
compileOnly 'org.projectlombok:lombok'
// gradle 5.0以上版本注解处理不再compile classpath,需要增加 annotation processor path
annotationProcessor 'org.projectlombok:lombok'
}
test {
useJUnitPlatform()
}
- gradle test指令
:test --tests "org.carter.JedisTest.testZset" --profile --build-cache
- 测试代码
public class JedisTest {
private static final Jedis jedis = new Jedis("centos-7-101", 6379);
@Test
public void testZset() {
Map<String, Double> scores = new HashMap<>();
scores.put("Carter", 100d);
scores.put("Kate", 200d);
scores.put("Jim", 700d);
scores.put("Amy", 400d);
jedis.zadd("scores", scores);
Set<Tuple> res = jedis.zrangeWithScores("scores", 0, -1);
res.forEach(System.out::println);
}
}
- 报告截图
- IDEA配置截图