Apache PLC4X is an effort to create a set of libraries for communicating with industrial grade programmable logic controllers (PLCs) in a uniform way. We are planning on shipping libraries for usage in:
PLC4X also integrates with other Apache projects, such as:
And brings stand-alone (Java) utils like:
It also provides (Java) tools for usage inside an application:
Depending on the programming language, the usage will differ, therefore please go to the Getting Started on the PLC4X website to look up the language of choice.
NOTE: Currently the Java version which supports building of all parts of Apache PLC4X is at least Java 19 (We have tested all versions up to Java 21), however it's only the Java Tool UI, that requires this right now. All other modules need at least Java 11.
See the PLC4J user guide on the website to start using PLC4X in your Java application: https://plc4x.apache.org/users/getting-started/plc4j.html
Currently, the project is configured to require the following software:
JAVA_HOME
configured to point to that.passive-mode
driversWARNING: The code generation uses a utility which requires some additional VM settings. When running a build from the root, the settings in the .mvn/jvm.config
are automatically applied. When building only a sub-module, it is important to set the vm args: --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
. In Intellij for example set these in the IDE settings under: Preferences | Build, Execution, Deployment | Build Tools | Maven | Runner: JVM Options.
A more detailed description is available on our website:
https://plc4x.apache.org/developers/preparing/index.html
PLC4C
we also need:All requirements are retrieved by the build itself
PLC4Go
we also need:All requirements are retrieved by the build itself
PLC4Py
we also need:PLC4Net
we also need:With this setup you will be able to build the Java part of PLC4X.
The when doing a full build, we automatically run a prerequisite check and fail the build with an explanation, if not all requirements are meet.
If you don't want to bother setting up the environment on your normal system, and you have Docker installed, you can also build everything in a Docker container:
docker compose up
This will build a local Docker container able to build all parts of PLC4X and will run a maven build of the local directory inside this container.
The default build will run a local release-build, so it can also be used to ensure reproducible builds when releasing.
Per default will it store files locally:
out/.repository
out/.local-snapshots-dir
The reason for this is, that otherwise the artifacts would be packaged in with the source-release artifact, resulting in a 12GB or more zip archive. However, saving it in the main target
directory would make the build delete the local repo every time a mvn clean
is run. The out
directory however is excluded per default from the assembly descriptor, and therefore it is not included in the source zim.
You must have at least Java 11 installed on your system and connectivity to Maven Central (for downloading external third party dependencies). Maven 3.6 is required to build, so be sure it's installed and available on your system.
NOTE: When using Java 21 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.
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.
NOTE: When running from sources-zip, the mvnw
might not be executable on Mac
or Linux
. This can easily be fixed by running the following command in the directory.
$ chmod +x mvnw
NOTE: If you are working on a Windows
system, please use mvnw.cmd
instead of ./mvnw
in the following build commands.
Build PLC4X Java jars and install them in your local maven repository
./mvnw install
You can now construct Java applications that use PLC4X. The PLC4X examples are a good place to start and are available inside the plc4j/examples
directory.
The Go
drivers can be built by enabling the with-go
profile:
./mvnw -P with-go install
The Java
drivers can be built by enabling the with-java
profile:
./mvnw -P with-java install
The C# / .Net
implementation is currently in a work in progress
state. In order to be able to build the C# / .Net
module, you currently need to activate the: with-dotnet
profiles.
./mvnw -P with-dotnet install
The Python implementation is currently in a somewhat unclean state and still needs refactoring. In order to be able to build the Python module, you currently need to activate the: with-python
profiles.
./mvnw -P with-python install
In order to build everything the following command should work:
./mvnw -P with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks,update-generated-code install
Join the PLC4X community by using one of the following channels. We'll be glad to help!
Subscribe to the following mailing lists:
See also: https://plc4x.apache.org/mailing-lists.html
Get the latest PLC4X news on Twitter: https://twitter.com/ApachePlc4x
There are multiple forms in which you can become involved with the PLC4X project.
These are, but are not limited to:
We are a very friendly bunch so don’t be afraid to step forward. If you'd like to contribute to PLC4X, have a look at our contribution guide!
Apache PLC4X is released under the Apache License Version 2.0.