Skip to content

Commit 576becf

Browse files
committed
Documentation on 'requires /*runtime*/' and changelog
1 parent ea99d21 commit 576becf

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Java Module Dependencies Gradle Plugin - Changelog
22

3+
## Version 1.1
4+
* [#19](https://github.com/gradlex-org/java-module-dependencies/issues/19) Support for `requires /*runtime*/`
5+
36
## Version 1.0
47
* Moved project to [GradleX](https://gradlex.org) - new plugin ID: `org.gradlex.java-module-dependencies`
58

README.MD

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v?label=Plugin%20Portal&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fm2%2Forg%2Fgradlex%2Fjava-module-dependencies%2Forg.gradlex.java-module-dependencies.gradle.plugin%2Fmaven-metadata.xml)](https://plugins.gradle.org/plugin/org.gradlex.java-module-dependencies)
55

66
A Gradle 7.4+ plugin to make Gradle use dependencies from _module-info.java_ files automatically.
7-
If you have a project that fully uses Java Modules, you do **not** need to declare dependencies in the `dependencies { }` block anymore
8-
(except for _runtimeOnly_ dependencies).
7+
If you have a project that fully uses Java Modules, you do **not** need to declare dependencies in the `dependencies { }` block anymore.
98
Gradle will use the information from your `module-info.java` directly.
109

1110
To manage the versions of Java Modules, the plugin conveniently integrates with
@@ -73,6 +72,21 @@ plugins {
7372
}
7473
```
7574

75+
## Effect of the plugin
76+
77+
Once the plugin is applied, dependencies are automatically determined based on the `requires` directives in your `module-info.java` files. For example:
78+
79+
```
80+
module org.example.mymodule {
81+
requires com.fasterxml.jackson.core; // -> implementation("com.fasterxml.jackson.core:jackson-core")
82+
requires transitive org.slf4j; // -> api("org.slf4j:slf4j-api")
83+
requires static jakarta.servlet; // -> compileOnly("jakarta.servlet:jakarta.servlet-api")
84+
requires /*runtime*/ org.slf4j.simple; // -> runtimeOnly("org.slf4j:slf4j-simple")
85+
}
86+
```
87+
88+
Note that `requires /*runtime*/` is a directive specifically supported by this plugin to allow the specification of _runtime only_ dependencies.
89+
7690
## Add Module Name mapping information (if needed)
7791

7892
You may define additional mappings from _Module Name_ to _group:name (GA) coordinates_.
@@ -139,7 +153,7 @@ dependencies {
139153
}
140154
```
141155

142-
Note: If you need to declare additional dependencies, e.g. as `runtimeOnly` without version, or want to use Gradle's rich versions, you can also use the `ga()` shortcut to map a Module Name to the corresponding GA coordinates.
156+
Note: If you need to declare additional dependencies without version, or want to use Gradle's rich versions, you can also use the `ga()` shortcut to map a Module Name to the corresponding GA coordinates.
143157
For example:
144158

145159
```

0 commit comments

Comments
 (0)