Skip to content

Commit bbd30e5

Browse files
authored
Add module-info.java files (#66)
1 parent 44a94c0 commit bbd30e5

File tree

6 files changed

+127
-7
lines changed

6 files changed

+127
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8-
- Update to spotify-web-api-core `2021.6.17`
8+
- Update to spotify-web-api-core `2021.6.18`
99
- Fix response type of `ReplacePlaylistsTracksRequest` from `Void` to `SnapshotId`.
10+
- Add a module-info file, so the library is usable with the Java module system.
1011

1112
## [2.1.0]
1213
- Update to spotify-web-api-core `2021.5.1`

pom.xml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>de.sonallux.spotify</groupId>
88
<artifactId>spotify-web-api-java-parent</artifactId>
9-
<version>2.1.0</version>
9+
<version>2.2.0-beta.0</version>
1010
<packaging>pom</packaging>
1111

1212
<name>spotify-web-api-java-parent</name>
@@ -58,13 +58,19 @@
5858
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
5959
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
6060
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
61+
<moditect-maven-plugin.version>1.0.0.RC1</moditect-maven-plugin.version>
6162

6263
<!-- Dependencies -->
6364
<lombok.version>1.18.20</lombok.version>
6465

6566
<!-- Test Dependencies -->
6667
<junit.version>5.7.2</junit.version>
6768
<mockito-junit-jupiter.version>3.11.1</mockito-junit-jupiter.version>
69+
70+
<moditect.sourceGroup>${project.groupId}</moditect.sourceGroup>
71+
<moditect.sourceArtifact>${project.artifactId}</moditect.sourceArtifact>
72+
<moditect.sourceVersion>${project.version}</moditect.sourceVersion>
73+
<moditect.module.name>de.sonallux.spotify</moditect.module.name>
6874
</properties>
6975

7076
<distributionManagement>
@@ -137,6 +143,26 @@
137143
<artifactId>maven-surefire-plugin</artifactId>
138144
<version>${maven-surefire-plugin.version}</version>
139145
</plugin>
146+
<plugin>
147+
<groupId>org.moditect</groupId>
148+
<artifactId>moditect-maven-plugin</artifactId>
149+
<version>${moditect-maven-plugin.version}</version>
150+
<executions>
151+
<execution>
152+
<id>add-module-infos</id>
153+
<phase>package</phase>
154+
<goals>
155+
<goal>add-module-info</goal>
156+
</goals>
157+
<configuration>
158+
<overwriteExistingFiles>true</overwriteExistingFiles>
159+
<module>
160+
<moduleInfoFile>src/moditect/module-info.java</moduleInfoFile>
161+
</module>
162+
</configuration>
163+
</execution>
164+
</executions>
165+
</plugin>
140166
</plugins>
141167
</build>
142168

@@ -176,5 +202,48 @@
176202
<profile>
177203
<id>cli</id>
178204
</profile>
205+
<profile>
206+
<!--
207+
This profile can be used to generate the module-info.java files by running `.\mvnw -Pmoditect generate-sources`
208+
The final module-info.java can be found in `target/generated-sources/modules/${moditect.module.name}/`
209+
Note: for generator-open-api this will fail because com.github.java-json-tools:jackson-coreutils-equivalence
210+
and com.github.java-json-tools:jackson-coreutils do export the same package `com.github.fge.jackson`.
211+
This is a split package which is not allowed by the module system. But the module-info.java can still be
212+
generated by manually executing the jdeps command without the jackson-coreutils-equivalence dependency.
213+
-->
214+
<id>moditect</id>
215+
<build>
216+
<plugins>
217+
<plugin>
218+
<groupId>org.moditect</groupId>
219+
<artifactId>moditect-maven-plugin</artifactId>
220+
<version>${moditect-maven-plugin.version}</version>
221+
<executions>
222+
<execution>
223+
<id>generate-module-info</id>
224+
<phase>generate-sources</phase>
225+
<goals>
226+
<goal>generate-module-info</goal>
227+
</goals>
228+
<configuration>
229+
<modules>
230+
<module>
231+
<artifact>
232+
<groupId>${moditect.sourceGroup}</groupId>
233+
<artifactId>${moditect.sourceArtifact}</artifactId>
234+
<version>${moditect.sourceVersion}</version>
235+
</artifact>
236+
<moduleInfo>
237+
<name>${moditect.module.name}</name>
238+
</moduleInfo>
239+
</module>
240+
</modules>
241+
</configuration>
242+
</execution>
243+
</executions>
244+
</plugin>
245+
</plugins>
246+
</build>
247+
</profile>
179248
</profiles>
180249
</project>

spotify-web-api-java-generator/pom.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,27 @@
77
<parent>
88
<groupId>de.sonallux.spotify</groupId>
99
<artifactId>spotify-web-api-java-parent</artifactId>
10-
<version>2.1.0</version>
10+
<version>2.2.0-beta.0</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>spotify-web-api-java-generator</artifactId>
15-
<version>2.1.0</version>
15+
<version>2.2.0-beta.0</version>
1616
<packaging>jar</packaging>
1717

1818
<name>spotify-web-api-java-generator</name>
1919
<description>A generator to generate the Java Wrapper for the Spotify Web Api</description>
2020
<url>https://github.com/sonallux/spotify-web-api-java</url>
2121

2222
<properties>
23-
<spotify-web-api-core.version>2021.6.17</spotify-web-api-core.version>
23+
<spotify-web-api-core.version>2021.6.18</spotify-web-api-core.version>
2424
<guava.version>30.1.1-jre</guava.version>
2525
<picocli.version>4.6.1</picocli.version>
2626
<flexmark.version>0.62.2</flexmark.version>
2727
<mustache.java.version>0.9.10</mustache.java.version>
2828
<slf4j.version>1.7.30</slf4j.version>
29+
30+
<moditect.module.name>de.sonallux.spotify.generator.java</moditect.module.name>
2931
</properties>
3032

3133
<dependencies>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module de.sonallux.spotify.generator.java {
2+
requires com.google.common;
3+
requires flexmark;
4+
requires flexmark.util.ast;
5+
requires flexmark.util.data;
6+
requires info.picocli;
7+
requires org.slf4j;
8+
requires com.github.mustachejava;
9+
requires spotify.web.api.core;
10+
11+
exports de.sonallux.spotify.generator.java;
12+
exports de.sonallux.spotify.generator.java.templates;
13+
exports de.sonallux.spotify.generator.java.util;
14+
}

spotify-web-api-java/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<parent>
88
<groupId>de.sonallux.spotify</groupId>
99
<artifactId>spotify-web-api-java-parent</artifactId>
10-
<version>2.1.0</version>
10+
<version>2.2.0-beta.0</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<artifactId>spotify-web-api-java</artifactId>
15-
<version>2.1.0</version>
15+
<version>2.2.0-beta.0</version>
1616
<packaging>jar</packaging>
1717

1818
<name>spotify-web-api-java</name>
@@ -22,6 +22,8 @@
2222
<properties>
2323
<okhttp.version>4.9.1</okhttp.version>
2424
<jackson.version>2.12.3</jackson.version>
25+
26+
<moditect.module.name>de.sonallux.spotify.api</moditect.module.name>
2527
</properties>
2628

2729
<dependencies>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module de.sonallux.spotify.api {
2+
requires com.fasterxml.jackson.datatype.jsr310;
3+
requires okio;
4+
requires com.fasterxml.jackson.annotation;
5+
requires com.fasterxml.jackson.core;
6+
requires com.fasterxml.jackson.databind;
7+
requires okhttp3;
8+
9+
exports de.sonallux.spotify.api;
10+
exports de.sonallux.spotify.api.apis;
11+
exports de.sonallux.spotify.api.apis.albums;
12+
exports de.sonallux.spotify.api.apis.artists;
13+
exports de.sonallux.spotify.api.apis.browse;
14+
exports de.sonallux.spotify.api.apis.episodes;
15+
exports de.sonallux.spotify.api.apis.follow;
16+
exports de.sonallux.spotify.api.apis.library;
17+
exports de.sonallux.spotify.api.apis.markets;
18+
exports de.sonallux.spotify.api.apis.personalization;
19+
exports de.sonallux.spotify.api.apis.player;
20+
exports de.sonallux.spotify.api.apis.playlists;
21+
exports de.sonallux.spotify.api.apis.search;
22+
exports de.sonallux.spotify.api.apis.shows;
23+
exports de.sonallux.spotify.api.apis.tracks;
24+
exports de.sonallux.spotify.api.apis.usersprofile;
25+
exports de.sonallux.spotify.api.authorization;
26+
exports de.sonallux.spotify.api.authorization.authorization_code;
27+
exports de.sonallux.spotify.api.authorization.client_credentials;
28+
exports de.sonallux.spotify.api.authorization.implicit_grant;
29+
exports de.sonallux.spotify.api.http;
30+
exports de.sonallux.spotify.api.models;
31+
exports de.sonallux.spotify.api.util;
32+
}

0 commit comments

Comments
 (0)