Skip to content

Commit

Permalink
feat: add module info (#37)
Browse files Browse the repository at this point in the history
- add moditect maven plugin to generate module-info.java, which excludes the internal package from exporting
- updated example project to use newer maven compiler which supports modules, and add a module-info.java to require the dotenv module
  • Loading branch information
dizney authored Nov 23, 2022
1 parent c2c69fc commit f69a9b3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/maven-simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,14 @@
<version>2.2.4</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions examples/maven-simple/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module io.github.cdimascio.examples.dotenv.java {
requires io.github.cdimascio.dotenv.java;
}
30 changes: 30 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

<properties>
<main.class>io.github.cdimascio.dotenv.Dotenv</main.class>
<module.name>io.github.cdimascio.dotenv.java</module.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<compile.source>1.8</compile.source>
Expand All @@ -70,6 +71,7 @@
<maven.jacoco.plugin>0.8.6</maven.jacoco.plugin>
<maven.coveralls.plugin>4.3.0</maven.coveralls.plugin>
<maven.copy.rename.plugin>1.0.1</maven.copy.rename.plugin>
<maven.moditect.plugin>1.0.0.RC2</maven.moditect.plugin>

<bintray.subject>cdimascio</bintray.subject>
<bintray.repo>maven</bintray.repo>
Expand Down Expand Up @@ -138,6 +140,34 @@
</configuration>
</plugin>

<!-- add module-info -->
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<version>${maven.moditect.plugin}</version>
<executions>
<execution>
<id>add-module-info</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<module>
<moduleInfo>
<name>${module.name}</name>
<exports>
!io.github.cdimascio.dotenv.internal*;
*;
</exports>
</moduleInfo>
</module>
<overwriteExistingFiles>true</overwriteExistingFiles>
</configuration>
</execution>
</executions>
</plugin>

<!-- delete the javadoc dir -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit f69a9b3

Please sign in to comment.