rewrite-migrate-java icon indicating copy to clipboard operation
rewrite-migrate-java copied to clipboard

JodaTime should pull threeten-extra from resources, not classpath

Open timtebeek opened this issue 11 months ago • 3 comments

What's changed?

Add threeten-extra to TypeTable.

What's your motivation?

Could not be found on classpath(..).

  • Partial fix for https://github.com/openrewrite/rewrite-migrate-java/issues/673

Anything in particular you'd like reviewers to focus on?

Please ./gradlew pTML, then use 3.3.0-SNAPSHOT of rewrite-migrate-java with rewrite-maven-plugin v6.1.3 or v6.1.4.

Anyone you would like to review specifically?

@YarochkinMichael

timtebeek avatar Feb 15 '25 13:02 timtebeek

Alternatively, adding threeten-extra to the plugin itself also seems to work as a workaround for now

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>my.test</groupId>
    <artifactId>openrewrite-test</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>6.1.3</version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.java.migrate.joda.NoJodaTime</recipe>
                    </activeRecipes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-migrate-java</artifactId>
                        <version>3.2.0</version>
                    </dependency>
                    <dependency>
                        <groupId>org.threeten</groupId>
                        <artifactId>threeten-extra</artifactId>
                        <version>1.8.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>

timtebeek avatar Feb 15 '25 13:02 timtebeek

There's additional usages that we'd need to replace for a proper fix: image

timtebeek avatar Feb 15 '25 13:02 timtebeek

Thanks @timtebeek! with Bazel we had our own way to pass classpaths so didn't realize about this issue.

amishra-u avatar Feb 24 '25 22:02 amishra-u

This PR is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 26 '25 04:05 github-actions[bot]