简体   繁体   中英

maven exclude plugin in dependency

I'm using the following Maven dependency:-

    <dependency>
        <groupId>com.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>3.1</version>
    </dependency>

The JRE version I'm using is 1.6, but the above dependency seems to use 1.7, assuming from the following in the opencsv's POM.

    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
            <useIncrementalCompilation>true</useIncrementalCompilation>
        </configuration>
    </plugin>

I'm getting a Unsupported major.minor version 51.0 (unable to load class com.opencsv.bean.MappingStrategy).

Is there any way I can force the dependency to use JRE 1.6?

No dice, what is on maven is built with that version.

what you can do, since the permissive Apache 2.0 license, is to download sources, change the compilation level in the root pom, build it and install it in a local maven repository under a version and name of your choosing.

I'd suggest to store it as a local maven repository within the project, instead of using a system dependency, but that's just personal preference.

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