Skip to content

Commit

Permalink
Refactor the packaging for JPMS and add module-info
Browse files Browse the repository at this point in the history
The server jar no longer contains a copy of the client classes. The copy
has been replaced by a dependency.
  • Loading branch information
markt-asf committed Nov 23, 2021
1 parent 05c2a4d commit ca41696
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 89 deletions.
37 changes: 23 additions & 14 deletions api/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@
</parent>

<artifactId>jakarta.websocket-client-api</artifactId>
<packaging>bundle</packaging>
<packaging>jar</packaging>
<name>Jakarta WebSocket - Client API</name>
<description>Jakarta WebSocket - Client API</description>
<url>https://projects.eclipse.org/projects/ee4j.websocket</url>

<properties>
<jpms.name>jakarta.websocket.client</jpms.name>
</properties>

<build>
<resources>
<resource>
Expand All @@ -56,6 +52,28 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>9</release>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
<executions>
<execution>
<id>base-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>8</release>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.glassfish.copyright</groupId>
Expand All @@ -69,15 +87,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>jakarta.websocket.client</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
20 changes: 20 additions & 0 deletions api/client/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2021 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
module jakarta.websocket.client {
exports jakarta.websocket;

uses jakarta.websocket.ContainerProvider;
}
3 changes: 0 additions & 3 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Automatic-Module-Name>${jpms.name}</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
Expand Down
97 changes: 25 additions & 72 deletions api/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@
</parent>

<artifactId>jakarta.websocket-api</artifactId>
<packaging>bundle</packaging>
<packaging>jar</packaging>
<name>Jakarta WebSocket - Server API</name>
<description>Jakarta WebSocket - Server API</description>
<url>https://projects.eclipse.org/projects/ee4j.websocket</url>

<properties>
<jpms.name>jakarta.websocket</jpms.name>
</properties>

<build>
<resources>
<resource>
Expand All @@ -56,6 +52,28 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>9</release>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
<executions>
<execution>
<id>base-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>8</release>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.glassfish.copyright</groupId>
Expand All @@ -69,89 +87,24 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<classesDirectory>${project.build.directory}/sources</classesDirectory>
</configuration>
</execution>
</executions>
<version>3.1.0</version>
</plugin>
<!-- Disable source JAR from EE4j parent as we create the source JAR above -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>

<!-- Module specific plugins -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>sources-as-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-client-sources</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/sources</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-client-api</artifactId>
<version>${project.version}</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
22 changes: 22 additions & 0 deletions api/server/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2021 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
module jakarta.websocket {
exports jakarta.websocket.server;

requires transitive jakarta.websocket.client;

uses jakarta.websocket.server.ServerEndpointConfig.Configurator;
}
8 changes: 8 additions & 0 deletions spec/src/main/asciidoc/WebSocket.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,14 @@ Clarify the expected handling of user properties.
Clarify that a zero or negative value disables the session idle timeout and improve
the language used in the Javadoc for the other timeouts.

* Removed the copy of the `jakarta.websocket.*` classes from the
`jakarta.websocket-api` jar and replaced the copy with a dependency on the
`jakarta.websocket-client-api` jar.

* Added JPMS module descriptors that define the client module name as
`jakarta.websocket.client` and the server module name as `jakarta.websocket`
with the server module dpending on the client module.

[[changes-since-jsr-356]]
=== Changes Between 2.0 and JSR-356

Expand Down

0 comments on commit ca41696

Please sign in to comment.