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

Jakarta Namespace Support #116

Merged
merged 7 commits into from Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -27,6 +27,18 @@ licensed as per:

whereas 3.0 will use [ByteBuddy](https://github.com/raphw/byte-buddy) (licensed as per https://github.com/raphw/byte-buddy/blob/master/LICENSE)


## Using Jakarta
* Jakarta can be referenced for the JAXB module by using the classifier "jakarta" in your dependency
```
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<classifier>jakarta</classifier>
</dependency>
```


## Status

[![Build Status](https://travis-ci.org/FasterXML/jackson-modules-base.svg)](https://travis-ci.org/FasterXML/jackson-modules-base)
Expand Down
38 changes: 38 additions & 0 deletions jaxb/pom.xml
Expand Up @@ -97,6 +97,44 @@ data-binding.
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<jvmVersion>11</jvmVersion>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this solves the javassist and jaxen issues in older jdk 7 frameworks reading module-info files, as well as doesn't get removed during the shade for jakarta namespacing

this was the trick to make it all work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about JDKs 9 and 10? They are not LTS versions but just in case...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is always that one person so it definitely is safer -

I double checked - for me I put it there as other modules override at 11, and i needed to overwrite those xD So no issue there will update

</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>jakarta</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jakarta</shadedClassifierName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>javax.xml.bind</pattern>
<shadedPattern>jakarta.xml.bind</shadedPattern>
</relocation>
<relocation>
<pattern>javax.activation</pattern>
<shadedPattern>jakarta.activation</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so does this create additional second jar, with different classifier, in addition to "vanilla" one?
So that the default one already produced is not very different (except for modules-info class being under jdk-version-dependant dir); but there's second jar with additional embedded classes from javax.activation?

But even then, from what I remember wrt OSGi, there is always backlash on adding shaded secondary components, when they overlap with other artifacts (that is, classes also provided by a standalone package).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok n/m. Cloned branch, looked at what is produced. So it is not shading in activation jar classes or anything so that's fine. I assume it renames references somewhere... in modules-info.class or... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relocation on the shade is doing a transform on the .class files just renaming javax. to jakarta. :)

There shouldn't be any clash with OSGi - the bundle plugin looks to do quite a good job, but no files other than meta-inf/services and .class files are altered during the shade :)

</plugin>
</plugins>
</build>
Expand Down
3 changes: 2 additions & 1 deletion jaxb/src/moditect/module-info.java
@@ -1,7 +1,8 @@
module com.fasterxml.jackson.module.jaxb {
requires java.logging;
requires java.xml;
requires java.xml.bind;
requires static java.xml.bind;
requires static jakarta.xml.bind;

// Needed for JDK9+, but optionally only
requires static java.activation;
Expand Down