Skip to content
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

JPMS support #871

Closed
solomax opened this issue Oct 7, 2023 · 5 comments
Closed

JPMS support #871

solomax opened this issue Oct 7, 2023 · 5 comments

Comments

@solomax
Copy link
Contributor

solomax commented Oct 7, 2023

Hello,

Would it be possible to release version with Automati-Module-Name?

to avoid warnings like:

[WARNING] *********************************************************************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [prometheus-metrics-core-1.0.0.jar, prometheus-metrics-model-1.0.0.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************************************************************
@fstab
Copy link
Member

fstab commented Oct 9, 2023

Sure, thanks for bringing this up. Can you let me know how to do this? We already got this in our pom.xml:

<packaging>bundle</packaging>

What else do I need?

@solomax
Copy link
Contributor Author

solomax commented Oct 9, 2023

Hello @fstab,

As far as I understand this can be implemented 2 ways:

First Option: special entry in MANIFEST of every module

here is an idea:

diff --git a/pom.xml b/pom.xml
index 2845c00d..2f468daa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,6 +66,7 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <automatic-module-name>--module-name-need-to-be-overriden--</automatic-module-name>
     </properties>
 
     <distributionManagement>
@@ -192,6 +193,11 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <version>2.4.0</version>
                 <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Automatic-Module-Name>${automatic-module-name}</Automatic-Module-Name>
+                    </instructions>
+                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
diff --git a/prometheus-metrics-core/pom.xml b/prometheus-metrics-core/pom.xml
index 25007d1e..a31705c2 100644
--- a/prometheus-metrics-core/pom.xml
+++ b/prometheus-metrics-core/pom.xml
@@ -32,6 +32,9 @@
         </developer>
     </developers>
 
+    <properties>
+        <automatic-module-name>io.prometheus.metrics.core</automatic-module-name>
+    </properties>
     <dependencies>
         <dependency>
             <groupId>io.prometheus</groupId>

as you can see:

  1. special property is defined in parent pom
  2. later on it is set the valid name for this particular module (done for single module to illustrate the idea)

Another Option: module-info.java need to be added to every module

IMO first option is faster and lightweight, with second one you will create real modules :)

@fstab
Copy link
Member

fstab commented Oct 10, 2023

Thanks a lot @solomax ,I like option 1. What do people usually choose as a module name? Each module has a unique Java package, so we could use the package name. Or is it more common to use the name of the Maven module?

If you like to create a PR for this please go ahead.

@solomax
Copy link
Contributor Author

solomax commented Oct 11, 2023

#872

not sure what is DCO :(

solomax added a commit to solomax/client_java that referenced this issue Oct 15, 2023
Signed-off-by: Maxim Solodovnik <solomax@apache.org>
@agentgt
Copy link

agentgt commented Oct 18, 2023

@fstab You should use the package name. Maven module names are usually not valid because they have -.

While you are at since I was looking at the manifest you should not have your name in the jar manifest and the bnd timestamp should probably be removed as well.

See this: https://maven.apache.org/guides/mini/guide-reproducible-builds.html

and this:

https://reproducible-builds.org/docs/jvm/

and this:

https://github.com/jvm-repo-rebuild/reproducible-central#readme

Given how important prometheus is it should be on that list.

fstab pushed a commit that referenced this issue Oct 24, 2023
Signed-off-by: Maxim Solodovnik <solomax@apache.org>
@fstab fstab closed this as completed Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants