TomVanWemmel opened a new issue, #939:
URL: https://github.com/apache/maven-enforcer/issues/939

   ### 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
   <?xml version="1.0" encoding="UTF-8"?>
   <extensions xmlns="http://maven.apache.org/EXTENSIONS/1.1.0";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.1.0
                               
https://maven.apache.org/xsd/core-extensions-1.1.0.xsd";>
       <extension>
           <groupId>org.apache.maven.extensions</groupId>
           <artifactId>maven-enforcer-extension</artifactId>
           <version>3.6.2</version>
       </extension>
   </extensions>
   ```
   
   The other is `enforcer-extension.xml`
   ```xml
   <extension>
     <executions>
       <execution>
         <configuration>
           <rules>
             <requireMavenVersion>
               <version>(3.6.3,)</version>
             </requireMavenVersion>
             <requireJavaVersion>
               <version>17</version>
             </requireJavaVersion>
           </rules>
         </configuration>
       </execution>
     </executions>
   </extension>
   ```
   
   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. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to