I am using the Apache Maven Resolver
in Version 2.0.5 to get the dependency tree programatically. Following the demo (here) my code looks like this:
try(RepositorySystem system = booter.newRepositorySystem();
CloseableSession session = booter.newRepositorySystemSession(system).build()) {
Dependency rootMavenDependency = new Dependency(new DefaultArtifact("io.netty:netty-codec-http:4.1.114.Final"),"");
// Build the dependency tree
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(rootMavenDependency);
collectRequest.setRepositories(Collections.singletonList(central));
CollectResult collectResult = system.collectDependencies(session, collectRequest);
return collectResult.getRoot().getChildren().size();
//expected 5, but is 0
}
The request does not found the expected 5 dependencies but returns 0 with the message:
Invalid artifact descriptor for io.netty:netty-codec-http:jar:4.1.114.Final: 16 problems were encountered while building the effective model for io.netty:netty-codec-http:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java23 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java22 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java21 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java20 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java19 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java18 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java17 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java16 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java15 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java14 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java13 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java12 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java11 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java10 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile java9 @ io.netty:netty-parent:4.1.114.Final
- [ERROR] Failed to determine Java version for profile jdk8 @ io.netty:netty-parent:4.1.114.Final
How do I define the Java version?