Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

chore: add Automatic-Module-Name #13

Closed
wants to merge 1 commit into from
Closed

chore: add Automatic-Module-Name #13

wants to merge 1 commit into from

Conversation

florian-beetz
Copy link

Add Automatic-Module-Name entry to the MANIFEST.MF
Value is org.postgresql.jdbc

pgjdbc/pgjdbc#1031

Add Automatic-Module-Name entry to the MANIFEST.MF
Value is `org.postgresql.jdbc`

pgjdbc/pgjdbc#1031
@florian-beetz
Copy link
Author

This PR adds @AlexElin's changes of pgjdbc/pgjdbc#1059 to pgjdbc-parent-pom as suggested by @vlsi .

@davecramer
Copy link
Member

Is there any way to test this ?

@florian-beetz
Copy link
Author

@davecramer Yes, I tested this by adjusting the parent version of https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/pom.xml#L6 to 1.1.4-SNAPSHOT and running

mvn install -f pgjdbc-parent-poms/pom.xml
mvn package -f pgjdbc/pom.xml -DskipTests=true
unzip -p pgjdbc/pgjdbc/target/postgresql-42.2.3-SNAPSHOT.jar META-INF/MANIFEST.MF | grep Automatic-Module-Name

@cowwoc
Copy link

cowwoc commented Jul 30, 2019

@davecramer Can this be merged?

@davecramer
Copy link
Member

davecramer commented Jul 31, 2019

So I've just tested this and from what I can tell we have to use a JDK > 1.8 to build it to make this happen, it's somewhat easier to add it to pgjdbc/pom.xml

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                  <archive>
                    <manifestEntries>
                      <Automatic-Module-Name>org.postgresql.jdbc</Automatic-Module-Name>
                    </manifestEntries>
                  </archive>
              </configuration>
      </plugin>

@cowwoc
Copy link

cowwoc commented Jul 31, 2019

@davecramer I'm not sure I understand why you'd need a JDK > 1.8 to build it. The code snippet you shared will run on older JDKs.

I must have misunderstood what you meant somehow :)

@davecramer
Copy link
Member

@cowwoc When I tried this using jdk8 the Automatic-Module-Name was not in the manifest. When I switched to JDK10 it was. I'd love to be proven wrong.

@cowwoc
Copy link

cowwoc commented Jul 31, 2019

@davecramer This seems to work for me under JDK 8. I ran mvn install on the attached testcase and as you can see the generated JAR file has the Automatic-Module-Name attribute in the manifest file.

automatic-module-name-jdk8.zip

@davecramer
Copy link
Member

Seems to work fine in travis using maven as well. I have no idea what I did wrong. I prefer it in maven

@davecramer
Copy link
Member

fixed in pgjdbc/pgjdbc#1538

@davecramer davecramer closed this Jul 31, 2019
@cowwoc
Copy link

cowwoc commented Jul 31, 2019

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants