0

I have a maven project that needs to be shipped to be running with JDK 1.7(I know it is EOL but the migration to JDK 1.8/1.9 is still a couple quarters away).

I get the exception:

org/eclipse/jetty/server/handler/HandlerCollection : Unsupported major.minor version 52.0 org/eclipse/jetty/server/handler/HandlerCollection : Unsupported major.minor version 52.0 Server exiting.

I resolved this by following this SO post , which mentioned downgrading the jetty version to 9.2 which resolved the above exception. Now the next exception is coming:

org/springframework/web/context/WebApplicationContext : Unsupported major.minor version 52.0 org/springframework/web/context/WebApplicationContext : Unsupported major.minor version 52.0 Server exiting.

Does this mean that I have to keep on fixing each exception that comes one-by-one by downgrading the dependency versions or is there a smarter approach to this?

If this config matters I have done the configuration mentioned here in my eclipse to make my application Java 1.7 compliant(that may be the reason my app is not throwing unsupported exception, rather it's the dependencies which are throwing): And also added this in my pom.xml (but it won't matter for dependencies)

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.test.skip>true</maven.test.skip>
  </properties>

EDIT: Am using maven shade plugin to build a shaded jar of dependencies. The maven shade plugin configuration is:

<plugin>                                
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>                 
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>                                                                        
        </execution>                                        
    </executions>
</plugin>
tryingToLearn
  • 10,691
  • 12
  • 80
  • 114
  • Yes you have to downgrade each of the dependencies which is not compatible with JDK 7 requirement otherwise it will fail with runtime exceptions...Apart from that JDK 7 is too old furthermore you should at least go with JDK 8 of which the ends is not far away as well.. JDK 9 would the best choice... – khmarbaise Mar 20 '18 at 06:31
  • @khmarbaise can you also suggest how to find the compatible versions. For e.g if I am trying to resolve the second exception, how do I find the atrifact version of `spring -web` compatible with JDK 1.7? – tryingToLearn Mar 20 '18 at 06:33
  • 1
    I would suggest to take a deep look into the release notes of the spring parts where you hopefully find hints... – khmarbaise Mar 20 '18 at 06:37

0 Answers0