Skip to content

Commit

Permalink
chore(catalog-generator): Lower the required Java version to 17
Browse files Browse the repository at this point in the history
Currently, the `catalog-generator` requires Java 21.

While that enable modern syntax, not all users have it installed in
their machines, so in order to lower the contribution requirements,
we're lowering the required version to be Java 17.

By default, in RHEL 9.0, Java 17 is preinstalled.

Here is an extract of the available Java version per RHEL version

| RHEL Version | Java version | Release date |
| --- | --- | --- |
| RHEL 7 | Java 8  | June 10, 2014 |
| RHEL 8 | Java 11 | May 7, 2019   |
| RHEL 9 | Java 17 | May 17, 2022  |

fix: #1476
  • Loading branch information
lordrip committed Oct 2, 2024
1 parent 3907213 commit 8bd3058
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Have a quick look at our online demo instance:
## Requirements
- NodeJS (v18.x or higher) [+info](https://nodejs.org/en)
- Yarn (v3.x or higher) [+info](https://yarnpkg.com/getting-started/install)
- OpenJDK (v21 or higher) [+info](https://developers.redhat.com/products/openjdk/download)
- OpenJDK (v17 or higher) [+info](https://developers.redhat.com/products/openjdk/download)

_For more information on Vite, check [Vite's documentation](https://vitejs.dev/config/)._

Expand Down
28 changes: 24 additions & 4 deletions packages/catalog-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
<description>A Camel Catalog generator for Kaoto.</description>
<url>https://kaoto.io</url>
<properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version.camel>4.8.0</version.camel>
Expand All @@ -23,6 +22,7 @@
<version.jackson>2.17.2</version.jackson>
<version.junit>5.11.0</version.junit>
<version.kubernetes-model>6.13.3</version.kubernetes-model>
<version.maven-enforcer-plugin>3.5.0</version.maven-enforcer-plugin>
<version.maven-compiler-plugin>3.13.0</version.maven-compiler-plugin>
<version.maven-surefire-plugin>3.5.0</version.maven-surefire-plugin>
</properties>
Expand Down Expand Up @@ -160,6 +160,26 @@
</classPatterns>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${version.maven-enforcer-plugin}</version>
<executions>
<execution>
<id>enforce-java-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[17,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.maven-compiler-plugin}</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,31 @@ public String getEntityCatalog() throws Exception {
var entityName = entry.getKey();
var entitySchema = entry.getValue();
var entityCatalog = catalogMap.get(entityName);

switch (entityName) {
case "beans" -> processBeansParameters(entitySchema, entityCatalog);
case "from" -> processFromParameters(entitySchema, entityCatalog);
case "route" -> processRouteParameters(entitySchema, entityCatalog);
case "routeTemplate" -> processRouteTemplateParameters(entitySchema, entityCatalog);
case "templatedRoute" -> processTemplatedRouteParameters(entitySchema, entityCatalog);
case "restConfiguration" -> processRestConfigurationParameters(entitySchema, entityCatalog);
case "rest" -> processRestParameters(entitySchema, entityCatalog);
case null, default -> processEntityParameters(entityName, entitySchema, entityCatalog);
case "beans":
processBeansParameters(entitySchema, entityCatalog);
break;
case "from":
processFromParameters(entitySchema, entityCatalog);
break;
case "route":
processRouteParameters(entitySchema, entityCatalog);
break;
case "routeTemplate":
processRouteTemplateParameters(entitySchema, entityCatalog);
break;
case "templatedRoute":
processTemplatedRouteParameters(entitySchema, entityCatalog);
break;
case "restConfiguration":
processRestConfigurationParameters(entitySchema, entityCatalog);
break;
case "rest":
processRestParameters(entitySchema, entityCatalog);
break;
default:
processEntityParameters(entityName, entitySchema, entityCatalog);
}

sortPropertiesAccordingToCamelCatalog(entitySchema, entityCatalog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void testGeneratorCalledWithCorrectParameters() {
})) {
generateCommand.run();

CatalogGeneratorBuilder builder = mockedBuilder.constructed().getFirst();
CatalogGeneratorBuilder builder = mockedBuilder.constructed().get(0);

verify(builder, times(1)).withRuntime(CatalogRuntime.Main);
verify(builder, times(1)).withCamelCatalogVersion("4.8.0");
Expand Down Expand Up @@ -99,12 +99,12 @@ void testCatalogLibraryOutput() {
) {
generateCommand.run();

CatalogLibrary library = mockedLibrary.constructed().getFirst();
CatalogLibrary library = mockedLibrary.constructed().get(0);

assertEquals(library.getName(), "test-camel-catalog");
assertEquals(library.getDefinitions().size(), 1);

CatalogLibraryEntry catalogLibraryEntry = library.getDefinitions().getFirst();
CatalogLibraryEntry catalogLibraryEntry = library.getDefinitions().get(0);
assertEquals(catalogLibraryEntry.name(), "test-camel-catalog");
assertEquals(catalogLibraryEntry.version(), "4.8.0");
assertEquals(catalogLibraryEntry.runtime(), "Main");
Expand Down

0 comments on commit 8bd3058

Please sign in to comment.