You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Anthony Dahanne <an...@gmail.com> on 2021/02/12 02:36:17 UTC

Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Hello Maven devs,
I'm trying to programmatically ingest a pom.xml and start a Maven
dependency resolution on it.
For that end, I'm using DefaultProjectBuildingRequest and a ProjectBuilder.
I could successfully issue the request, but when trying against a pom that
relies on a parent or a BOM (spring boot pom for example), it seems like
the properties set in the poms (including dependencies poms) aren't
considered.

I have set up a Github project there to reproduce the issue:

Code:
https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java/net/dahanne/mavenresolver/MavenResolverApplication.java#L37

Error output :
https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_suite_focus=true
(not sure it's public though)

Pom I tried to resolve:
https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml

For convenience, I have copied the code, pom that I tried to resolve and
the error log at the end of this email

I am kindly asking for your help, in case I missed an option in request or
the session or.. both...
A debug session did not reveal much unfortunately...

Thanks in advance for your help!

Anthony




Code snippet:

ContainerConfiguration config = new DefaultContainerConfiguration();
  config.setAutoWiring(true);
  config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
  PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
  ProjectBuilder projectBuilder = plexusContainer.lookup(ProjectBuilder.class);
  RepositorySystem repositorySystem =
plexusContainer.lookup(RepositorySystem.class);
  DefaultRepositorySystemSession session =
MavenRepositorySystemUtils.newSession();
  LocalRepository localRepository = new LocalRepository("target/.m2");
  session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session,
localRepository));

  DefaultProjectBuildingRequest request = new DefaultProjectBuildingRequest();
  request.setRepositorySession(session);
  request.setResolveDependencies(true);
ArtifactRepository centralRepository = new MavenArtifactRepository();
centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
centralRepository.setLayout(new DefaultRepositoryLayout());
request.setRemoteRepositories(Collections.singletonList(centralRepository));

  ProjectBuildingResult result = projectBuilder.build(new
File("pom.xml"), request);

and here is the output:

Caused by: org.apache.maven.project.ProjectBuildingException:
Some problems were encountered while processing the POMs:
[ERROR] Invalid artifact repository: null @
[ERROR] Failed to determine Java version for profile jdk8 @
io.dropwizard.metrics:metrics-parent:4.1.17,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom,
line 160, column 22
[ERROR] Failed to determine Java version for profile doclint-java8-disable
@ org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 839, column 17
[ERROR] Failed to determine Java version for profile
compile-java8-release-flag @ org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 879, column 18
[ERROR] Failed to determine Java version for profile include-jdk-misc @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 910, column 22
[ERROR] Failed to determine Java version for profile java8-test @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 961, column 22
[ERROR] Failed to determine Java version for profile java9-mr-build @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 998, column 22
[ERROR] Failed to determine Java version for profile java9-test @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1047, column 22
[ERROR] Failed to determine Java version for profile java10-mr-build @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1087, column 22
[ERROR] Failed to determine Java version for profile java10-test @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1139, column 22
[ERROR] Failed to determine Java version for profile java11-mr-build @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1182, column 22
[ERROR] Failed to determine Java version for profile java11-test @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1237, column 22
[ERROR] Failed to determine Java version for profile java12-mr-build @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1283, column 22
[ERROR] Failed to determine Java version for profile java12-test @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1341, column 22
[ERROR] Failed to determine Java version for profile java13-mr-build @
org.jboss:jboss-parent:36,
/Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
line 1390, column 22


And this is the pom I tried to resolve:

<?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
https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.4.2</version>
      <relativePath/> <!-- lookup parent from repository -->
   </parent>
   <groupId>net.dahanne</groupId>
   <artifactId>maven-resolver</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>maven-resolver</name>
   <description>Demo project for Spring Boot</description>
   <properties>
      <java.version>11</java.version>
      <maven.version>3.6.3</maven.version>
      <maven-resolver.version>1.6.1</maven-resolver.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter</artifactId>
      </dependency>

      <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-core</artifactId>
         <version>${maven.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-compat</artifactId>
         <version>${maven.version}</version>
      </dependency>

      <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-resolver-provider</artifactId>
         <version>${maven.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-util</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-api</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-spi</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-transport-http</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-transport-file</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-connector-basic</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>maven-resolver-impl</artifactId>
         <version>${maven-resolver.version}</version>
      </dependency>


      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>

</project>

Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Anthony Dahanne <an...@gmail.com>.
Hello Hervé,
Thanks for your answer. I understand it's a time sink to investigate such
issues.
I have followed your recommendation renaming the project; totally makes
sense.

Actually, since I believe my issue is because of
my DefaultRepositorySystemSessionor my DefaultProjectBuildingRequest
configuration, I think that just pointers to recent (post sonatype ->
eclipse aether,  maven 3.3) projects doing something similar would help me
a lot.
Here is the project that helped me get started:

https://github.com/donovanmuller/spring-cloud-deployer-openshift/blob/master/src/main/java/org/springframework/cloud/deployer/spi/openshift/maven/MavenResourceProjectExtractor.java

Merci,
Anthony




Le sam. 13 févr. 2021, à 03 h 01, Hervé BOUTEMY <he...@free.fr> a
écrit :

> Hi Anthony
>
> This mailing list is not a bad location
> It's just that your question is not easy to answer, very specific, we have
> many
> other things to do
> then I can't tell you if anybody has time to dig into it, but what's clear
> is
> that it will require time
>
> One quick feedback: maven-resolver artifactId is
> https://maven.apache.org/resolver/
> For clarity, we wrote "Maven Artifact Resolver" in the reference
> documentation, but we always call it "Maven Resolver"
> Then I would advise to name your code that uses Maven Resolver with a more
> specific name, for example Maven Resolver Test
>
> Sorry, I don't have time to dig more into your case, even if I would be
> interested: days are only 24h
>
> Regards,
>
> Hervé
>
> Le samedi 13 février 2021, 04:13:01 CET Anthony Dahanne a écrit :
> > Hello,
> > I still could not find any solution to this problem....
> > I have cross posted on stackoverflow :
> >
> https://stackoverflow.com/questions/66181515/defaultprojectbuildingrequest-o
> > rg-apache-maven-project-projectbuildingexception Please let me know if my
> > question is not posted in the right mailing list... Thanks
> >
> > Le jeu. 11 févr. 2021, à 21 h 36, Anthony Dahanne
> > <an...@gmail.com>
> > a écrit :
> > > Hello Maven devs,
> > > I'm trying to programmatically ingest a pom.xml and start a Maven
> > > dependency resolution on it.
> > > For that end, I'm using DefaultProjectBuildingRequest and a
> > > ProjectBuilder.
> > > I could successfully issue the request, but when trying against a pom
> that
> > > relies on a parent or a BOM (spring boot pom for example), it seems
> like
> > > the properties set in the poms (including dependencies poms) aren't
> > > considered.
> > >
> > > I have set up a Github project there to reproduce the issue:
> > >
> > > Code:
> > >
> https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java
> > > /net/dahanne/mavenresolver/MavenResolverApplication.java#L37
> > >
> > > Error output :
> > >
> https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_sui
> > > te_focus=true (not sure it's public though)
> > >
> > > Pom I tried to resolve:
> > > https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
> > >
> > > For convenience, I have copied the code, pom that I tried to resolve
> and
> > > the error log at the end of this email
> > >
> > > I am kindly asking for your help, in case I missed an option in
> request or
> > > the session or.. both...
> > > A debug session did not reveal much unfortunately...
> > >
> > > Thanks in advance for your help!
> > >
> > > Anthony
> > >
> > >
> > >
> > >
> > > Code snippet:
> > >
> > > ContainerConfiguration config = new DefaultContainerConfiguration();
> > >
> > >   config.setAutoWiring(true);
> > >   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
> > >   PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
> > >   ProjectBuilder projectBuilder =
> > >   plexusContainer.lookup(ProjectBuilder.class); RepositorySystem
> > >   repositorySystem = plexusContainer.lookup(RepositorySystem.class);
> > >   DefaultRepositorySystemSession session =
> > >   MavenRepositorySystemUtils.newSession(); LocalRepository
> > >   localRepository = new LocalRepository("target/.m2");
> > >
>  session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryMa
> > >   nager(session, localRepository));
> > >
> > >   DefaultProjectBuildingRequest request = new
> > >   DefaultProjectBuildingRequest();
> request.setRepositorySession(session);
> > >   request.setResolveDependencies(true);
> > >
> > > ArtifactRepository centralRepository = new MavenArtifactRepository();
> > > centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> > > centralRepository.setLayout(new DefaultRepositoryLayout());
> > >
> request.setRemoteRepositories(Collections.singletonList(centralRepository)
> > > );>
> > >   ProjectBuildingResult result = projectBuilder.build(new
> File("pom.xml"),
> > >   request);>
> > > and here is the output:
> > >
> > > Caused by: org.apache.maven.project.ProjectBuildingException:
> > > Some problems were encountered while processing the POMs:
> > > [ERROR] Invalid artifact repository: null @
> > > [ERROR] Failed to determine Java version for profile jdk8 @
> > > io.dropwizard.metrics:metrics-parent:4.1.17,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/
> > > metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom, line 160,
> column
> > > 22
> > > [ERROR] Failed to determine Java version for profile
> doclint-java8-disable
> > > @ org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 839, column 17
> > > [ERROR] Failed to determine Java version for profile
> > > compile-java8-release-flag @ org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 879, column 18
> > > [ERROR] Failed to determine Java version for profile include-jdk-misc @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 910, column 22
> > > [ERROR] Failed to determine Java version for profile java8-test @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 961, column 22
> > > [ERROR] Failed to determine Java version for profile java9-mr-build @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 998, column 22
> > > [ERROR] Failed to determine Java version for profile java9-test @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1047, column 22
> > > [ERROR] Failed to determine Java version for profile java10-mr-build @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1087, column 22
> > > [ERROR] Failed to determine Java version for profile java10-test @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1139, column 22
> > > [ERROR] Failed to determine Java version for profile java11-mr-build @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1182, column 22
> > > [ERROR] Failed to determine Java version for profile java11-test @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1237, column 22
> > > [ERROR] Failed to determine Java version for profile java12-mr-build @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1283, column 22
> > > [ERROR] Failed to determine Java version for profile java12-test @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1341, column 22
> > > [ERROR] Failed to determine Java version for profile java13-mr-build @
> > > org.jboss:jboss-parent:36,
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom, line 1390, column 22
> > >
> > >
> > > And this is the pom I tried to resolve:
> > >
> > > <?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
> > >    https://maven.apache.org/xsd/maven-4.0.0.xsd">
> > >    <modelVersion>4.0.0</modelVersion>
> > >    <parent>
> > >
> > >       <groupId>org.springframework.boot</groupId>
> > >       <artifactId>spring-boot-starter-parent</artifactId>
> > >       <version>2.4.2</version>
> > >       <relativePath/> <!-- lookup parent from repository -->
> > >
> > >    </parent>
> > >    <groupId>net.dahanne</groupId>
> > >    <artifactId>maven-resolver</artifactId>
> > >    <version>0.0.1-SNAPSHOT</version>
> > >    <name>maven-resolver</name>
> > >    <description>Demo project for Spring Boot</description>
> > >    <properties>
> > >
> > >       <java.version>11</java.version>
> > >       <maven.version>3.6.3</maven.version>
> > >       <maven-resolver.version>1.6.1</maven-resolver.version>
> > >
> > >    </properties>
> > >    <dependencies>
> > >
> > >       <dependency>
> > >
> > >          <groupId>org.springframework.boot</groupId>
> > >          <artifactId>spring-boot-starter</artifactId>
> > >
> > >       </dependency>
> > >
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven</groupId>
> > >          <artifactId>maven-core</artifactId>
> > >          <version>${maven.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven</groupId>
> > >          <artifactId>maven-compat</artifactId>
> > >          <version>${maven.version}</version>
> > >
> > >       </dependency>
> > >
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven</groupId>
> > >          <artifactId>maven-resolver-provider</artifactId>
> > >          <version>${maven.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-util</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-api</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-spi</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-transport-http</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-transport-file</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-connector-basic</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >       <dependency>
> > >
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-impl</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >
> > >       </dependency>
> > >
> > >
> > >       <dependency>
> > >
> > >          <groupId>org.springframework.boot</groupId>
> > >          <artifactId>spring-boot-starter-test</artifactId>
> > >          <scope>test</scope>
> > >
> > >       </dependency>
> > >
> > >    </dependencies>
> > >
> > >    <build>
> > >
> > >       <plugins>
> > >
> > >          <plugin>
> > >
> > >             <groupId>org.springframework.boot</groupId>
> > >             <artifactId>spring-boot-maven-plugin</artifactId>
> > >
> > >          </plugin>
> > >
> > >       </plugins>
> > >
> > >    </build>
> > >
> > > </project>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Hervé BOUTEMY <he...@free.fr>.
Hi Anthony

This mailing list is not a bad location
It's just that your question is not easy to answer, very specific, we have many 
other things to do
then I can't tell you if anybody has time to dig into it, but what's clear is 
that it will require time

One quick feedback: maven-resolver artifactId is
https://maven.apache.org/resolver/
For clarity, we wrote "Maven Artifact Resolver" in the reference 
documentation, but we always call it "Maven Resolver"
Then I would advise to name your code that uses Maven Resolver with a more 
specific name, for example Maven Resolver Test

Sorry, I don't have time to dig more into your case, even if I would be 
interested: days are only 24h 

Regards,

Hervé

Le samedi 13 février 2021, 04:13:01 CET Anthony Dahanne a écrit :
> Hello,
> I still could not find any solution to this problem....
> I have cross posted on stackoverflow :
> https://stackoverflow.com/questions/66181515/defaultprojectbuildingrequest-o
> rg-apache-maven-project-projectbuildingexception Please let me know if my
> question is not posted in the right mailing list... Thanks
> 
> Le jeu. 11 févr. 2021, à 21 h 36, Anthony Dahanne
> <an...@gmail.com>
> a écrit :
> > Hello Maven devs,
> > I'm trying to programmatically ingest a pom.xml and start a Maven
> > dependency resolution on it.
> > For that end, I'm using DefaultProjectBuildingRequest and a
> > ProjectBuilder.
> > I could successfully issue the request, but when trying against a pom that
> > relies on a parent or a BOM (spring boot pom for example), it seems like
> > the properties set in the poms (including dependencies poms) aren't
> > considered.
> > 
> > I have set up a Github project there to reproduce the issue:
> > 
> > Code:
> > https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java
> > /net/dahanne/mavenresolver/MavenResolverApplication.java#L37
> > 
> > Error output :
> > https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_sui
> > te_focus=true (not sure it's public though)
> > 
> > Pom I tried to resolve:
> > https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
> > 
> > For convenience, I have copied the code, pom that I tried to resolve and
> > the error log at the end of this email
> > 
> > I am kindly asking for your help, in case I missed an option in request or
> > the session or.. both...
> > A debug session did not reveal much unfortunately...
> > 
> > Thanks in advance for your help!
> > 
> > Anthony
> > 
> > 
> > 
> > 
> > Code snippet:
> > 
> > ContainerConfiguration config = new DefaultContainerConfiguration();
> > 
> >   config.setAutoWiring(true);
> >   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
> >   PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
> >   ProjectBuilder projectBuilder =
> >   plexusContainer.lookup(ProjectBuilder.class); RepositorySystem
> >   repositorySystem = plexusContainer.lookup(RepositorySystem.class);
> >   DefaultRepositorySystemSession session =
> >   MavenRepositorySystemUtils.newSession(); LocalRepository
> >   localRepository = new LocalRepository("target/.m2");
> >   session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryMa
> >   nager(session, localRepository));
> >   
> >   DefaultProjectBuildingRequest request = new
> >   DefaultProjectBuildingRequest(); request.setRepositorySession(session);
> >   request.setResolveDependencies(true);
> > 
> > ArtifactRepository centralRepository = new MavenArtifactRepository();
> > centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> > centralRepository.setLayout(new DefaultRepositoryLayout());
> > request.setRemoteRepositories(Collections.singletonList(centralRepository)
> > );> 
> >   ProjectBuildingResult result = projectBuilder.build(new File("pom.xml"),
> >   request);> 
> > and here is the output:
> > 
> > Caused by: org.apache.maven.project.ProjectBuildingException:
> > Some problems were encountered while processing the POMs:
> > [ERROR] Invalid artifact repository: null @
> > [ERROR] Failed to determine Java version for profile jdk8 @
> > io.dropwizard.metrics:metrics-parent:4.1.17,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/
> > metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom, line 160, column
> > 22
> > [ERROR] Failed to determine Java version for profile doclint-java8-disable
> > @ org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 839, column 17
> > [ERROR] Failed to determine Java version for profile
> > compile-java8-release-flag @ org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 879, column 18
> > [ERROR] Failed to determine Java version for profile include-jdk-misc @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 910, column 22
> > [ERROR] Failed to determine Java version for profile java8-test @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 961, column 22
> > [ERROR] Failed to determine Java version for profile java9-mr-build @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 998, column 22
> > [ERROR] Failed to determine Java version for profile java9-test @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1047, column 22
> > [ERROR] Failed to determine Java version for profile java10-mr-build @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1087, column 22
> > [ERROR] Failed to determine Java version for profile java10-test @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1139, column 22
> > [ERROR] Failed to determine Java version for profile java11-mr-build @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1182, column 22
> > [ERROR] Failed to determine Java version for profile java11-test @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1237, column 22
> > [ERROR] Failed to determine Java version for profile java12-mr-build @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1283, column 22
> > [ERROR] Failed to determine Java version for profile java12-test @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1341, column 22
> > [ERROR] Failed to determine Java version for profile java13-mr-build @
> > org.jboss:jboss-parent:36,
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom, line 1390, column 22
> > 
> > 
> > And this is the pom I tried to resolve:
> > 
> > <?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
> >    https://maven.apache.org/xsd/maven-4.0.0.xsd">
> >    <modelVersion>4.0.0</modelVersion>
> >    <parent>
> >    
> >       <groupId>org.springframework.boot</groupId>
> >       <artifactId>spring-boot-starter-parent</artifactId>
> >       <version>2.4.2</version>
> >       <relativePath/> <!-- lookup parent from repository -->
> >    
> >    </parent>
> >    <groupId>net.dahanne</groupId>
> >    <artifactId>maven-resolver</artifactId>
> >    <version>0.0.1-SNAPSHOT</version>
> >    <name>maven-resolver</name>
> >    <description>Demo project for Spring Boot</description>
> >    <properties>
> >    
> >       <java.version>11</java.version>
> >       <maven.version>3.6.3</maven.version>
> >       <maven-resolver.version>1.6.1</maven-resolver.version>
> >    
> >    </properties>
> >    <dependencies>
> >    
> >       <dependency>
> >       
> >          <groupId>org.springframework.boot</groupId>
> >          <artifactId>spring-boot-starter</artifactId>
> >       
> >       </dependency>
> >       
> >       <dependency>
> >       
> >          <groupId>org.apache.maven</groupId>
> >          <artifactId>maven-core</artifactId>
> >          <version>${maven.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven</groupId>
> >          <artifactId>maven-compat</artifactId>
> >          <version>${maven.version}</version>
> >       
> >       </dependency>
> >       
> >       <dependency>
> >       
> >          <groupId>org.apache.maven</groupId>
> >          <artifactId>maven-resolver-provider</artifactId>
> >          <version>${maven.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-util</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-api</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-spi</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-transport-http</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-transport-file</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-connector-basic</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       <dependency>
> >       
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-impl</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       
> >       </dependency>
> >       
> >       
> >       <dependency>
> >       
> >          <groupId>org.springframework.boot</groupId>
> >          <artifactId>spring-boot-starter-test</artifactId>
> >          <scope>test</scope>
> >       
> >       </dependency>
> >    
> >    </dependencies>
> >    
> >    <build>
> >    
> >       <plugins>
> >       
> >          <plugin>
> >          
> >             <groupId>org.springframework.boot</groupId>
> >             <artifactId>spring-boot-maven-plugin</artifactId>
> >          
> >          </plugin>
> >       
> >       </plugins>
> >    
> >    </build>
> > 
> > </project>





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Anthony Dahanne <an...@gmail.com>.
Hello,
I still could not find any solution to this problem....
I have cross posted on stackoverflow :
https://stackoverflow.com/questions/66181515/defaultprojectbuildingrequest-org-apache-maven-project-projectbuildingexception
Please let me know if my question is not posted in the right mailing list...
Thanks

Le jeu. 11 févr. 2021, à 21 h 36, Anthony Dahanne <an...@gmail.com>
a écrit :

> Hello Maven devs,
> I'm trying to programmatically ingest a pom.xml and start a Maven
> dependency resolution on it.
> For that end, I'm using DefaultProjectBuildingRequest and a
> ProjectBuilder.
> I could successfully issue the request, but when trying against a pom that
> relies on a parent or a BOM (spring boot pom for example), it seems like
> the properties set in the poms (including dependencies poms) aren't
> considered.
>
> I have set up a Github project there to reproduce the issue:
>
> Code:
> https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java/net/dahanne/mavenresolver/MavenResolverApplication.java#L37
>
> Error output :
> https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_suite_focus=true
> (not sure it's public though)
>
> Pom I tried to resolve:
> https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
>
> For convenience, I have copied the code, pom that I tried to resolve and
> the error log at the end of this email
>
> I am kindly asking for your help, in case I missed an option in request or
> the session or.. both...
> A debug session did not reveal much unfortunately...
>
> Thanks in advance for your help!
>
> Anthony
>
>
>
>
> Code snippet:
>
> ContainerConfiguration config = new DefaultContainerConfiguration();
>   config.setAutoWiring(true);
>   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
>   PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
>   ProjectBuilder projectBuilder = plexusContainer.lookup(ProjectBuilder.class);
>   RepositorySystem repositorySystem = plexusContainer.lookup(RepositorySystem.class);
>   DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
>   LocalRepository localRepository = new LocalRepository("target/.m2");
>   session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session, localRepository));
>
>   DefaultProjectBuildingRequest request = new DefaultProjectBuildingRequest();
>   request.setRepositorySession(session);
>   request.setResolveDependencies(true);
> ArtifactRepository centralRepository = new MavenArtifactRepository();
> centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> centralRepository.setLayout(new DefaultRepositoryLayout());
> request.setRemoteRepositories(Collections.singletonList(centralRepository));
>
>   ProjectBuildingResult result = projectBuilder.build(new File("pom.xml"), request);
>
> and here is the output:
>
> Caused by: org.apache.maven.project.ProjectBuildingException:
> Some problems were encountered while processing the POMs:
> [ERROR] Invalid artifact repository: null @
> [ERROR] Failed to determine Java version for profile jdk8 @
> io.dropwizard.metrics:metrics-parent:4.1.17,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom,
> line 160, column 22
> [ERROR] Failed to determine Java version for profile doclint-java8-disable
> @ org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 839, column 17
> [ERROR] Failed to determine Java version for profile
> compile-java8-release-flag @ org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 879, column 18
> [ERROR] Failed to determine Java version for profile include-jdk-misc @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 910, column 22
> [ERROR] Failed to determine Java version for profile java8-test @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 961, column 22
> [ERROR] Failed to determine Java version for profile java9-mr-build @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 998, column 22
> [ERROR] Failed to determine Java version for profile java9-test @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1047, column 22
> [ERROR] Failed to determine Java version for profile java10-mr-build @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1087, column 22
> [ERROR] Failed to determine Java version for profile java10-test @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1139, column 22
> [ERROR] Failed to determine Java version for profile java11-mr-build @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1182, column 22
> [ERROR] Failed to determine Java version for profile java11-test @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1237, column 22
> [ERROR] Failed to determine Java version for profile java12-mr-build @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1283, column 22
> [ERROR] Failed to determine Java version for profile java12-test @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1341, column 22
> [ERROR] Failed to determine Java version for profile java13-mr-build @
> org.jboss:jboss-parent:36,
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1390, column 22
>
>
> And this is the pom I tried to resolve:
>
> <?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
>       <groupId>org.springframework.boot</groupId>
>       <artifactId>spring-boot-starter-parent</artifactId>
>       <version>2.4.2</version>
>       <relativePath/> <!-- lookup parent from repository -->
>    </parent>
>    <groupId>net.dahanne</groupId>
>    <artifactId>maven-resolver</artifactId>
>    <version>0.0.1-SNAPSHOT</version>
>    <name>maven-resolver</name>
>    <description>Demo project for Spring Boot</description>
>    <properties>
>       <java.version>11</java.version>
>       <maven.version>3.6.3</maven.version>
>       <maven-resolver.version>1.6.1</maven-resolver.version>
>    </properties>
>    <dependencies>
>       <dependency>
>          <groupId>org.springframework.boot</groupId>
>          <artifactId>spring-boot-starter</artifactId>
>       </dependency>
>
>       <dependency>
>          <groupId>org.apache.maven</groupId>
>          <artifactId>maven-core</artifactId>
>          <version>${maven.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven</groupId>
>          <artifactId>maven-compat</artifactId>
>          <version>${maven.version}</version>
>       </dependency>
>
>       <dependency>
>          <groupId>org.apache.maven</groupId>
>          <artifactId>maven-resolver-provider</artifactId>
>          <version>${maven.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-util</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-api</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-spi</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-transport-http</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-transport-file</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-connector-basic</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-impl</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>
>
>       <dependency>
>          <groupId>org.springframework.boot</groupId>
>          <artifactId>spring-boot-starter-test</artifactId>
>          <scope>test</scope>
>       </dependency>
>    </dependencies>
>
>    <build>
>       <plugins>
>          <plugin>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-maven-plugin</artifactId>
>          </plugin>
>       </plugins>
>    </build>
>
> </project>
>
>

Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Anthony Dahanne <an...@gmail.com>.
You just made my day! Perfect!
Thanks so much Tamás and Hervé!
Maven ❤
Anthony


Le mer. 17 févr. 2021, à 13 h 39, Hervé BOUTEMY <he...@free.fr> a
écrit :

> PR provided https://github.com/anthonydahanne/maven-resolver-test/pull/1
>
> in fact, you're not testing resolver directly but project builder which
> resolves everything
>
> Regards,
>
> Hervé
>
> Le samedi 13 février 2021, 23:36:28 CET Anthony Dahanne a écrit :
> > Hello Tamás,
> > Thanks for your answer.
> > Yes, I remember I also got a look at this maven-resolver-demos repo; and
> I
> > could even leverage it to successfully resolve GAVs.
> > And your remark about the MRESOLVER-157 takes all its meaning with my
> > issue: reconciling the "pure maven-resolver" world (GAV transformed into
> a
> > CollectRequest is the input) with the "maven pom model" (a pom File
> > transformed into a MavenProject is the input)
> > I added the maven-core dependency to the maven-resolver-demos pom, so
> that
> > I could, from ResolveTransitiveDependencies, setup a
> DefaultProjectBuilder
> > (like I did previously, but this time using the Booter session)
> > But, alas, the DefaultProjectBuilder needs to be setup with proper DI -
> so
> > I'm stuck here for now wit NPEs on its dependencies.
> >
> > I'll continue digging to try and have the DefaultProjectBuilder correctly
> > wired with all its dependencies.
> >
> > So bottom line is: I want to resolve a pom file, not a GAV.
> >
> > Thanks again!
> > Anthony
> >
> >
> >
> >
> >
> > Le sam. 13 févr. 2021, à 11 h 00, Tamás Cservenák <ta...@cservenak.net>
> a
> >
> > écrit :
> > > Howdy,
> > >
> > > take a peek at resolver "demo" snippets here:
> > >
> > >
> https://github.com/apache/maven-resolver/blob/master/maven-resolver-demos/
> > >
> maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examp
> > > les/ResolveTransitiveDependencies.java
> > >
> > > Word of warning: do not "mix" ServiceLocator and DI (Guice or SISU)...
> you
> > > MUST settle on one and set up your environment using that one.
> > > Take a peek a "Booter" class for that (it has commented out code that
> > > leads
> > > to Guice, SISU stuff, by default uses ServiceLocator).
> > >
> > > Finally, just FTR I need to mention this issue
> > > https://issues.apache.org/jira/browse/MRESOLVER-157
> > > So, current maven-resolver releases still support ServiceLocator, in
> > > upcoming 1.7.0 of it it will be deprecated, and later removed.
> > >
> > > HTH
> > > T
> > >
> > > On Fri, Feb 12, 2021 at 3:36 AM Anthony Dahanne <
> anthony.dahanne@gmail.com
> > >
> > > wrote:
> > > > Hello Maven devs,
> > > > I'm trying to programmatically ingest a pom.xml and start a Maven
> > > > dependency resolution on it.
> > > > For that end, I'm using DefaultProjectBuildingRequest and a
> > >
> > > ProjectBuilder.
> > >
> > > > I could successfully issue the request, but when trying against a pom
> > >
> > > that
> > >
> > > > relies on a parent or a BOM (spring boot pom for example), it seems
> like
> > > > the properties set in the poms (including dependencies poms) aren't
> > > > considered.
> > > >
> > > > I have set up a Github project there to reproduce the issue:
> > >
> > > > Code:
> > >
> https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java
> > > /net/dahanne/mavenresolver/MavenResolverApplication.java#L37>
> > > > Error output :
> > >
> https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_sui
> > > te_focus=true>
> > > > (not sure it's public though)
> > > >
> > > > Pom I tried to resolve:
> > > > https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
> > > >
> > > > For convenience, I have copied the code, pom that I tried to resolve
> and
> > > > the error log at the end of this email
> > > >
> > > > I am kindly asking for your help, in case I missed an option in
> request
> > >
> > > or
> > >
> > > > the session or.. both...
> > > > A debug session did not reveal much unfortunately...
> > > >
> > > > Thanks in advance for your help!
> > > >
> > > > Anthony
> > > >
> > > >
> > > >
> > > >
> > > > Code snippet:
> > > >
> > > > ContainerConfiguration config = new DefaultContainerConfiguration();
> > > >
> > > >   config.setAutoWiring(true);
> > > >   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
> > > >   PlexusContainer plexusContainer = new
> DefaultPlexusContainer(config);
> > > >   ProjectBuilder projectBuilder =
> > > >
> > > > plexusContainer.lookup(ProjectBuilder.class);
> > > >
> > > >   RepositorySystem repositorySystem =
> > > >
> > > > plexusContainer.lookup(RepositorySystem.class);
> > > >
> > > >   DefaultRepositorySystemSession session =
> > > >
> > > > MavenRepositorySystemUtils.newSession();
> > > >
> > > >   LocalRepository localRepository = new
> LocalRepository("target/.m2");
> > >
> > >
> session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManag
> > > er(session,>
> > > > localRepository));
> > > >
> > > >   DefaultProjectBuildingRequest request = new
> > > >
> > > > DefaultProjectBuildingRequest();
> > > >
> > > >   request.setRepositorySession(session);
> > > >   request.setResolveDependencies(true);
> > > >
> > > > ArtifactRepository centralRepository = new MavenArtifactRepository();
> > > > centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> > > > centralRepository.setLayout(new DefaultRepositoryLayout());
> > >
> > >
> request.setRemoteRepositories(Collections.singletonList(centralRepository)
> > > );>
> > > >   ProjectBuildingResult result = projectBuilder.build(new
> > > >
> > > > File("pom.xml"), request);
> > > >
> > > > and here is the output:
> > > >
> > > > Caused by: org.apache.maven.project.ProjectBuildingException:
> > > > Some problems were encountered while processing the POMs:
> > > > [ERROR] Invalid artifact repository: null @
> > > > [ERROR] Failed to determine Java version for profile jdk8 @
> > > > io.dropwizard.metrics:metrics-parent:4.1.17,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/
> > > metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom,>
> > > > line 160, column 22
> > > > [ERROR] Failed to determine Java version for profile
> > >
> > > doclint-java8-disable
> > >
> > > > @ org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 839, column 17
> > > > [ERROR] Failed to determine Java version for profile
> > > > compile-java8-release-flag @ org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 879, column 18
> > > > [ERROR] Failed to determine Java version for profile
> include-jdk-misc @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 910, column 22
> > > > [ERROR] Failed to determine Java version for profile java8-test @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 961, column 22
> > > > [ERROR] Failed to determine Java version for profile java9-mr-build @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 998, column 22
> > > > [ERROR] Failed to determine Java version for profile java9-test @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1047, column 22
> > > > [ERROR] Failed to determine Java version for profile java10-mr-build
> @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1087, column 22
> > > > [ERROR] Failed to determine Java version for profile java10-test @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1139, column 22
> > > > [ERROR] Failed to determine Java version for profile java11-mr-build
> @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1182, column 22
> > > > [ERROR] Failed to determine Java version for profile java11-test @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1237, column 22
> > > > [ERROR] Failed to determine Java version for profile java12-mr-build
> @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1283, column 22
> > > > [ERROR] Failed to determine Java version for profile java12-test @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1341, column 22
> > > > [ERROR] Failed to determine Java version for profile java13-mr-build
> @
> > > > org.jboss:jboss-parent:36,
> > >
> > >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > > s-parent/36/jboss-parent-36.pom,>
> > > > line 1390, column 22
> > > >
> > > >
> > > > And this is the pom I tried to resolve:
> > > >
> > > > <?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
> > > >
> > > > https://maven.apache.org/xsd/maven-4.0.0.xsd">
> > > >
> > > >    <modelVersion>4.0.0</modelVersion>
> > > >    <parent>
> > > >
> > > >       <groupId>org.springframework.boot</groupId>
> > > >       <artifactId>spring-boot-starter-parent</artifactId>
> > > >       <version>2.4.2</version>
> > > >       <relativePath/> <!-- lookup parent from repository -->
> > > >
> > > >    </parent>
> > > >    <groupId>net.dahanne</groupId>
> > > >    <artifactId>maven-resolver</artifactId>
> > > >    <version>0.0.1-SNAPSHOT</version>
> > > >    <name>maven-resolver</name>
> > > >    <description>Demo project for Spring Boot</description>
> > > >    <properties>
> > > >
> > > >       <java.version>11</java.version>
> > > >       <maven.version>3.6.3</maven.version>
> > > >       <maven-resolver.version>1.6.1</maven-resolver.version>
> > > >
> > > >    </properties>
> > > >    <dependencies>
> > > >
> > > >       <dependency>
> > > >
> > > >          <groupId>org.springframework.boot</groupId>
> > > >          <artifactId>spring-boot-starter</artifactId>
> > > >
> > > >       </dependency>
> > > >
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven</groupId>
> > > >          <artifactId>maven-core</artifactId>
> > > >          <version>${maven.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven</groupId>
> > > >          <artifactId>maven-compat</artifactId>
> > > >          <version>${maven.version}</version>
> > > >
> > > >       </dependency>
> > > >
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven</groupId>
> > > >          <artifactId>maven-resolver-provider</artifactId>
> > > >          <version>${maven.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-util</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-api</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-spi</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-transport-http</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-transport-file</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-connector-basic</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >       <dependency>
> > > >
> > > >          <groupId>org.apache.maven.resolver</groupId>
> > > >          <artifactId>maven-resolver-impl</artifactId>
> > > >          <version>${maven-resolver.version}</version>
> > > >
> > > >       </dependency>
> > > >
> > > >
> > > >       <dependency>
> > > >
> > > >          <groupId>org.springframework.boot</groupId>
> > > >          <artifactId>spring-boot-starter-test</artifactId>
> > > >          <scope>test</scope>
> > > >
> > > >       </dependency>
> > > >
> > > >    </dependencies>
> > > >
> > > >    <build>
> > > >
> > > >       <plugins>
> > > >
> > > >          <plugin>
> > > >
> > > >             <groupId>org.springframework.boot</groupId>
> > > >             <artifactId>spring-boot-maven-plugin</artifactId>
> > > >
> > > >          </plugin>
> > > >
> > > >       </plugins>
> > > >
> > > >    </build>
> > > >
> > > > </project>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Hervé BOUTEMY <he...@free.fr>.
PR provided https://github.com/anthonydahanne/maven-resolver-test/pull/1

in fact, you're not testing resolver directly but project builder which 
resolves everything

Regards,

Hervé

Le samedi 13 février 2021, 23:36:28 CET Anthony Dahanne a écrit :
> Hello Tamás,
> Thanks for your answer.
> Yes, I remember I also got a look at this maven-resolver-demos repo; and I
> could even leverage it to successfully resolve GAVs.
> And your remark about the MRESOLVER-157 takes all its meaning with my
> issue: reconciling the "pure maven-resolver" world (GAV transformed into a
> CollectRequest is the input) with the "maven pom model" (a pom File
> transformed into a MavenProject is the input)
> I added the maven-core dependency to the maven-resolver-demos pom, so that
> I could, from ResolveTransitiveDependencies, setup a DefaultProjectBuilder
> (like I did previously, but this time using the Booter session)
> But, alas, the DefaultProjectBuilder needs to be setup with proper DI - so
> I'm stuck here for now wit NPEs on its dependencies.
> 
> I'll continue digging to try and have the DefaultProjectBuilder correctly
> wired with all its dependencies.
> 
> So bottom line is: I want to resolve a pom file, not a GAV.
> 
> Thanks again!
> Anthony
> 
> 
> 
> 
> 
> Le sam. 13 févr. 2021, à 11 h 00, Tamás Cservenák <ta...@cservenak.net> a
> 
> écrit :
> > Howdy,
> > 
> > take a peek at resolver "demo" snippets here:
> > 
> > https://github.com/apache/maven-resolver/blob/master/maven-resolver-demos/
> > maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examp
> > les/ResolveTransitiveDependencies.java
> > 
> > Word of warning: do not "mix" ServiceLocator and DI (Guice or SISU)... you
> > MUST settle on one and set up your environment using that one.
> > Take a peek a "Booter" class for that (it has commented out code that
> > leads
> > to Guice, SISU stuff, by default uses ServiceLocator).
> > 
> > Finally, just FTR I need to mention this issue
> > https://issues.apache.org/jira/browse/MRESOLVER-157
> > So, current maven-resolver releases still support ServiceLocator, in
> > upcoming 1.7.0 of it it will be deprecated, and later removed.
> > 
> > HTH
> > T
> > 
> > On Fri, Feb 12, 2021 at 3:36 AM Anthony Dahanne <anthony.dahanne@gmail.com
> > 
> > wrote:
> > > Hello Maven devs,
> > > I'm trying to programmatically ingest a pom.xml and start a Maven
> > > dependency resolution on it.
> > > For that end, I'm using DefaultProjectBuildingRequest and a
> > 
> > ProjectBuilder.
> > 
> > > I could successfully issue the request, but when trying against a pom
> > 
> > that
> > 
> > > relies on a parent or a BOM (spring boot pom for example), it seems like
> > > the properties set in the poms (including dependencies poms) aren't
> > > considered.
> > > 
> > > I have set up a Github project there to reproduce the issue:
> > 
> > > Code:
> > https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java
> > /net/dahanne/mavenresolver/MavenResolverApplication.java#L37> 
> > > Error output :
> > https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_sui
> > te_focus=true> 
> > > (not sure it's public though)
> > > 
> > > Pom I tried to resolve:
> > > https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
> > > 
> > > For convenience, I have copied the code, pom that I tried to resolve and
> > > the error log at the end of this email
> > > 
> > > I am kindly asking for your help, in case I missed an option in request
> > 
> > or
> > 
> > > the session or.. both...
> > > A debug session did not reveal much unfortunately...
> > > 
> > > Thanks in advance for your help!
> > > 
> > > Anthony
> > > 
> > > 
> > > 
> > > 
> > > Code snippet:
> > > 
> > > ContainerConfiguration config = new DefaultContainerConfiguration();
> > > 
> > >   config.setAutoWiring(true);
> > >   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
> > >   PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
> > >   ProjectBuilder projectBuilder =
> > > 
> > > plexusContainer.lookup(ProjectBuilder.class);
> > > 
> > >   RepositorySystem repositorySystem =
> > > 
> > > plexusContainer.lookup(RepositorySystem.class);
> > > 
> > >   DefaultRepositorySystemSession session =
> > > 
> > > MavenRepositorySystemUtils.newSession();
> > > 
> > >   LocalRepository localRepository = new LocalRepository("target/.m2");
> > 
> > session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManag
> > er(session,> 
> > > localRepository));
> > > 
> > >   DefaultProjectBuildingRequest request = new
> > > 
> > > DefaultProjectBuildingRequest();
> > > 
> > >   request.setRepositorySession(session);
> > >   request.setResolveDependencies(true);
> > > 
> > > ArtifactRepository centralRepository = new MavenArtifactRepository();
> > > centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> > > centralRepository.setLayout(new DefaultRepositoryLayout());
> > 
> > request.setRemoteRepositories(Collections.singletonList(centralRepository)
> > );> 
> > >   ProjectBuildingResult result = projectBuilder.build(new
> > > 
> > > File("pom.xml"), request);
> > > 
> > > and here is the output:
> > > 
> > > Caused by: org.apache.maven.project.ProjectBuildingException:
> > > Some problems were encountered while processing the POMs:
> > > [ERROR] Invalid artifact repository: null @
> > > [ERROR] Failed to determine Java version for profile jdk8 @
> > > io.dropwizard.metrics:metrics-parent:4.1.17,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/
> > metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom,> 
> > > line 160, column 22
> > > [ERROR] Failed to determine Java version for profile
> > 
> > doclint-java8-disable
> > 
> > > @ org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 839, column 17
> > > [ERROR] Failed to determine Java version for profile
> > > compile-java8-release-flag @ org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 879, column 18
> > > [ERROR] Failed to determine Java version for profile include-jdk-misc @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 910, column 22
> > > [ERROR] Failed to determine Java version for profile java8-test @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 961, column 22
> > > [ERROR] Failed to determine Java version for profile java9-mr-build @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 998, column 22
> > > [ERROR] Failed to determine Java version for profile java9-test @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1047, column 22
> > > [ERROR] Failed to determine Java version for profile java10-mr-build @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1087, column 22
> > > [ERROR] Failed to determine Java version for profile java10-test @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1139, column 22
> > > [ERROR] Failed to determine Java version for profile java11-mr-build @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1182, column 22
> > > [ERROR] Failed to determine Java version for profile java11-test @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1237, column 22
> > > [ERROR] Failed to determine Java version for profile java12-mr-build @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1283, column 22
> > > [ERROR] Failed to determine Java version for profile java12-test @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1341, column 22
> > > [ERROR] Failed to determine Java version for profile java13-mr-build @
> > > org.jboss:jboss-parent:36,
> > 
> > /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jbos
> > s-parent/36/jboss-parent-36.pom,> 
> > > line 1390, column 22
> > > 
> > > 
> > > And this is the pom I tried to resolve:
> > > 
> > > <?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
> > > 
> > > https://maven.apache.org/xsd/maven-4.0.0.xsd">
> > > 
> > >    <modelVersion>4.0.0</modelVersion>
> > >    <parent>
> > >    
> > >       <groupId>org.springframework.boot</groupId>
> > >       <artifactId>spring-boot-starter-parent</artifactId>
> > >       <version>2.4.2</version>
> > >       <relativePath/> <!-- lookup parent from repository -->
> > >    
> > >    </parent>
> > >    <groupId>net.dahanne</groupId>
> > >    <artifactId>maven-resolver</artifactId>
> > >    <version>0.0.1-SNAPSHOT</version>
> > >    <name>maven-resolver</name>
> > >    <description>Demo project for Spring Boot</description>
> > >    <properties>
> > >    
> > >       <java.version>11</java.version>
> > >       <maven.version>3.6.3</maven.version>
> > >       <maven-resolver.version>1.6.1</maven-resolver.version>
> > >    
> > >    </properties>
> > >    <dependencies>
> > >    
> > >       <dependency>
> > >       
> > >          <groupId>org.springframework.boot</groupId>
> > >          <artifactId>spring-boot-starter</artifactId>
> > >       
> > >       </dependency>
> > >       
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven</groupId>
> > >          <artifactId>maven-core</artifactId>
> > >          <version>${maven.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven</groupId>
> > >          <artifactId>maven-compat</artifactId>
> > >          <version>${maven.version}</version>
> > >       
> > >       </dependency>
> > >       
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven</groupId>
> > >          <artifactId>maven-resolver-provider</artifactId>
> > >          <version>${maven.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-util</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-api</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-spi</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-transport-http</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-transport-file</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-connector-basic</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       <dependency>
> > >       
> > >          <groupId>org.apache.maven.resolver</groupId>
> > >          <artifactId>maven-resolver-impl</artifactId>
> > >          <version>${maven-resolver.version}</version>
> > >       
> > >       </dependency>
> > >       
> > >       
> > >       <dependency>
> > >       
> > >          <groupId>org.springframework.boot</groupId>
> > >          <artifactId>spring-boot-starter-test</artifactId>
> > >          <scope>test</scope>
> > >       
> > >       </dependency>
> > >    
> > >    </dependencies>
> > >    
> > >    <build>
> > >    
> > >       <plugins>
> > >       
> > >          <plugin>
> > >          
> > >             <groupId>org.springframework.boot</groupId>
> > >             <artifactId>spring-boot-maven-plugin</artifactId>
> > >          
> > >          </plugin>
> > >       
> > >       </plugins>
> > >    
> > >    </build>
> > > 
> > > </project>





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Anthony Dahanne <an...@gmail.com>.
Hello Tamás,
Thanks for your answer.
Yes, I remember I also got a look at this maven-resolver-demos repo; and I
could even leverage it to successfully resolve GAVs.
And your remark about the MRESOLVER-157 takes all its meaning with my
issue: reconciling the "pure maven-resolver" world (GAV transformed into a
CollectRequest is the input) with the "maven pom model" (a pom File
transformed into a MavenProject is the input)
I added the maven-core dependency to the maven-resolver-demos pom, so that
I could, from ResolveTransitiveDependencies, setup a DefaultProjectBuilder
(like I did previously, but this time using the Booter session)
But, alas, the DefaultProjectBuilder needs to be setup with proper DI - so
I'm stuck here for now wit NPEs on its dependencies.

I'll continue digging to try and have the DefaultProjectBuilder correctly
wired with all its dependencies.

So bottom line is: I want to resolve a pom file, not a GAV.

Thanks again!
Anthony





Le sam. 13 févr. 2021, à 11 h 00, Tamás Cservenák <ta...@cservenak.net> a
écrit :

> Howdy,
>
> take a peek at resolver "demo" snippets here:
>
> https://github.com/apache/maven-resolver/blob/master/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java
>
> Word of warning: do not "mix" ServiceLocator and DI (Guice or SISU)... you
> MUST settle on one and set up your environment using that one.
> Take a peek a "Booter" class for that (it has commented out code that leads
> to Guice, SISU stuff, by default uses ServiceLocator).
>
> Finally, just FTR I need to mention this issue
> https://issues.apache.org/jira/browse/MRESOLVER-157
> So, current maven-resolver releases still support ServiceLocator, in
> upcoming 1.7.0 of it it will be deprecated, and later removed.
>
> HTH
> T
>
> On Fri, Feb 12, 2021 at 3:36 AM Anthony Dahanne <anthony.dahanne@gmail.com
> >
> wrote:
>
> > Hello Maven devs,
> > I'm trying to programmatically ingest a pom.xml and start a Maven
> > dependency resolution on it.
> > For that end, I'm using DefaultProjectBuildingRequest and a
> ProjectBuilder.
> > I could successfully issue the request, but when trying against a pom
> that
> > relies on a parent or a BOM (spring boot pom for example), it seems like
> > the properties set in the poms (including dependencies poms) aren't
> > considered.
> >
> > I have set up a Github project there to reproduce the issue:
> >
> > Code:
> >
> >
> https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java/net/dahanne/mavenresolver/MavenResolverApplication.java#L37
> >
> > Error output :
> >
> >
> https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_suite_focus=true
> > (not sure it's public though)
> >
> > Pom I tried to resolve:
> > https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
> >
> > For convenience, I have copied the code, pom that I tried to resolve and
> > the error log at the end of this email
> >
> > I am kindly asking for your help, in case I missed an option in request
> or
> > the session or.. both...
> > A debug session did not reveal much unfortunately...
> >
> > Thanks in advance for your help!
> >
> > Anthony
> >
> >
> >
> >
> > Code snippet:
> >
> > ContainerConfiguration config = new DefaultContainerConfiguration();
> >   config.setAutoWiring(true);
> >   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
> >   PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
> >   ProjectBuilder projectBuilder =
> > plexusContainer.lookup(ProjectBuilder.class);
> >   RepositorySystem repositorySystem =
> > plexusContainer.lookup(RepositorySystem.class);
> >   DefaultRepositorySystemSession session =
> > MavenRepositorySystemUtils.newSession();
> >   LocalRepository localRepository = new LocalRepository("target/.m2");
> >
> >
> session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session,
> > localRepository));
> >
> >   DefaultProjectBuildingRequest request = new
> > DefaultProjectBuildingRequest();
> >   request.setRepositorySession(session);
> >   request.setResolveDependencies(true);
> > ArtifactRepository centralRepository = new MavenArtifactRepository();
> > centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> > centralRepository.setLayout(new DefaultRepositoryLayout());
> >
> >
> request.setRemoteRepositories(Collections.singletonList(centralRepository));
> >
> >   ProjectBuildingResult result = projectBuilder.build(new
> > File("pom.xml"), request);
> >
> > and here is the output:
> >
> > Caused by: org.apache.maven.project.ProjectBuildingException:
> > Some problems were encountered while processing the POMs:
> > [ERROR] Invalid artifact repository: null @
> > [ERROR] Failed to determine Java version for profile jdk8 @
> > io.dropwizard.metrics:metrics-parent:4.1.17,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom,
> > line 160, column 22
> > [ERROR] Failed to determine Java version for profile
> doclint-java8-disable
> > @ org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 839, column 17
> > [ERROR] Failed to determine Java version for profile
> > compile-java8-release-flag @ org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 879, column 18
> > [ERROR] Failed to determine Java version for profile include-jdk-misc @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 910, column 22
> > [ERROR] Failed to determine Java version for profile java8-test @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 961, column 22
> > [ERROR] Failed to determine Java version for profile java9-mr-build @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 998, column 22
> > [ERROR] Failed to determine Java version for profile java9-test @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1047, column 22
> > [ERROR] Failed to determine Java version for profile java10-mr-build @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1087, column 22
> > [ERROR] Failed to determine Java version for profile java10-test @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1139, column 22
> > [ERROR] Failed to determine Java version for profile java11-mr-build @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1182, column 22
> > [ERROR] Failed to determine Java version for profile java11-test @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1237, column 22
> > [ERROR] Failed to determine Java version for profile java12-mr-build @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1283, column 22
> > [ERROR] Failed to determine Java version for profile java12-test @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1341, column 22
> > [ERROR] Failed to determine Java version for profile java13-mr-build @
> > org.jboss:jboss-parent:36,
> >
> >
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> > line 1390, column 22
> >
> >
> > And this is the pom I tried to resolve:
> >
> > <?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
> > https://maven.apache.org/xsd/maven-4.0.0.xsd">
> >    <modelVersion>4.0.0</modelVersion>
> >    <parent>
> >       <groupId>org.springframework.boot</groupId>
> >       <artifactId>spring-boot-starter-parent</artifactId>
> >       <version>2.4.2</version>
> >       <relativePath/> <!-- lookup parent from repository -->
> >    </parent>
> >    <groupId>net.dahanne</groupId>
> >    <artifactId>maven-resolver</artifactId>
> >    <version>0.0.1-SNAPSHOT</version>
> >    <name>maven-resolver</name>
> >    <description>Demo project for Spring Boot</description>
> >    <properties>
> >       <java.version>11</java.version>
> >       <maven.version>3.6.3</maven.version>
> >       <maven-resolver.version>1.6.1</maven-resolver.version>
> >    </properties>
> >    <dependencies>
> >       <dependency>
> >          <groupId>org.springframework.boot</groupId>
> >          <artifactId>spring-boot-starter</artifactId>
> >       </dependency>
> >
> >       <dependency>
> >          <groupId>org.apache.maven</groupId>
> >          <artifactId>maven-core</artifactId>
> >          <version>${maven.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven</groupId>
> >          <artifactId>maven-compat</artifactId>
> >          <version>${maven.version}</version>
> >       </dependency>
> >
> >       <dependency>
> >          <groupId>org.apache.maven</groupId>
> >          <artifactId>maven-resolver-provider</artifactId>
> >          <version>${maven.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-util</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-api</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-spi</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-transport-http</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-transport-file</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-connector-basic</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >       <dependency>
> >          <groupId>org.apache.maven.resolver</groupId>
> >          <artifactId>maven-resolver-impl</artifactId>
> >          <version>${maven-resolver.version}</version>
> >       </dependency>
> >
> >
> >       <dependency>
> >          <groupId>org.springframework.boot</groupId>
> >          <artifactId>spring-boot-starter-test</artifactId>
> >          <scope>test</scope>
> >       </dependency>
> >    </dependencies>
> >
> >    <build>
> >       <plugins>
> >          <plugin>
> >             <groupId>org.springframework.boot</groupId>
> >             <artifactId>spring-boot-maven-plugin</artifactId>
> >          </plugin>
> >       </plugins>
> >    </build>
> >
> > </project>
> >
>

Re: Parent pom or BOM not resolved using DefaultProjectBuildingRequest

Posted by Tamás Cservenák <ta...@cservenak.net>.
Howdy,

take a peek at resolver "demo" snippets here:
https://github.com/apache/maven-resolver/blob/master/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/ResolveTransitiveDependencies.java

Word of warning: do not "mix" ServiceLocator and DI (Guice or SISU)... you
MUST settle on one and set up your environment using that one.
Take a peek a "Booter" class for that (it has commented out code that leads
to Guice, SISU stuff, by default uses ServiceLocator).

Finally, just FTR I need to mention this issue
https://issues.apache.org/jira/browse/MRESOLVER-157
So, current maven-resolver releases still support ServiceLocator, in
upcoming 1.7.0 of it it will be deprecated, and later removed.

HTH
T

On Fri, Feb 12, 2021 at 3:36 AM Anthony Dahanne <an...@gmail.com>
wrote:

> Hello Maven devs,
> I'm trying to programmatically ingest a pom.xml and start a Maven
> dependency resolution on it.
> For that end, I'm using DefaultProjectBuildingRequest and a ProjectBuilder.
> I could successfully issue the request, but when trying against a pom that
> relies on a parent or a BOM (spring boot pom for example), it seems like
> the properties set in the poms (including dependencies poms) aren't
> considered.
>
> I have set up a Github project there to reproduce the issue:
>
> Code:
>
> https://github.com/anthonydahanne/maven-resolver/blob/master/src/main/java/net/dahanne/mavenresolver/MavenResolverApplication.java#L37
>
> Error output :
>
> https://github.com/anthonydahanne/maven-resolver/runs/1884304754?check_suite_focus=true
> (not sure it's public though)
>
> Pom I tried to resolve:
> https://github.com/anthonydahanne/maven-resolver/blob/master/pom.xml
>
> For convenience, I have copied the code, pom that I tried to resolve and
> the error log at the end of this email
>
> I am kindly asking for your help, in case I missed an option in request or
> the session or.. both...
> A debug session did not reveal much unfortunately...
>
> Thanks in advance for your help!
>
> Anthony
>
>
>
>
> Code snippet:
>
> ContainerConfiguration config = new DefaultContainerConfiguration();
>   config.setAutoWiring(true);
>   config.setClassPathScanning(PlexusConstants.SCANNING_INDEX);
>   PlexusContainer plexusContainer = new DefaultPlexusContainer(config);
>   ProjectBuilder projectBuilder =
> plexusContainer.lookup(ProjectBuilder.class);
>   RepositorySystem repositorySystem =
> plexusContainer.lookup(RepositorySystem.class);
>   DefaultRepositorySystemSession session =
> MavenRepositorySystemUtils.newSession();
>   LocalRepository localRepository = new LocalRepository("target/.m2");
>
> session.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(session,
> localRepository));
>
>   DefaultProjectBuildingRequest request = new
> DefaultProjectBuildingRequest();
>   request.setRepositorySession(session);
>   request.setResolveDependencies(true);
> ArtifactRepository centralRepository = new MavenArtifactRepository();
> centralRepository.setUrl("https://repo.maven.apache.org/maven2/");
> centralRepository.setLayout(new DefaultRepositoryLayout());
>
> request.setRemoteRepositories(Collections.singletonList(centralRepository));
>
>   ProjectBuildingResult result = projectBuilder.build(new
> File("pom.xml"), request);
>
> and here is the output:
>
> Caused by: org.apache.maven.project.ProjectBuildingException:
> Some problems were encountered while processing the POMs:
> [ERROR] Invalid artifact repository: null @
> [ERROR] Failed to determine Java version for profile jdk8 @
> io.dropwizard.metrics:metrics-parent:4.1.17,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/io/dropwizard/metrics/metrics-parent/4.1.17/metrics-parent-4.1.17.pom,
> line 160, column 22
> [ERROR] Failed to determine Java version for profile doclint-java8-disable
> @ org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 839, column 17
> [ERROR] Failed to determine Java version for profile
> compile-java8-release-flag @ org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 879, column 18
> [ERROR] Failed to determine Java version for profile include-jdk-misc @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 910, column 22
> [ERROR] Failed to determine Java version for profile java8-test @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 961, column 22
> [ERROR] Failed to determine Java version for profile java9-mr-build @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 998, column 22
> [ERROR] Failed to determine Java version for profile java9-test @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1047, column 22
> [ERROR] Failed to determine Java version for profile java10-mr-build @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1087, column 22
> [ERROR] Failed to determine Java version for profile java10-test @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1139, column 22
> [ERROR] Failed to determine Java version for profile java11-mr-build @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1182, column 22
> [ERROR] Failed to determine Java version for profile java11-test @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1237, column 22
> [ERROR] Failed to determine Java version for profile java12-mr-build @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1283, column 22
> [ERROR] Failed to determine Java version for profile java12-test @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1341, column 22
> [ERROR] Failed to determine Java version for profile java13-mr-build @
> org.jboss:jboss-parent:36,
>
> /Users/anthony.dahanne/workspaces/maven-resolver/target/.m2/org/jboss/jboss-parent/36/jboss-parent-36.pom,
> line 1390, column 22
>
>
> And this is the pom I tried to resolve:
>
> <?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
> https://maven.apache.org/xsd/maven-4.0.0.xsd">
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
>       <groupId>org.springframework.boot</groupId>
>       <artifactId>spring-boot-starter-parent</artifactId>
>       <version>2.4.2</version>
>       <relativePath/> <!-- lookup parent from repository -->
>    </parent>
>    <groupId>net.dahanne</groupId>
>    <artifactId>maven-resolver</artifactId>
>    <version>0.0.1-SNAPSHOT</version>
>    <name>maven-resolver</name>
>    <description>Demo project for Spring Boot</description>
>    <properties>
>       <java.version>11</java.version>
>       <maven.version>3.6.3</maven.version>
>       <maven-resolver.version>1.6.1</maven-resolver.version>
>    </properties>
>    <dependencies>
>       <dependency>
>          <groupId>org.springframework.boot</groupId>
>          <artifactId>spring-boot-starter</artifactId>
>       </dependency>
>
>       <dependency>
>          <groupId>org.apache.maven</groupId>
>          <artifactId>maven-core</artifactId>
>          <version>${maven.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven</groupId>
>          <artifactId>maven-compat</artifactId>
>          <version>${maven.version}</version>
>       </dependency>
>
>       <dependency>
>          <groupId>org.apache.maven</groupId>
>          <artifactId>maven-resolver-provider</artifactId>
>          <version>${maven.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-util</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-api</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-spi</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-transport-http</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-transport-file</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-connector-basic</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>       <dependency>
>          <groupId>org.apache.maven.resolver</groupId>
>          <artifactId>maven-resolver-impl</artifactId>
>          <version>${maven-resolver.version}</version>
>       </dependency>
>
>
>       <dependency>
>          <groupId>org.springframework.boot</groupId>
>          <artifactId>spring-boot-starter-test</artifactId>
>          <scope>test</scope>
>       </dependency>
>    </dependencies>
>
>    <build>
>       <plugins>
>          <plugin>
>             <groupId>org.springframework.boot</groupId>
>             <artifactId>spring-boot-maven-plugin</artifactId>
>          </plugin>
>       </plugins>
>    </build>
>
> </project>
>