bazelbuild / migration-tooling

Migration tools for Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parent project with no artifacts fails

jkinkead opened this issue · comments

Having a dependency on a parent project with only a POM file fails due to the fact that parent projects are resolved using requestVersionList.

This project will fail with the error [FATAL] Non-resolvable parent POM org.sonatype.oss:oss-parent:9: Unable to resolve version @.

<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
                      https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>9</version>
  </parent>

  <groupId>com.example</groupId>
  <artifactId>example</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
</project>

I can't find an Aether method to download only a POM file. This might need to be handled outside of regular dependency resolution, say by looping through repository URLs until a valid one is found.

You can also fix with a hack like this one, which falls back on assuming a simple version is correct even if no artifacts are found for it.

This works for the case above, but also lets you create dependencies on jars that don't exist (you can generate a workspace with --artifact=org.sonatype.oss:oss-parent:9). This is almost certainly fine for this tool, since it should assume a valid maven build already.