microsoft / vscode-maven

VSCode extension "Maven for Java"
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven
Other
183 stars 89 forks source link

Maven error when parent POM is defined outside project's folder #975

Open alfonsator opened 1 year ago

alfonsator commented 1 year ago

Describe the bug

If there is a parent POM outside project's directory root dir, declared on project's POM like this

<parent>
   <groupId>com.acme</groupId>
   <artifactId>PROJECT_NAME-parent</artifactId>
   <version>1.22.0</version>
   <relativePath>../../pom.xml</relativePath>
</parent>

then you get this error when executing any target from extension's menu:

PS C:\Users\.....\PROJECT_DIR> & "/dev/apache-maven-3.6.0/bin/mvn.cmd" -s "/maven/settings.xml" package -f "c:\Users\.....\PROJECT_DIR\pom.xml" -DskipTests
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10
[FATAL] Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10
[FATAL] Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10
[FATAL] Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10
 @
[ERROR] The build could not read 4 projects -> [Help 1]
[ERROR]
[ERROR]   The project com.acme.PACKAGE_NAME:PROJECT_NAME-data:[unknown-version] (C:\Users\.....\PROJECT_DIR\acme-data\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10 -> [Help 2]
[ERROR]
[ERROR]   The project com.acme.PACKAGE_NAME:PROJECT_NAME-dto:[unknown-version] (C:\Users\.....\PROJECT_DIR\acme-dto\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10 -> [Help 2]
[ERROR]
[ERROR]   The project com.acme.PACKAGE_NAME:PROJECT_NAME-neg:[unknown-version] (C:\Users\.....\PROJECT_DIR\acme-neg\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10 -> [Help 2]
[ERROR]
[ERROR]   The project com.acme.PACKAGE_NAME:PROJECT_NAME-back:[unknown-version] (C:\Users\.....\PROJECT_DIR\acme-rest\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version]: Failure to find com.acme:PROJECT_NAME-parent:pom:1.22.0 in http://INTERNAL_REPOSITORY/artifactory/repo/ was cached in the local repository, resolution will not be reattempted until the update interval of zaida has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ com.acme.PACKAGE_NAME:PROJECT_NAME-back-padre:[unknown-version], C:\Users\.....\PROJECT_DIR\pom.xml, line 6, column 10 ->

To Reproduce

Execute any Maven target from Maven Extension menu.

Expected behavior

If you execute mvn package manually from vscode terminal, the execution goes with no errors.

Environments (please complete the following information as much as possible):

Additional context

Multi-module project with this structure:

PROJECT_NAME-padre | +--- PROJECT_NAME-data +--- PROJECT_NAME-dto +--- PROJECT_NAME-neg +--- PROJECT_NAME-back