0

In an attempt to upgrade to Java 17 compliant code, when using an older versions of rewrite-maven-plugin(5.30.0) and rewrite-migrate-java(2.13.0), the rewrite:run works as expected.

However, when using newer versions of the same jars, such as 6.8.1 and 2.20.0 respectively, the rewrite:run fails to download referenced(custom) SNAPSHOTs of mine from my remote repository (even though they already exist in my local .m2 directory), and the build exits at that point with an error such as the following:

[ERROR] org.openrewrite.maven.MavenDownloadingException: com.meowit.bom:kat-tools-bom:6.0.70-SNAPSHOT failed. Unable to download POM: com.meowit.bom:kat-tools-bom:6.0.70-SNAPSHOT. 
Tried repositories: 
[ERROR] http://animal/nxstar/content/groups/public: HTTP 404 
[ERROR] org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:686) 
[ERROR] org.openrewrite.maven.tree.ResolvedPom$Resolver.mergeDependencyManagement(ResolvedPom.java:865) 
[ERROR] org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentDependenciesRecursively(ResolvedPom.java:471) 
[ERROR] org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentDependenciesRecursively(ResolvedPom.java:453) 
[ERROR] org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentsRecursively(ResolvedPom.java:405) [ERROR] org.openrewrite.maven.tree.ResolvedPom$Resolver.resolve(ResolvedPom.java:376) 
[ERROR]org.openrewrite.maven.tree.ResolvedPom.resolve(ResolvedPom.java:190) [ERROR] org.openrewrite.maven.tree.Pom.resolve(Pom.java:217) 
[ERROR] org.openrewrite.maven.tree.Pom.resolve(Pom.java:198) 
[ERROR] -> [Help 1]
 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.openrewrite.maven:rewrite-maven-plugin:6.8.1:run (default-cli) on project asmr-tools-model: Failed to parse or resolve the Maven POM file or one of its dependencies; We can not reliably continue without this information...

I've edited my settings.xml in all possible ways to get it to ignore the remote repository, or not update snapshots.

settings.xml:

<profiles>
    <profile>
        <id>local-snapshots</id>
        <repositories>
            <repository>
                <id>local-snapshots</id>
                <url>file://C:/.m2</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
    </profile>
    <profile>
        <id>no-snapshot-updates</id>
        <repositories>
            <repository>
                <id>nxstar</id>
                <url>http://animal/nxstar/content/groups/public</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>
<activeProfiles>
    <activeProfile>no-snapshot-updates</activeProfile>
</activeProfiles>

However none of that changes the behaviour. It seems the only thing that allows the rewrite:run to function without a hitch, is using the older versions of those openrewrite jars.

That's not to say it still doesn't try to download the SNAPSHOTS from the remote repository, because it still does and that still fails, however, the actual recipe run continues in spite of not being able to download those custom SNAPSHOT jars of mine. What am I missing? The issue here is that 2.13.0 is for Java 11 and 2.22.0 is for Java 17, which now has the problem described above. My code base consists of many referenced custom projects, all are being updated and that's why all are still SNAPSHOTS. They only get put onto the remote repository after being released/Final versions.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.