I found the enforcer rules page. I added the following to my pom:

<build>
    <plugins>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.0.1</version>
          <executions>
            <execution>
              <id>enforce-maven</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>2.2.1</version>
                  </requireMavenVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
    </plugins>
  </build>

I'm still getting the same build error however.

On Sat, Jun 25, 2011 at 2:21 PM, Nick Olsen <[email protected]>wrote:

> I'm a bit confused. I can't find anything in the pom reference that would
> allow me to require a particular version of maven. This is my first time
> using maven, I've only started reading the book.
>
> mvn -v says I'm using Maven 2.2.1
>
> Why would "mvn install" require a different version of maven than "mvn
> archetype: generate?"
>
>
> On Sat, Jun 25, 2011 at 2:01 PM, Ron Wheeler <
> [email protected]> wrote:
>
>> It looks like you are using Maven 3 but the example is asking for a
>> version 2 of Maven or vice versa.
>> Try changing your POM to require the version of Maven that you are in fact
>> using.
>>
>>
>> Ron
>>
>>
>> On 25/06/2011 4:35 PM, Nick Olsen wrote:
>>
>>> I'm reading a book about maven. The book appears to be somewhat outdated
>>> but
>>> it hasn't been too difficult yet.
>>>
>>> Anyways, I've created a project using the "simple" archetype. I have not
>>> added or edited any files. I typed "mvn install" and the following was
>>> the
>>> output:
>>>
>>> [INFO] Scanning for projects...
>>> [INFO] ------------------------------
>>> ------------------------------**------------
>>> [INFO] Building Unnamed -
>>> org.sonatype.mavenbook.simple:**simple:jar:1.0-SNAPSHOT
>>> [INFO]    task-segment: [install]
>>> [INFO]
>>> ------------------------------**------------------------------**
>>> ------------
>>> [INFO] [enforcer:enforce {execution: enforce-plugin-versions}]
>>> [WARNING] Rule 1: org.apache.maven.plugins.**
>>> enforcer.RequireMavenVersion
>>> failed with message:
>>> Detected Maven Version: 2.2.1 is not in the allowed range 3.0-RC1.
>>> [INFO]
>>> ------------------------------**------------------------------**
>>> ------------
>>> [ERROR] BUILD ERROR
>>> [INFO]
>>> ------------------------------**------------------------------**
>>> ------------
>>> [INFO] Some Enforcer rules have failed. Look above for specific messages
>>> explaining why the rule failed.
>>> [INFO]
>>> ------------------------------**------------------------------**
>>> ------------
>>> [INFO] For more information, run Maven with the -e switch
>>> [INFO]
>>> ------------------------------**------------------------------**
>>> ------------
>>> [INFO] Total time: 3 seconds
>>> [INFO] Finished at: Sat Jun 25 13:19:57 PDT 2011
>>> [INFO] Final Memory: 14M/85M
>>> [INFO]
>>> ------------------------------**------------------------------**
>>> ------------
>>>
>>> What is the problem and how can I solve it?
>>>
>>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: 
>> users-unsubscribe@maven.**apache.org<[email protected]>
>> For additional commands, e-mail: [email protected]
>>
>>
>

Reply via email to