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

move dependency java.xml.bind to jakarta.xml.bind #2991

Open
simondivi opened this issue Jun 22, 2022 · 12 comments
Open

move dependency java.xml.bind to jakarta.xml.bind #2991

simondivi opened this issue Jun 22, 2022 · 12 comments

Comments

@simondivi
Copy link

Environment

Liquibase Version: 4.12.0

Description

In order to move into the direction of JPMS it would be a good idea to switch to jakarta libraries since jakarta is the new official home for this javax package. It should be pretty much a drop in replacement with changing the dependencies and imports - assuming there are enough tests.

Actual Behavior

The javax.xml.bind package is used with no module support. This dependency is available at different coordinates and in slightly different configurations, this leads to many dependencies wanting the packages/code but end up using different dependencies.

Expected/Desired Behavior

Liquibase has a dependency on jakarta.xml.bind which in turn provides a module name.

@kataggart kataggart added this to To Do in Conditioning++ via automation Jun 23, 2022
@kataggart kataggart removed this from To Do in Conditioning++ Sep 2, 2022
@kataggart kataggart added this to the Epic: SBOM MVP milestone Sep 2, 2022
@hberrayana
Copy link

Any update, please? Spring boot 3 is almost released and it's incompatible with liquibase for this particular reason

@filiphr
Copy link

filiphr commented Nov 25, 2022

We are in the process of migrating to Spring Boot 3 and it would be good if Liquibase can provide a release which is going to depend on jakarta.xml.bind and / or remove the dependency.

@DanielFran
Copy link

We are migrating JHipster to spring-boot 3 (jhipster/generator-jhipster#19791 and jhipster/jhipster-lite#3750), so it would be good that liquibase provide support for it.

related with liquibase/liquibase-hibernate#434 also.

@hberrayana
Copy link

I think this is resolved in 4.18

@filiphr
Copy link

filiphr commented Dec 30, 2022

I don't think so @hberrayana. If you see the liquibase-core 4.18 pom.xml on Maven Central you'll see that the javax.xml.bind dependency is still there.

The strangest thing though is that the javax.xml.bind is only needed for the commercial jar. At least if you look at the pom.xml on GitHub.

According to #2629 there are 2 jars now. Perhaps something needs to be done for the final build. @kataggart and @nvoxland can you perhaps have a look at this?

@wutzebaer
Copy link

wutzebaer commented Jan 12, 2023

Hi There is a similar problem with the maven liquibase plugin:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.18.0:diff (default-cli) on project ims-backend: Execution default-cli of goal org.liquibase:liquibase-maven-plugin:4.18.0:diff failed: An API incompatibility was encountered while executing org.liquibase:liquibase-maven-plugin:4.18.0:diff: java.lang.NoSuchMethodError: 'javax.persistence.spi.PersistenceUnitInfo org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainDefaultPersistenceUnitInfo()'
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.liquibase:liquibase-maven-plugin:4.18.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/XXXX/.m2/repository/org/liquibase/liquibase-maven-plugin/4.18.0/liquibase-maven-plugin-4.18.0.jar
[ERROR] urls[1] = file:/C:/Users/XXXX/.m2/repository/org/liquibase/liquibase-core/4.18.0/liquibase-core-4.18.0.jar
[ERROR] urls[2] = file:/C:/Users/XXXX/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar
[ERROR] urls[3] = file:/C:/Users/XXXX/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar
[ERROR] urls[4] = file:/C:/Users/XXXX/.m2/repository/org/yaml/snakeyaml/1.33/snakeyaml-1.33.jar
[ERROR] urls[5] = file:/C:/Users/XXXX/.m2/repository/com/opencsv/opencsv/5.7.1/opencsv-5.7.1.jar
[ERROR] urls[6] = file:/C:/Users/XXXX/.m2/repository/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar
[ERROR] urls[7] = file:/C:/Users/XXXX/.m2/repository/org/apache/commons/commons-text/1.10.0/commons-text-1.10.0.jar
[ERROR] urls[8] = file:/C:/Users/XXXX/.m2/repository/org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar
[ERROR] urls[9] = file:/C:/Users/XXXX/.m2/repository/org/liquibase/liquibase-commercial/4.18.0/liquibase-commercial-4.18.0.jar
[ERROR] urls[10] = file:/C:/Users/XXXX/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]

I'm using spring boot 3

and

org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainDefaultPersistenceUnitInfo()

returns now

jakarta.persistence.spi.PersistenceUnitInfo

instead of

javax.persistence.spi.PersistenceUnitInfo

ehcache uses a classifier for jakarta, maybe it's an option for liquibase, too?

<dependency>
	<groupId>org.ehcache</groupId>
	<artifactId>ehcache</artifactId>
	<!-- https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#ehcache3 -->
	<classifier>jakarta</classifier>
</dependency>

@nvoxland
Copy link
Contributor

The difficultly in switching is that we need to support older versions of java (down to java 8) and people who are running in environments with javax.bind instead of jakarta.

Some early testing we've been doing with spring 3 seemed to show the existing liquibase code had no problem running in spring 3. What sorts of problems are you hitting?

@cardano-tools-nft
Copy link

im meantime i could solve the problem by using liquibase-hibernate6, which was only available for 4.18.0, but spring boot 3 ueses currently 4.17.0

@xazap
Copy link
Contributor

xazap commented Nov 25, 2023

The difficultly in switching is that we need to support older versions of java (down to java 8) and people who are running in environments with javax.bind instead of jakarta.

The solution to this would be to create a multi-release JAR of the liquibase-core dependency. The multi-release JAR should have alternatives for all classes that import javax.xml.bind starting from Java 11. This will give everyone a seamless upgrade path.

Reference: https://docs.oracle.com/en/java/javase/11/docs/specs/jar/jar.html
See the Log4j2 GitHub for an example of a multi-release library JAR: https://github.com/apache/logging-log4j2

Some early testing we've been doing with spring 3 seemed to show the existing liquibase code had no problem running in spring 3. What sorts of problems are you hitting?

Although Liquibase-core seems to work fine in a JEE10 environment, it forces us to include ancient javax XML packages in the deployables. This is a waste since the Jakarta XML packages are already provided by the JEE10 container.

All major runtime components have moved to jakarta XML: Java 11+, JEE9, JEE10, Spring Boot 3,etc. Liquibase is late to the game by not supporting jakarta XML.

@kunalvarpe
Copy link

Is there any plan this will be going to fix in some release or as patch version

@bmarwell
Copy link

Wow, this is open now for two years and still considered an (optional?) enhancement.
It seems that liquibase was discontinued. Too bad.

@bmarwell
Copy link

I could not find anything in the docs, but I just stumbled over:

LiquibaseJakartaServletListener

-- Problem solved (for me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Open Issues
Development

No branches or pull requests