简体   繁体   中英

Migration to Jakarta EE 10 - 3rd party namespaces

I am currently trying to migrate our product from Jakarta EE 8 to Jakarta EE 10. According to the namespace changes of Jakarta APIs I've decided to use intellij Migration tool. After that when I tried to build the application I found out following problem.

We are using 3rd party dependency which has class let's say Person . All constructors of particular class throw javax.activation.MimeTypeParseException

We had a class Student which extends class Person so after migration, our class is importing exception class from the new namespace -> jakarta.activation.MimeTypeParseException;

import jakarta.activation.MimeTypeParseException;

public class Student extends Person {

  public Student(String name) throws MimeTypeParseException {
    super(name);
  }
}

Having the constructor like this, calling super is throwing error: Unhandled exception javax.activation.MimeTypeParseException

I've tried to use the newest version of 3rd party package but it still uses the old Javax namespace.

Is there somebody with a similar experience? Or do you know how to solve that, without downloading 3rd party and migrating also its code?

In case somebody will face this problem, I've found a tool that can help with that problem if you have a 3rd party .jar file.

The Transformer tool offers renaming packages within the.jar archive. Renaming is defined in configuration files(eg jakarta-renames.properties ) so you can customize them. For me, the default settings were enough.

After cloning and building Transformer you can run it from your terminal:

java -jar ~/org.eclipse.transformer.cli-0.6.0-SNAPSHOT.jar 3rdparty.jar updatedJar.jar -tr jakarta-renames.properties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM