Skip to content

Add support for Java modules #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

name: Java Code Style Check with Maven

Expand All @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.8
java-version: '17'
- name: Code Style Check
run: mvn -B checkstyle:check --file pom.xml
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.8
java-version: '17'
- name: Build
run: mvn -DskipTests package --file pom.xml

Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.8
java-version: '17'
- name: Test
run: mvn test --file pom.xml
8 changes: 4 additions & 4 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
name: SonarQube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: '17'
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
Expand Down
47 changes: 36 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
<url>https://github.com/TooTallNate/Java-WebSocket</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.25</slf4j.version>
<slf4j.version>2.0.6</slf4j.version>

<!-- Test dependencies versions -->
<junit.version>4.12</junit.version>
<org.json.version>20180813</org.json.version>

<!-- Maven plugin versions -->
<bnd.maven.plugin.version>4.3.1</bnd.maven.plugin.version>
<bnd.maven.plugin.version>6.4.0</bnd.maven.plugin.version>
<maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version>
<maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
<maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version>
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
<maven.javadoc.plugin.version>2.10.3</maven.javadoc.plugin.version>
<maven.shade.plugin.version>3.1.0</maven.shade.plugin.version>
<maven.source.plugin.version>3.0.0</maven.source.plugin.version>
<maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
<maven.javadoc.plugin.version>3.5.0</maven.javadoc.plugin.version>
<maven.shade.plugin.version>3.4.1</maven.shade.plugin.version>
<maven.source.plugin.version>3.2.1</maven.source.plugin.version>
<nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version>
<sonar.projectKey>org.java-websocket:Java-WebSocket</sonar.projectKey>
<sonar.organization>marci4-github</sonar.organization>
Expand Down Expand Up @@ -86,10 +86,12 @@
</goals>
<configuration>
<bnd><![CDATA[
Multi-Release: true
Export-Package: \
org.java_websocket.*
-noextraheaders: true
-snapshot: SNAPSHOT
-fixupmessages "Classes found in the wrong directory"; restrict:=error; is:=warning
]]></bnd>
</configuration>
</execution>
Expand All @@ -99,10 +101,32 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>7</release>
</configuration>
</execution>

<execution>
<id>module-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -183,6 +207,7 @@
<version>${maven.checkstyle.plugin.version}</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
<excludes>**/module-info.java</excludes>
<violationSeverity>warning</violationSeverity>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
Expand Down
19 changes: 19 additions & 0 deletions src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* This module implements a barebones WebSocket server and client.
*/
module org.java_websocket {
requires transitive org.slf4j;

exports org.java_websocket;
exports org.java_websocket.client;
exports org.java_websocket.drafts;
exports org.java_websocket.enums;
exports org.java_websocket.exceptions;
exports org.java_websocket.extensions;
exports org.java_websocket.extensions.permessage_deflate;
exports org.java_websocket.framing;
exports org.java_websocket.handshake;
exports org.java_websocket.interfaces;
exports org.java_websocket.protocols;
exports org.java_websocket.server;
}