简体   繁体   中英

Two maven versions required in pom.xml - what to do?

I'm trying to build JavaOCR project with mvn clean install . There is used maven-enforcer-plugin in the pom.xml and there are two required Maven versions. (Or maybe I misunderstood something)

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <id>enforce-versions</id>
            <goals>
                <goal>enforce</goal>
            </goals>
            <configuration>
                <rules>
                    <requireMavenVersion>
                        <!--different rules for different issues-->
                        <!--3.3.x causes `java.lang.NoClassDefFoundError: org/eclipse/aether/spi/connector/Transfer$State` which is caused by certain maven versions, see https://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound for details-->
                        <version>(,3.3)</version>
                        <!--3.2.x causes `No implementation for org.eclipse.aether.connector.wagon.WagonConfigurator was bound.`-->
                        <version>(,3.2)</version>
                    </requireMavenVersion>
                </rules>
            </configuration>
        </execution>
    </executions>
</plugin>

Currently I have installed maven 3.3.3 and it throws the java.lang.NoClassDefFoundError error (same as described in the comment in pom.xml ), so I cannot build it.

My question is what version should I use to build the project successfully? Is it possible to use two maven versions simultaneously?

According to Maven's Version Range Specification documentation, that's specifying a range, not a specific version. (,3.2) means anything less than version 3.2, so those two configurations are compatible: for example, use version 3.1.

This is reinforced by the comments in the pom file, which say that versions 3.2.x and 3.3.x cause errors, so don't use them.

See also

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM