Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glavo/module-info-compiler
https://github.com/glavo/module-info-compiler
compiler java jpms module module-info
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/glavo/module-info-compiler
- Owner: Glavo
- License: apache-2.0
- Created: 2022-04-09T05:43:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-24T16:10:17.000Z (11 months ago)
- Last Synced: 2024-03-14T10:52:11.471Z (8 months ago)
- Topics: compiler, java, jpms, module, module-info
- Language: Java
- Homepage:
- Size: 217 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Module Info Compiler
[![](https://img.shields.io/maven-central/v/org.glavo/module-info-compiler?label=Maven%20Central)](https://search.maven.org/artifact/org.glavo/module-info-compiler)
[![](https://img.shields.io/gradle-plugin-portal/v/org.glavo.compile-module-info-plugin)](https://plugins.gradle.org/plugin/org.glavo.compile-module-info-plugin)A tool for compiling `module-info.java` for Java alone.
It can easily compile `module-info.java` for your Java 8 project to fit JPMS without complicated module path configuration.
It can be used as a dependency library, as a command line tool, or as a [**Gradle plugin**](https://plugins.gradle.org/plugin/org.glavo.compile-module-info-plugin).
It only parses the syntax of `module-info.java` without checking the actual module,
so it compiles without configuring the module path.This tool does not depend on javac, it can run on Java 8 or higher, and you can configure the major version of the target class file.
## Usage
### Gradle Plugin
Using the plugins:
Groovy DSL:
```groovy
plugins {
id "org.glavo.compile-module-info-plugin" version "2.0"
}
```Kotlin DSL:
```kotlin
plugins {
id("org.glavo.compile-module-info-plugin") version "2.0"
}
```It takes over compiling `module-info.java`, so you can easily mix `module-info.java` in your Java 8 project.
You can also do some configuration like this:
```kotlin
tasks.named("compileModuleInfo") {
targetCompatibility = 9 // Optional, defaults to 9
encoding = "UTF-8" // Optional, defaults to UTF-8
moduleVersion = "1.0.0" // Optional
moduleMainClass = "simple.Main" // Optional
}
```Here is a sample project: [Glavo/compile-module-info-sample](https://github.com/Glavo/compile-module-info-sample)
### Use as a CLI tool
Download the jar from the [release page](https://github.com/Glavo/module-info-compiler/releases/),
run it with `java -jar module-info-compiler.jar`.The parameters it accepts are as follows:
```
Usage: gmic [-target ] [-main-class ] [-module-version ]
```### Added as a Maven dependency
This tool has been published on Maven Central, you can add dependencies to it like this:
Maven:
```xmlorg.glavo
module-info-compiler
2.0```
Gradle:
```kotlin
implementation("org.glavo:module-info-compiler:2.0")
```