### Apache License 2.0 Boilerplate Notice Source: https://github.com/pi4j/pi4j-v1/blob/master/LICENSE.txt The standard boilerplate notice to be attached to works licensed under the Apache License, Version 2.0. This text should be enclosed within the appropriate comment syntax for the specific file format (e.g., /* ... */ for C/Java, # ... for Python) and include the copyright year and owner. ```Generic Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### Install Unofficial WiringPi for Raspberry Pi Source: https://github.com/pi4j/pi4j-v1/blob/master/README.md Commands to remove the deprecated WiringPi library and install the latest unofficial version (2.60 as of 2021-01-12) from GitHub. This is required to support Raspberry Pi 4B and newer systems with Pi4J v1.x. ```bash sudo apt-get remove wiringpi -y sudo apt-get --yes install git-core gcc make cd ~ git clone https://github.com/WiringPi/WiringPi --branch master --single-branch wiringpi cd ~/wiringpi sudo ./build ``` -------------------------------- ### Install OpenJDK 11 on Raspberry Pi Source: https://github.com/pi4j/pi4j-v1/blob/master/README.md Command to install OpenJDK 11 on a Raspberry Pi. OpenJDK is recommended for building Pi4J v1.x, as specific Oracle JDK 11 versions (11.0.06, 11.0.07, 11.0.09, 11.0.10) are known to fail compilation. ```bash sudo apt-get install openjdk-11-jdk ``` -------------------------------- ### Build Pi4J Java and Native Libraries with Maven Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md Compile the complete Pi4J project, including both Java JARs and native `libpi4j.so` libraries, using Apache Maven. This requires a local JDK and Maven installation. The `native` profile enables native library compilation, which can be performed via Docker (`docker` profile) or a local cross-compiler (`cross-compile` profile). ```Shell mvn clean install -P native,docker ``` ```Shell mvn clean install -P native,cross-compile ``` -------------------------------- ### Build Pi4J Project using Docker Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md Build the entire Pi4J project using a Docker container, eliminating the need for a local build environment setup. This command pulls the `pi4j/pi4j-builder` image and executes the build from the current project directory. ```Shell docker pull pi4j/pi4j-builder:1.4 docker run --user "$(id -u):$(id -g)" --rm --volume $(pwd):/build pi4j/pi4j-builder:1.4 ``` -------------------------------- ### Generate and Deploy Pi4J Website Content Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md These Maven commands are used to generate project site documentation locally and then deploy it to Pi4J content servers. An additional profile can be included during official releases to update the root site index.html. Requires AWS access credentials. ```Maven mvn -N clean site ``` ```Maven mvn -N clean site -Pdeploy-site ``` ```Maven mvn -N clean site -Pdeploy-site,publish-site ``` -------------------------------- ### Execute Pi4J v1 Maven Release Build and Site Deployment Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md Executes the Maven commands necessary to build and deploy the Pi4J v1 release artifacts and publish the project's site. For successful artifact signing and site content upload, ensure that GPG keys (`pi4j.gpg.key`, `pi4j.gpg.passphrase`) and AWS credentials (`pi4j.aws.access.key`, `pi4j.aws.secret.key`) are configured in your Maven `settings.xml` or provided as command-line arguments. ```Maven mvn clean deploy -Drelease-build mvn -N clean site -Pdeploy-site,publish-site ``` -------------------------------- ### Perform Public Pi4J Snapshot Deployment Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md This sequence of Maven commands performs a comprehensive public snapshot deployment. It compiles Java and native libraries, creates packages (ZIP, TAR.GZ, DEB), uploads them to Maven SNAPSHOT and Pi4J download servers, and generates/uploads updated website content. Requires AWS access credentials. ```Maven mvn clean deploy -P native,docker,deploy-downloads mvn -N clean site -Pdeploy-site ``` -------------------------------- ### Deploy Pi4J Snapshots to Maven Repository Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md These commands deploy snapshot builds of Pi4J to the OSS Maven SNAPSHOT repository. Different commands are provided for deploying Java libraries only, JNI native libraries using Docker or cross-compilers, and both Java and JNI libraries. Requires 'sonatype-oss-snapshot-repo' site credentials. ```Maven mvn clean deploy (Java libraries only) mvn clean deploy --projects pi4j-native -P native,docker (JNI native libraries build using Docker container) mvn clean deploy --projects pi4j-native -P native,cross-compile (JNI native libraries build using cross-compiler toolchains) mvn clean deploy -P native,docker (Java libraries and JNI native libraries build using Docker container) mvn clean deploy -P native,cross-compile (Java libraries and JNI native libraries build using cross-compiler toolchains) ``` -------------------------------- ### Deploy Pi4J Downloadable Artifacts to Content Servers Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md This Maven command deploys the compiled Pi4J downloadable artifacts to the Pi4J downloads page. It targets the 'pi4j-distribution' project for release builds. ```Maven mvn deploy -Drelease-build --projects pi4j-distribution ``` -------------------------------- ### Redirect to Version-Specific Pi4J Project Page Source: https://github.com/pi4j/pi4j-v1/blob/master/src/site/root/index.html This JavaScript snippet redirects the user's browser to a version-specific URL for the Pi4J Project, dynamically inserting the current version number into the path. It ensures users are directed to the most relevant documentation or home page. ```JavaScript window.location.href = "/${VERSION}" ``` -------------------------------- ### Build Pi4J Native Libraries Only with Maven Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md Compile only the Pi4J native libraries (`libpi4j-armhf.so` and `libpi4j-aarch64.so`) without building the Java JARs. This command targets the `pi4j-native` project and uses the `native` profile, with options for building via Docker (`docker` profile) or a local cross-compiler (`cross-compile` profile). ```Shell mvn clean install --projects pi4j-native -P native,docker ``` ```Shell mvn clean install --projects pi4j-native -P native,cross-compile ``` -------------------------------- ### Build Pi4J Java Libraries Only Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md This command builds only the Pi4J Java libraries (JARs). It uses locally cached native libraries or downloads pre-compiled copies from Maven if not found, avoiding a full native build. ```Maven mvn clean install ``` -------------------------------- ### Regenerate Pi4J Native JNI Header Files Source: https://github.com/pi4j/pi4j-v1/blob/master/BUILD.md This Maven command regenerates native JNI .H header files, necessary when changes or additions are made to Java JNI classes. It must be executed from within the 'pi4j-native' project directory, not at the parent project level. ```Maven mvn generate-sources --projects pi4j-native -P generate-jni-headers ``` -------------------------------- ### Integrate Google Analytics Tracking Source: https://github.com/pi4j/pi4j-v1/blob/master/src/site/root/index.html This JavaScript snippet initializes and configures Google Analytics tracking for the Pi4J Project website. It sets the account ID, domain name, and tracks page views, enabling website administrators to monitor traffic and user engagement. ```JavaScript var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35332834-1']); _gaq.push(['_setDomainName', 'pi4j.com']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.