Skip to content

Commit dd2dd76

Browse files
committed
chore(build): Updated the build to be compatible with Java 19
1 parent 7c8eefb commit dd2dd76

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ the language of choice.
8585

8686
### Java
8787

88-
NOTE: Currently the Java version which supports building of all parts of Apache PLC4X is at least Java 11
88+
NOTE: Currently the Java version which supports building of all parts of Apache PLC4X is at least Java 11 (Currently with Java 19 the Apache Kafka integration module is excluded from the build as the plugins it requires are incompatible with this version)
8989

9090
See the PLC4J user guide on the website to start using PLC4X in your Java application:
9191
[https://plc4x.apache.org/users/getting-started/plc4j.html](https://plc4x.apache.org/users/getting-started/plc4j.html)
@@ -139,7 +139,9 @@ If you don't want to bother setting up the environment on your normal system and
139139
### Getting Started
140140

141141
You must have at least Java 11 installed on your system and connectivity to Maven Central
142-
(for downloading external third party dependencies). Maven 3.6 is required to build, so be sure it's installed and available on your system.
142+
(for downloading external third party dependencies). Maven 3.6 is required to build, so be sure it's installed and available on your system.
143+
144+
NOTE: When using Java 19 currently the Apache Kafka integration module is excluded from the build as one of the plugins it requires has proven to be incompatible with this version.
143145

144146
NOTE: There is a convenience Maven-Wrapper installed in the repo, when used, this automatically downloads and installs Maven. If you want to use this, please use `./mvnw` or `mvnw` instead of the normal `mvn` command.
145147

plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/ModbusEncodeTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.apache.plc4x.java.modbus;
2020

21+
import org.apache.plc4x.java.api.value.PlcValue;
2122
import org.apache.plc4x.java.modbus.base.field.ModbusFieldHoldingRegister;
2223
import org.apache.plc4x.java.modbus.base.field.ModbusFieldCoil;
2324
import org.apache.plc4x.java.spi.values.IEC61131ValueHandler;
@@ -137,7 +138,13 @@ public void testEncodeFloatREAL() {
137138
Float[] object = {1.1f,1000.1f,100000.1f,3.4028232E38f,-3.4028232E38f,-1f,10384759934840.0f};
138139
ModbusFieldHoldingRegister holdingregister = ModbusFieldHoldingRegister.of("holding-register:7:REAL");
139140
PlcList list = (PlcList) IEC61131ValueHandler.of(holdingregister, object);
140-
Assertions.assertEquals("[1.1,1000.1,100000.1,3.4028233E38,-3.4028233E38,-1.0,1.03847601E13]", list.toString());
141+
//! When using Java 19 it seems the toString method uses a different precision than the previous versions,
142+
//! so we need to check differently in this case.
143+
for (int i = 0; i < list.getLength(); i++) {
144+
PlcValue plcValue = list.getIndex(i);
145+
Float referenceValue = object[i];
146+
Assertions.assertEquals(referenceValue, plcValue.getFloat());
147+
}
141148
}
142149

143150
@Test

plc4j/integrations/pom.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,22 @@
3535

3636
<modules>
3737
<module>apache-camel</module>
38-
<module>apache-kafka</module>
3938
<module>apache-nifi</module>
4039
<module>apache-calcite</module>
4140
<module>opcua-server</module>
4241
</modules>
4342

43+
<!-- ! the kafka maven plugin currently seems to have issues with Java 19 -->
44+
<profiles>
45+
<profile>
46+
<id>java-version-not-19</id>
47+
<activation>
48+
<jdk>[1.8, 19)</jdk>
49+
</activation>
50+
<modules>
51+
<module>apache-kafka</module>
52+
</modules>
53+
</profile>
54+
</profiles>
55+
4456
</project>

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@
134134
<hamcrest.version>2.2</hamcrest.version>
135135
<httpclient.version>4.5.13</httpclient.version>
136136
<httpcore.version>4.4.15</httpcore.version>
137-
<jackson.version>2.13.4</jackson.version>
137+
<!-- ! 2.13.4 has a known CVE and 2.14.0-rc1 seems to fix that, even if not finally released -->
138+
<jackson.version>2.14.0-rc1</jackson.version>
138139
<woodstox-core.version>6.3.1</woodstox-core.version>
139140
<!-- When updating this to the latest version, we're getting errors in the opcua server tests -->
140141
<jaxb.version>4.0.1</jaxb.version>

0 commit comments

Comments
 (0)