Skip to content

Java migration in package-info.java files are not working #1018

@Pumu3

Description

@Pumu3

What version of OpenRewrite are you using?

I am using

  • Apache Maven 3.9.10
  • rewrite-maven-plugin 6.34.0
  • rewrite-migrate-java 3.30.1

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

<plugin>
      <groupId>org.openrewrite.maven</groupId>
      <artifactId>rewrite-maven-plugin</artifactId>
      <version>6.34.0</version>
      <configuration>
        <exportDatatables>true</exportDatatables>
        <activeRecipes>
          <recipe>org.openrewrite.java.migrate.jakarta.JakartaEE10</recipe>
          <recipe>org.openrewrite.java.migrate.jakarta.JavaxXmlBindMigrationToJakartaXmlBind</recipe>
          <recipe>org.openrewrite.java.OrderImports</recipe>
          <recipe>org.openrewrite.java.RemoveUnusedImports</recipe>
          <recipe>org.openrewrite.java.format.BlankLines</recipe>
          <recipe>org.openrewrite.java.format.AutoFormat</recipe>
          <recipe>org.openrewrite.java.format.EmptyNewlineAtEndOfFile</recipe>
          <recipe>org.openrewrite.java.format.NormalizeLineBreaks</recipe>
          <recipe>org.openrewrite.java.format.NormalizeFormat</recipe>
          <recipe>org.openrewrite.java.format.NormalizeTabsOrSpaces</recipe>
          <recipe>org.openrewrite.java.format.WrappingAndBraces</recipe>
        </activeRecipes>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.openrewrite.recipe</groupId>
          <artifactId>rewrite-migrate-java</artifactId>
          <version>3.30.1</version>
        </dependency>
      </dependencies>
      <executions>
        <execution>
          <phase>generate-sources</phase>
          <goals>
            <goal>runNoFork</goal>
          </goals>
        </execution>
      </executions>
    </plugin>

What is the smallest, simplest way to reproduce the problem?

mvn compile

What did you expect to see?

Change all package-info.java where we have "javax" to "jakarta" references

@javax.xml.bind.annotation.XmlSchema(namespace = "http://XXXXX")
package net.bizkaia.srwa;

to

@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://XXXX")
package net.bizkaia.srwa;

Import changes were apply correctly:

package XXX.XXX.srwa;

import jakarta.xml.bind.annotation.*;
.........
........

What did you see instead?

No applied changes and got errors in compilation phase related with javax references

What is the full stack trace of any errors you encountered?

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< net.bizkaia:SRWAWSSOA >------------------------
[INFO] Building SRWAWSSOA 1.0.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- rewrite:6.34.0:runNoFork (default) @ SRWAWSSOA ---
[INFO] Using active recipe(s) [org.openrewrite.java.migrate.jakarta.JakartaEE10, org.openrewrite.java.migrate.jakarta.JavaxXmlBindMigrationToJakartaXmlBind, org.openrewrite.java.OrderImports, org.openrewrite.java.RemoveUnusedImports, org.openrewrite.java.format.BlankLines, org.openrewrite.java.format.AutoFormat, org.openrewrite.java.format.EmptyNewlineAtEndOfFile, org.openrewrite.java.format.NormalizeLineBreaks, org.openrewrite.java.format.NormalizeFormat, org.openrewrite.java.format.NormalizeTabsOrSpaces, org.openrewrite.java.format.WrappingAndBraces]
[INFO] Using active styles(s) []
[INFO] Validating active recipes...
[INFO] Project [SRWAWSSOA] Resolving Poms...
[INFO] Project [SRWAWSSOA] Parsing source files
[INFO] Running recipe(s)...
[INFO] Printing available datatables to: target/rewrite/datatables/2026-03-19_10-08-39-403
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ SRWAWSSOA ---
[INFO] Copying 0 resource from src/main/resources to target/classes
[INFO] 
[INFO] --- compiler:3.15.0:compile (default-compile) @ SRWAWSSOA ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 29 source files with javac [debug release 21] to target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/developer/workspace/src/main/java/XXXX/XXXX/srwa/vo/package-info.java:[1,27] package javax.xml.bind.annotation does not exist
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  37.983 s
[INFO] Finished at: 2026-03-19T10:08:45Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:compile (default-compile) on project SRWAWSSOA: Compilation failure: Compilation failure: 
[ERROR] /home/developer/workspace/src/main/java/XXX/XXXX/srwa/vo/package-info.java:[1,27] package javax.xml.bind.annotation does not exist
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions