gradle 如何添加 ASM9 依赖
时间: 2024-02-17 20:05:06 浏览: 127
要在Gradle中添加ASM9依赖项,您可以在您的build.gradle文件中添加以下代码:
```groovy
dependencies {
compile "org.ow2.asm:asm:9.0"
}
```
这将添加ASM9库的依赖项到您的项目中。请注意,这里使用的是compile而不是implementation。如果您使用的是Gradle版本4.6或更早版本,那么您应该将compile替换为implementation。如果您使用的是Gradle版本7.0或更高版本,那么您应该将compile替换为api。
相关问题
PermittedSubclasses requires ASM9
这个错误通常是因为您正在使用Java 9中的PermittedSubclasses特性,但您的项目没有添加ASM9库的依赖项。要解决这个问题,您需要在您的项目中添加ASM9库的依赖项。
如果您正在使用Maven,请在pom.xml文件中添加以下依赖项:
```xml
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.0</version>
</dependency>
```
如果您正在使用Gradle,请在build.gradle文件中添加以下依赖项:
```groovy
dependencies {
compile "org.ow2.asm:asm:9.0"
}
```
请注意,如果您正在使用Java 9以及更高版本,那么您需要使用ASM9库来支持PermittedSubclasses特性。所以,确保您已经添加了正确的依赖项。
Caused by: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
这个错误通常是因为您正在使用Java 9中的PermittedSubclasses特性,但您的项目没有添加ASM9库的依赖项。要解决这个问题,您需要在您的项目中添加ASM9库的依赖项。
如果您正在使用Maven,请在pom.xml文件中添加以下依赖项:
```xml
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.0</version>
</dependency>
```
如果您正在使用Gradle,请在build.gradle文件中添加以下依赖项:
```groovy
dependencies {
compile "org.ow2.asm:asm:9.0"
}
```
请注意,如果您正在使用Java 9以及更高版本,那么您需要使用ASM9库来支持PermittedSubclasses特性。所以,确保您已经添加了正确的依赖项。