Can't enforce Maven < 3.0.0-SNAPSHOT
------------------------------------

                 Key: MENFORCER-99
                 URL: http://jira.codehaus.org/browse/MENFORCER-99
             Project: Maven 2.x Enforcer Plugin
          Issue Type: Bug
    Affects Versions: 1.0-beta-1
         Environment: Maven 3.0.0-SNAPSHOT
            Reporter: Andrew Hughes


I am trying to stop people using maven 3.0.0-SNAPSHOT. This occur's frequently 
because m2eclipse's embedded version is 3.0.0-SNAPSHOT.

Configuration:
{noformat}
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
                <execution>
                        <id>enforce-versions</id>
                        <goals>
                                <goal>enforce</goal>
                        </goals>
                        <configuration>
                                <rules>
                                        <requireMavenVersion>
                                                <!-- Allow Maven 2.2.1 but not 
3 -->
                                                <version>[2.2.1,2.9.9]</version>
                                        </requireMavenVersion>
                                        <requireJavaVersion>
                                                <!-- Use the latest JDK, 
1.6.0-18+ -->
                                                <version>[1.6.0-18,)</version>
                                        </requireJavaVersion>
                                </rules>
                        </configuration>
                </execution>
        </executions>
</plugin>
{noformat}

The problem is that the enforcerplugin doesn't seem to pickup the rules 
{noformat}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-enforcer-plugin:1.0-beta-1:enforce (default-cli) 
on project cl2-parent: No rules are configured. Use the skip flag if you want 
to disable execution. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.maven.plugins:maven-enforcer-plugin:1.0-beta-1:enforce (default-cli) 
on project cl2-parent: No rules are configured. Use the skip flag if you want 
to disable execution.
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:570)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:317)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:423)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:158)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:123)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: No rules are 
configured. Use the skip flag if you want to disable execution.
        at 
org.apache.maven.plugins.enforcer.EnforceMojo.execute(EnforceMojo.java:225)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:562)
        ... 14 more
[ERROR] 
{noformat}
Also, this doesn't appear to be bound to any lifecycle. So it only runs with 
'enforcer:enforce' and not 'install', 'compile' e.t.c.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to