apache / apache/maven

[MNG-8667] Failed to build project against clean $HOME/.m2 (regression in Maven 4)

Open
#10,427 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Basil Crow](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=basil)** opened **[MNG-8667](https://issues.apache.org/jira/browse/MNG-8667?redirect=false)** and commented

### Steps to reproduce

```
$ rm -rf ~/.m2/repository
$ git clone https://github.com/jenkinsci/text-finder-plugin.git
$ cd text-finder-plugin
$ mvn validate
```

### Expected results

**Note:** These are the _actual_ results with Maven 3.9.9 against a clean `{}$HOME/.m2{`}.

Build succeeds.

### Actual results:

As of 4.0.0-rc-3, I see:

```
$ mvn validate
[INFO] Scanning for projects...
[WARNING] Failed to build parent project for org.jenkins-ci.plugins:text-finder:hpi:1.32-SNAPSHOT
[ERROR] The requested profiles [might-produce-incrementals, consume-incrementals] could not be activated or deactivated because they do not exist. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the '-e' switch
[ERROR] Re-run Maven using the '-X' switch to enable verbose output
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProfilesException
```

### Analysis

This issue was previously reported as MNG-8665, which was closed prematurely. That closure was erroneous because it assumed that the profiles were optional and did not exist, but the profiles are _not_ optional and _do_ exist.

Note that I cannot reproduce the problem in my regular setup (with a very full `$HOME/.m2` directory, populated by running many Maven 3 builds), but I can easily reproduce the problem in a Docker container with an empty `$HOME/.m2` directory.

---

**Affects:** 4.0.0-rc-3

**Issue Links:**
- [MNG-8665](https://issues.apache.org/jira/browse/MNG-8665) mvn validate fails for Jenkins plugins (regression in 4.0.0-rc-1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.