migration-tooling icon indicating copy to clipboard operation
migration-tooling copied to clipboard

Parent project with no artifacts fails

Open jkinkead opened this issue 7 years ago • 1 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.

jkinkead avatar Sep 26 '17 21:09 jkinkead

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.

jkinkead avatar Sep 26 '17 21:09 jkinkead