Hi,

can you please file an issue in JIRA and please add an example project to reproduce the issue...

Kind regards
Karl Heinz Marbaise

On 01/11/18 14:49, Marshall Schor wrote:
also tried with just released maven 3.6.0 - same behavior.

On 11/1/2018 9:34 AM, Marshall Schor wrote:
Hi,

I can get parent pom relative path to work from a top level pom referencing a
subfolder at the 1st level.

But it fails for me when the top level includes a <module> sub project contained
in another 1st level folder next to the parent pom's folder, where that
project's pom references the parent-pom using ../parent/pom.xml.

I include here a trivial example, with the folder structure and the poms.  You
can see the failure by typing mvn help:effective-pom after cd'ing to the top
project's folder.

Here's the folder structure:
mvntst <- top folder
    parent  <- subfolder having parent pom
    subproj <- subfolder having a sub project

Using maven version 3.5.4 (current), running on Windows 10, with Java 8

The three poms:

in mvntst folder (the top level folder)

<?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
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>mvntst</groupId>
     <artifactId>top</artifactId>
     <packaging>pom</packaging>
     <parent>
         <groupId>mvntst</groupId>
         <artifactId>parent</artifactId>
         <version>1.0.0</version>
         <relativePath>parent/pom.xml</relativePath>   <!-- works, finds the
parent -->
     </parent>
     <modules>
       <module>subproj</module>
     </modules>
</project>

in parent subfolder:

<?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
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>mvntst</groupId>
     <artifactId>parent</artifactId>
     <version>1.0.0</version>
     <packaging>pom</packaging>
</project>

in subproj subfolder:

<?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
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>mvntst</groupId>
     <artifactId>subproj</artifactId>
     <parent>
         <groupId>mvntst</groupId>
         <artifactId>parent</artifactId>
         <version>1.0.0</version>
         <relativePath>../parent/pom.xml</relativePath>  <!-- fails -->
     </parent>
</project>

In doing various tests: if the top pom is missing its relative-path, you get an
expected
Non-resolvable parent POM for mvntst:top:[unknown-version]: Failure to find
mvntst:parent:pom:1.0.0

putting in the relative-path into the top fixes this, and results in finding the
parent for the top level.
If you don't have a <modules> section in the top level, the mvn
help:effective-pom works OK.

Putting in the <modules> section gives the error:
Non-resolvable parent POM for mvntst:subproj:[unknown-version]: Failure to find
mvntst:parent:pom:1.0.0

Adding the <version> to the artifact IDs for the top and subproj doesn't help,
except to change the error message to include the version instead of
[unknown-version]

Any idea why relative-path works for the top level pom referencing a direct
subfolder, but the subproject's reference fails?  Is this not supported by 
maven?

Thanks.  -Marshall

P.S., a great improvement for maven would be to have the error message for this
which says:
'parent.relativePath' points at wrong local POM
be augmented to say why.  For example,
    the relative path resolved to xxxxxxxx, and there was no file there, or
    the relative path resolved to xxxxxxxx, and that file was not a "pom" xml
file, or
    the relative path resolved to xxxxxxxx, and the pom found there didn't pass
this validation test (saying what exactly failed)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to