apache / apache/maven-enforcer

Ability to use enforcer.skip without POM.

Closed
#939 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
161
Forks
180
Avg merge
1d 20m
Merged PRs (30d)
8

Description

### Affected version

3.6.2

### Bug description

I found myself in a situation where I wanted to create a new code repository.
I have a script that creates a default structure with two files in the `.mvn` folder
One is `extensions.xml`
```xml


org.apache.maven.extensions
maven-enforcer-extension
3.6.2

```

The other is `enforcer-extension.xml`
```xml






(3.6.3,)


17




```

Next in my routine is to generate a project from an archetype
```
mvn archetype:generate -Denforcer.skip
```

And the enforcer extension throws an exception
```
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> archetype:3.4.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.164 s
[INFO] Finished at: 2025-10-10T10:14:24+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.6.2:enforce (default-extension): Goal requires a project to execute but there is no POM in this directory (/tmp/extension). Please verify you invoked Maven from the correct directory. -> [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 full debug logging.
[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/MissingProjectException
```

For me this is a minor inconvenience, but I was wondering if this behavior is correct.

I suppose `enforcer.skip` would be a POM property, overwritten by the JVM config.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported `mvn archetype:generate -Denforcer.skip` command with the `.mvn/extensions.xml` and `enforcer-extension.xml` files shown in the issue. Inspect how the enforcer extension handles a standalone project without a POM; done means the skip behavior is clearly defined and the command no longer fails unexpectedly if skipping is supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.