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

Problem using maven-jlink-plugin with POM-only junixsocket-core artifact #153

Closed
sblantipodi opened this issue Feb 26, 2024 · 7 comments
Closed
Assignees
Labels
compatibility issue An issue with a particular runtime environment has workaround There is a workaround available to prevent the issue or reduce its impact merged A fix has been merged to main
Milestone

Comments

@sblantipodi
Copy link

Hi all.

When I try to use jlink on software that uses junixsocket I get this error:
[ERROR] The given dependency C:\Users\sblantipodi.m2\repository\com\kohlschutter\junixsocket\junixsocket-core\2.8.3\junixsocket-core-2.8.3.pom does not have a module-info.java file. So it can't be linked.

any plan to add a module-info?

Thanks :)

@kohlschuetter
Copy link
Member

kohlschuetter commented Feb 27, 2024

Hi @sblantipodi !

junixsocket-core is a POM-only dependency; it should not cause errors (the junixsocket jars are already modularized / contain module-info.class)
Can you please provide a snippet that reproduces the issue?

@kohlschuetter
Copy link
Member

As a workaround, you may replace the dependency to junixsocket-core with the dependencies declared in junixsocket-core directly, and (if necessary) add an exclusion for junixsocket-core from any of your dependencies (check with mvn dependency:tree or via your IDE)

    <dependencies>
        <dependency>
            <groupId>com.kohlschutter.junixsocket</groupId>
            <artifactId>junixsocket-native-common</artifactId>
            <version>${junixsocket.version}</version>
        </dependency>
        <dependency>
            <groupId>com.kohlschutter.junixsocket</groupId>
            <artifactId>junixsocket-common</artifactId>
            <version>${junixsocket.version}</version>
        </dependency>
    </dependencies>

@kohlschuetter kohlschuetter changed the title [Feature request] Any plan in adding a module-info ? Problem using jlink with POM-only junixsocket-core artifact Mar 1, 2024
@kohlschuetter kohlschuetter added information needed More information is required compatibility issue An issue with a particular runtime environment labels Mar 1, 2024
@sblantipodi
Copy link
Author

sblantipodi commented Mar 5, 2024

@kohlschuetter thanks for the kind answer, I appreciate it.
Sources are available here.

junixsocket is used inside the dbus-java lib that I use in my project.

kohlschuetter added a commit that referenced this issue Mar 5, 2024
Demonstrates how to use jlink/jpackage with junixsocket.

#153
kohlschuetter added a commit that referenced this issue Mar 5, 2024
Demonstrates how to use jlink/jpackage with junixsocket.

#153
@kohlschuetter
Copy link
Member

@sblantipodi Please see the new junixsocket-demo-jpackagejlink module for instructions how to use junixsocket with jlink and/or jpackage.

I'm using jlink-maven-plugin instead of maven-jlink-plugin, and that seems to work just fine.

Please let me know how that goes for your project. — I didn't see the place where you exactly get the error (maybe you could point me at it?)

On a related note: Did you look into using GraalVM native-image instead of jlink? That usually produces much more optimized code. junixsocket supports that, too.

Other than that: Your ambient light project looks really cool! I was reading about such a tool just a few days ago. Good to see that junixsocket can play a small role there. Keep up the great work!

@kohlschuetter
Copy link
Member

@sblantipodi
I've filed a bug with maven-jlink-plugin (MJLINK-82), along with a patch to fix the issue on their end.

I also updated the demo POM with a profile triggering the bug. If you use a local snapshot build of maven-jlink-plugin with the patch applied, linking should work just fine.

@kohlschuetter kohlschuetter changed the title Problem using jlink with POM-only junixsocket-core artifact Problem using maven-jlink-plugin with POM-only junixsocket-core artifact Mar 6, 2024
@kohlschuetter kohlschuetter added the has workaround There is a workaround available to prevent the issue or reduce its impact label Mar 6, 2024
@sblantipodi
Copy link
Author

@kohlschuetter wow, great! thanks for the awesome work :)

@kohlschuetter kohlschuetter added merged A fix has been merged to main and removed information needed More information is required labels Mar 18, 2024
@kohlschuetter kohlschuetter added this to the 2.9.1 milestone Mar 18, 2024
@kohlschuetter
Copy link
Member

2.9.1 has been released, please verify. Thanks again for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility issue An issue with a particular runtime environment has workaround There is a workaround available to prevent the issue or reduce its impact merged A fix has been merged to main
Projects
None yet
Development

No branches or pull requests

2 participants