Skip to content

Commit

Permalink
Document runtime dependency scope
Browse files Browse the repository at this point in the history
Resolves #28.
  • Loading branch information
marcphilipp committed Oct 16, 2024
1 parent ed31b65 commit a1d47c6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,26 @@ dependencies {
}
```

Using `compileOnlyApi` will include the library on the compile classpath of downstream projects but not their runtime classpath. If you want downstream projects to be able to use the `@API` annotation at runtime, you should declare it as `api` instead:

```gradle
dependencies {
api("org.apiguardian:apiguardian-api:1.1.2")
}
```

### Java Platform Module System

```java
module org.example {
requires static transitive org.apiguardian.api;
}
```

Using `static` will only include the library on the module path of downstream projects at compile time but not at runtime. If you want downstream projects to be able to use the `@API` annotation at runtime, you should declare it without `static` instead:

```java
module org.example {
requires transitive org.apiguardian.api;
}
```

0 comments on commit a1d47c6

Please sign in to comment.