Skip to content

Commit f69a9b3

Browse files
authored
feat: add module info (#37)
- 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
1 parent c2c69fc commit f69a9b3

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

examples/maven-simple/pom.xml

+10
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@
2020
<version>2.2.4</version>
2121
</dependency>
2222
</dependencies>
23+
24+
<build>
25+
<plugins>
26+
<plugin>
27+
<groupId>org.apache.maven.plugins</groupId>
28+
<artifactId>maven-compiler-plugin</artifactId>
29+
<version>3.10.1</version>
30+
</plugin>
31+
</plugins>
32+
</build>
2333
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module io.github.cdimascio.examples.dotenv.java {
2+
requires io.github.cdimascio.dotenv.java;
3+
}

pom.xml

+30
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
<properties>
5454
<main.class>io.github.cdimascio.dotenv.Dotenv</main.class>
55+
<module.name>io.github.cdimascio.dotenv.java</module.name>
5556
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5657

5758
<compile.source>1.8</compile.source>
@@ -70,6 +71,7 @@
7071
<maven.jacoco.plugin>0.8.6</maven.jacoco.plugin>
7172
<maven.coveralls.plugin>4.3.0</maven.coveralls.plugin>
7273
<maven.copy.rename.plugin>1.0.1</maven.copy.rename.plugin>
74+
<maven.moditect.plugin>1.0.0.RC2</maven.moditect.plugin>
7375

7476
<bintray.subject>cdimascio</bintray.subject>
7577
<bintray.repo>maven</bintray.repo>
@@ -138,6 +140,34 @@
138140
</configuration>
139141
</plugin>
140142

143+
<!-- add module-info -->
144+
<plugin>
145+
<groupId>org.moditect</groupId>
146+
<artifactId>moditect-maven-plugin</artifactId>
147+
<version>${maven.moditect.plugin}</version>
148+
<executions>
149+
<execution>
150+
<id>add-module-info</id>
151+
<phase>package</phase>
152+
<goals>
153+
<goal>add-module-info</goal>
154+
</goals>
155+
<configuration>
156+
<module>
157+
<moduleInfo>
158+
<name>${module.name}</name>
159+
<exports>
160+
!io.github.cdimascio.dotenv.internal*;
161+
*;
162+
</exports>
163+
</moduleInfo>
164+
</module>
165+
<overwriteExistingFiles>true</overwriteExistingFiles>
166+
</configuration>
167+
</execution>
168+
</executions>
169+
</plugin>
170+
141171
<!-- delete the javadoc dir -->
142172
<plugin>
143173
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)