Skip to content

Commit db04701

Browse files
committed
Format readme
1 parent 3f30314 commit db04701

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.MD

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ you can check out my [Understanding Gradle video series](https://www.youtube.com
6060
Add this to the build file of your convention plugin's build
6161
(e.g. `build-logic/build.gradle(.kts)` or `buildSrc/build.gradle(.kts)`).
6262

63-
```
63+
```kotlin
6464
dependencies {
6565
implementation("org.gradlex:java-module-dependencies:1.11")
6666
}
6767
```
6868

6969
> ⚠️ Due to [this bug](https://github.com/gradle/gradle/issues/21490#issuecomment-1458887481) in Gradle which may affect the plugin, it is recommented to add the following to your `settings.gradle(.kts)` file:
70-
> ```
70+
> ```kotlin
7171
> includeBuild(".")
7272
> ```
7373
@@ -78,7 +78,7 @@ The plugin can be used in two ways:
7878
1. As _Settings Plugin_ in `settings.gradle(.kts)` file **(recommended)**
7979
2. As _Project Plugin_ in `build.gradle(.kts)` files (sometimes easier to add to existing setups)
8080
81-
```
81+
```kotlin
8282
plugins {
8383
id("org.gradlex.java-module-dependencies")
8484
}
@@ -88,7 +88,7 @@ plugins {
8888

8989
Once the plugin is applied, dependencies are automatically determined based on the `requires` directives in your `module-info.java` files. For example:
9090

91-
```
91+
```java
9292
module org.example.mymodule {
9393
requires com.fasterxml.jackson.core; // -> implementation("com.fasterxml.jackson.core:jackson-core")
9494
requires transitive org.slf4j; // -> api("org.slf4j:slf4j-api")
@@ -109,7 +109,7 @@ By this, the plugin is later able to establish dependencies between your own mod
109109
how they need to be named (which is different when you use the plugin as
110110
[Project Plugin](#project-structure-definition-when-using-this-plugin-as-project-plugin)).
111111

112-
```
112+
```kotlin
113113
// settings.gradle(.kts)
114114
javaModules { // use instead of 'include(...)'
115115
module("module-a") // Module in directory, discovers 'src/*/java/module-info.java' files
@@ -123,7 +123,7 @@ javaModules { // use instead of 'include(...)'
123123
directory("modules") { // Auto-include all Modules in subfolders of 'modules'
124124
group = "org.example" // group for all Modules
125125
plugin("java-library") // apply plugin to all Modules' subprojects
126-
module("app") { ... } // individualise Module (only if needed)
126+
module("app") { /**/ } // individualise Module (only if needed)
127127

128128
// To optimze Configuration Cache hits:
129129
exclusions.add("_.*") // do not inspect certain folders (regex)
@@ -137,7 +137,7 @@ javaModules { // use instead of 'include(...)'
137137
If you need more control over the properties of a Gradle subproject, in particular to define a nested project path,
138138
you can still use Gradle's `include(...)` and then register the subproject with this plugin.
139139

140-
```
140+
```kotlin
141141
include(":project:with:custom:path")
142142
javaModules {
143143
module(project(":project:with:custom:path")) {
@@ -161,7 +161,7 @@ With this plugin you move dependency definitions into `module-info.java` files a
161161
However, there are certain dependency "scopes" not supported by the `module-info.java` syntax.
162162
For this, the plugin offers an extension of Gradle's DSL to be used in `build.gradle(.kts)` files.
163163

164-
```
164+
```kotlin
165165
mainModuleInfo {
166166
runtimeOnly("org.slf4j.simple") // runtime only dependency for the 'main' module
167167
annotationProcessor("dagger.compiler") // annotation processor dependency for the 'main' module
@@ -173,7 +173,7 @@ For modules in other source sets, there are corresponding blocks to define depen
173173
In case a source set does **not** contain a `module-info.java`, all dependencies can be defined in the `build.gradle(.kts)` files.
174174
The only case where this should be used is for whitebox testing activated via the [org.gradlex.java-module-testing](https://github.com/gradlex-org/java-module-testing) plugin.
175175

176-
```
176+
```kotlin
177177
testModuleInfo {
178178
requires("org.assertj.core")
179179
requires("org.hamcrest")
@@ -199,7 +199,7 @@ org.apache.commons.lang3.test.fixtures=org.apache.commons:commons-lang3|test-fix
199199

200200
**Or** as part of the plugin configuration in your convention plugins:
201201

202-
```
202+
```kotlin
203203
javaModuleDependencies {
204204
// Module Name to Component GA Coordinates
205205
moduleNameToGA.put("org.apache.commons.lang3", "org.apache.commons:commons-lang3")
@@ -234,7 +234,7 @@ For that you can combine the `java-platform` with the `org.gradlex.java-module-v
234234
In that block, you have the `version("module.name", "1.0")` notation to define a version by Module Name instead of coordinates.
235235
For libraries that consist of multiple components and have a BOM for version management, you might prefer to include the BOM, which you need to do by coordinates, because a BOM does not have a Module Name.
236236

237-
```
237+
```kotlin
238238
plugins {
239239
id("java-platform")
240240
id("org.gradlex.java-module-versions")
@@ -258,7 +258,7 @@ dependencies {
258258
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.
259259
For example:
260260

261-
```
261+
```kotlin
262262
dependencies {
263263
javaModuleDependencies {
264264
testRuntimeOnly(ga("org.junit.jupiter.engine"))
@@ -273,7 +273,7 @@ Alternatively, versions can be defined in the `[version]` block of a [version ca
273273

274274
**settings.gradle.kts**
275275

276-
```
276+
```kotlin
277277
dependencyResolutionManagement {
278278
versionCatalogs.create("libs") {
279279
version("org.apache.xmlbeans", "5.0.1")
@@ -286,7 +286,7 @@ dependencyResolutionManagement {
286286
```
287287

288288
**gradle/libs.versions.toml**
289-
```
289+
```toml
290290
[versions]
291291
org_apache_xmlbeans = "5.0.1"
292292
com_fasterxml_jackson_databind = "2.12.5"
@@ -448,7 +448,7 @@ This is not a sophisticated migration tool, but useful, in combination with `ana
448448
This plugin integrates with the [Extra Java Module Info](https://github.com/gradlex-org/extra-java-module-info) plugin if both are applied.
449449
Module Name mappings for Jars that were patched with extra module info will be automatically registered.
450450

451-
```
451+
```kotlin
452452
plugins {
453453
id("org.gradlex.extra-java-module-info")
454454
id("org.gradlex.java-module-dependencies")

0 commit comments

Comments
 (0)