itro
itro

Reputation: 7228

Minimum Spring-batch and spring-context version compatible with Java 11?

I need to upgrade my maven project to Java 11, so I am wondering:

  1. What is the min version of Spring Framework and spring-batch version supported in Java 11?
  2. What to be change in the pom?

As of now I know:

  1. My project is not a spring-boot.
  2. I know the Spring version should be at least 5.1.
  3. <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>-->
    <configuration>
         <release>11</release>-->
         <encoding>iso-8859-1</encoding>
    </configuration>
    

The pom contains the following:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jo.tatova.honki</groupId>
<artifactId>toko</artifactId>
<version>1.0.40-SNAPSHOT</version>

<packaging>jar</packaging>
<name>toko</name>

<parent>
    <groupId>jo.tatova.parent</groupId>
    <artifactId>parent-pom</artifactId>
    <version>1.0.0</version>
</parent>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
    <org.springframework.batch>2.1.9.RELEASE</org.springframework.batch>
    <org.slf4j-version>1.6.2</org.slf4j-version>
</properties>

<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.batch</groupId>
        <artifactId>spring-batch-core</artifactId>
        <version>${org.springframework.batch}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.6.10.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.6.10.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.4</version>
    </dependency>

    <dependency>
        <groupId>jo.tatova</groupId>
        <artifactId>record-utils</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>jo.tatova.honki</groupId>
        <artifactId>honki-java</artifactId>
        <version>1.0.110-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.informix</groupId>
        <artifactId>informix-driver</artifactId>
        <version>3.0</version>
        <scope>runtime</scope>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <encoding>iso-8859-1</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                            <exclude>META-INF/LICENSE*</exclude>
                            <exclude>META-INF/license.txt</exclude>
                            <exclude>META-INF/NOTICE*</exclude>
                            <exclude>META-INF/notice.txt</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>license.txt</exclude>
                            <exclude>NOTICE</exclude>
                            <exclude>overview.html</exclude>
                            <exclude>readme.txt</exclude>
                            <exclude>testpool.jocl</exclude>
                            <exclude>XPP3_1.1.4c_MIN_VERSION</exclude>
                        </excludes>
                    </filter>
                </filters>
                <transformers>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.schemas</resource>
                    </transformer>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <manifestEntries>
                            <Main-Class>jo.tatova.honki.toko.TokoParser</Main-Class>
                        </manifestEntries>
                    </transformer>
                </transformers>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Upvotes: 0

Views: 4054

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31600

I know the Spring version should be at least 5.1

<org.springframework.batch>2.1.9.RELEASE</org.springframework.batch>

You seem to be upgrading Spring Batch from v2. Since your Spring version should be at least v5.1, you need to upgrade Spring Batch to v4 (which is based on Spring Framework v5) and requires Java 8 at a minimum. So the answer to your question about the minimum Java version is Java 8, but you should be able to use Java 11 if you want.

Upvotes: 1

Related Questions