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
> <anthony.daha...@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-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to