Plc4x
PLC4X The Industrial IoT adapter
Install / Use
/learn @apache/Plc4xREADME
Table of contents
About Apache PLC4X
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:
- Java
- Go
- C (not ready for usage)
- Python (not ready for usage)
- C# (.Net) (not ready for usage - abandoned)
PLC4X also integrates with other Apache projects, such as:
And brings stand-alone (Java) utils such as:
- OPC-UA Server: Enables you to communicate with legacy devices using PLC4X with OPC-UA.
- PLC4X Server: Enables you to communicate with a central PLC4X Server which then communicates with devices via PLC4X.
It also provides (Java) tools for usage inside an application: Both the integration modules as also the OPC-UA Server and PLC4X Server are being released as part of the plc4x-extras release.
- Connection Cache: New implementation of our framework for re-using and sharing PLC connections
- OPM: Object-Plc-Mapping: Allows binding PLC fields to properties in java POJOs similar to JPA
- Scraper: Utility to do scheduled and repeated data collection.
Getting started
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.
Java
NOTE: Currently the minimum Java version is Java 21, and we have tested it up to Java 24.
The project is currently split up into three repositories, the plc4x, plc4x-build-tools and plc4x-extras repository.
To be able to build all parts of the plc4x-extras repository, at least Java 21 is required.
See the PLC4J user guide on the website to start using PLC4X in your Java application: https://plc4x.apache.org/plc4x/latest/users/getting-started/plc4j.html
Developers
Environment
Currently, the project is configured to require the following software:
- Java 21 JDK: For running Maven in general as well as compiling the Java and Scala modules
JAVA_HOMEconfigured to point to that. - Git (even when working on the source distribution)
- (Optional, for running all tests)
libpcap/Npcapfor raw socket tests in Java or use ofpassive-modedrivers - (Optional, for running all tests)
Dockerfor running some tests making use ofTestcontainers - (Optional, for building the website) Graphviz : For generating the graphs in the documentation
WARNING: 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 submodule, 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.
When doing a full build, we automatically run a prerequisite check and fail the build with an explanation of what to do, if not all requirements are meet.
A more detailed description is available on our website:
https://plc4x.apache.org/plc4x/latest/developers/preparing/index.html
For building PLC4C we also need:
All requirements are retrieved by the build itself
For building PLC4Go we also need:
All requirements are retrieved by the build itself
For building PLC4Py we also need:
- Python 3.8 or higher
- Python pyenv
For building PLC4Net we also need:
- DotNet SDK 7.0 or above
Building with Docker
Part of the build requires quite a bit of ram. Before running the Docker build, please ensure that the Docker runtime has at least 12GB of ram available.
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, it will store files locally:
- Downloaded maven artifacts will go to
out/.repository
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.
Getting Started
You must have at least Java 21 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: 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 -P with-java 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, which is part of the plc4x-extras repository.
The Go drivers can be built by enabling the with-go profile:
./mvnw -P with-go install
The C# / .Net implementation is currently in a work in progress state.
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.
To be able to build the Python module, you currently need to activate the:
with-python profiles.
./mvnw -P with-python install
To build everything, the following command should work:
./mvnw -P with-c,with-dotnet,with-go,with-java,with-python,enable-all-checks install
Updating the generated code
In the past the build used to generate the code in every run. Especially when it comes to repr
Related Skills
node-connect
334.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
82.1kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
82.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
334.1kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
