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

java 11 module problem with secret-service-1.0.0-RC.3.jar #9

Closed
aanno opened this issue Mar 22, 2020 · 4 comments
Closed

java 11 module problem with secret-service-1.0.0-RC.3.jar #9

aanno opened this issue Mar 22, 2020 · 4 comments

Comments

@aanno
Copy link

aanno commented Mar 22, 2020

There are some unwanted directory entries in the jar:

$ unzip -l lib/secret-service-1.0.0-RC.3.jar 
Archive:  lib/secret-service-1.0.0-RC.3.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
       97  05-07-2019 02:20   META-INF/MANIFEST.MF
        0  05-07-2019 02:20   META-INF/
        0  05-07-2019 02:19   org/
        0  05-07-2019 02:19   org/gnome/
        0  05-07-2019 02:19   org/gnome/keyring/
        0  05-07-2019 02:19   org/gnome/keyring/interfaces/
        0  05-07-2019 02:19   org/freedesktop/
        0  05-07-2019 02:19   org/freedesktop/secret/
        0  05-07-2019 02:19   org/freedesktop/secret/interfaces/
        0  05-07-2019 02:19   org/freedesktop/secret/simple/
        0  05-07-2019 02:19   org/freedesktop/secret/handlers/
        0  05-07-2019 02:19   org/freedesktop/secret/errors/
        0  05-07-2019 02:19   org/freedesktop/dbus/
...

This is bad when using the java 11 module system because it leads to the 'split jar' problem:

error: module secret.service reads package org.freedesktop.dbus from both secret.service and dbus.java
@swiesend
Copy link
Owner

swiesend commented Mar 25, 2020

Thank you @aanno for pointing this out. What is the proper way to solve this issue? Is there some option for the maven-jar-plugin? I tried it with excludes/exclude, but that obviously removed too much with **/. Do I only want to get rid of the empty dirs or is there something deeper to this with the module system?

Normally I just code some Scala and did not familiarize myself yet with the Java module system and I am far from knowing maven well.

@aanno
Copy link
Author

aanno commented Mar 28, 2020

Well, I looked into this and I'm confused as well. In my professional life, I switched from maven to gradle with java 11 because of many problems with java 11 module system builds. For me it looks like that the jar plugin is adding zip directory entries for (all recursive) paths where there are class files (I have no idea why org.freedesktop.dbus is included, though). I still need some time for evaluating. BTW, would you accept a 'gradle' solution?

In real life, this might not be a problem. There seems to be very few people who care about module system builds.

@aanno
Copy link
Author

aanno commented Mar 28, 2020

Well, adding

            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>org/freedesktop/dbus/**/*</exclude>
                    </excludes>
                </configuration>
            </plugin>

to plugins is enough to get rid off the problem. (No need for gradle here.) Still no idea this zip directory entry is included in the first place.

@swiesend
Copy link
Owner

swiesend commented Mar 29, 2020

I moved the following file, which caused the problem into the org.freedesktop.secret package:

9658653

Now there is no org/freedesktop/dbus/ anymore:

$ jar tf target/secret-service-1.0.0.jar 
META-INF/MANIFEST.MF
META-INF/
org/
org/gnome/
org/gnome/keyring/
org/gnome/keyring/interfaces/
org/freedesktop/
org/freedesktop/secret/
org/freedesktop/secret/interfaces/
org/freedesktop/secret/simple/
org/freedesktop/secret/handlers/
org/freedesktop/secret/errors/
META-INF/maven/
META-INF/maven/de.swiesend/
META-INF/maven/de.swiesend/secret-service/
org/gnome/keyring/interfaces/InternalUnsupportedGuiltRiddenInterface.class
org/freedesktop/secret/handlers/SignalHandler$SingletonHelper.class
org/freedesktop/secret/handlers/MessageHandler.class
org/gnome/keyring/InternalUnsupportedGuiltRiddenInterface.class
org/freedesktop/secret/Static$Secret.class
org/freedesktop/secret/Static$Convert.class
org/freedesktop/secret/Collection.class
org/freedesktop/secret/interfaces/Collection$ItemChanged.class
org/freedesktop/secret/interfaces/Prompt$Completed.class
org/freedesktop/secret/interfaces/AbstractInterface.class
org/freedesktop/secret/interfaces/Session.class
org/freedesktop/secret/interfaces/Collection$ItemDeleted.class
org/freedesktop/secret/interfaces/Prompt.class
org/freedesktop/secret/interfaces/Collection$ItemCreated.class
org/freedesktop/secret/interfaces/Service$CollectionChanged.class
org/freedesktop/secret/interfaces/Item.class
org/freedesktop/secret/interfaces/Service.class
org/freedesktop/secret/interfaces/Service$CollectionCreated.class
org/freedesktop/secret/interfaces/Collection.class
org/freedesktop/secret/simple/SimpleCollection.class
org/freedesktop/secret/handlers/Messaging.class
org/freedesktop/secret/handlers/SignalHandler.class
org/freedesktop/secret/errors/IsLocked.class
org/freedesktop/secret/errors/NoSuchObject.class
org/freedesktop/secret/errors/NoSession.class
org/freedesktop/secret/TransportEncryption.class
org/freedesktop/secret/Static$DBus$ObjectPaths.class
org/freedesktop/secret/Static$DBus$Interfaces.class
org/freedesktop/secret/Session.class
org/freedesktop/secret/Prompt.class
org/freedesktop/secret/Static$ObjectPaths.class
org/freedesktop/secret/Secret.class
org/freedesktop/secret/Static$Service.class
org/freedesktop/secret/Static$RFC_2409.class
org/freedesktop/secret/Item.class
org/freedesktop/secret/Static$Interfaces.class
org/freedesktop/secret/Static.class
org/freedesktop/secret/Static$DBus.class
org/freedesktop/secret/Pair.class
org/freedesktop/secret/Service.class
org/freedesktop/secret/Static$DBus$Service.class
org/freedesktop/secret/Static$RFC_2409$SecondOakleyGroup.class
org/freedesktop/secret/Static$Algorithm.class
META-INF/maven/de.swiesend/secret-service/pom.xml
META-INF/maven/de.swiesend/secret-service/pom.properties
org/freedesktop/secret/interfaces/Service$CollectionDeleted.class

I guess the same applies for org/gnome/keyring/, but as non of my dependecies introduces it I'll will claim it, as it is an essential part of the prompting without passphrases, which wouldn't work otherwise.

@aanno does this look better to you. You might want to checkout my 1.0.0 branch to check for yourself. I built it with mvn clean package. It is not published yet.

@swiesend swiesend closed this as completed May 7, 2020
purejava added a commit to purejava/secret-service that referenced this issue Oct 3, 2023
Refactor DBus Connection Initialization
Fixes cryptomator#6

Co-authored-by: Sebastian Stenzel <overheadhunter@users.noreply.github.com>
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

2 participants