I have a simple java class using Pi4J that contains a main method. I want to build and deploy it to a Raspberry Pi. I\'m using java 8 on a windows 10 and my IDE is NetBeans 8.1.
Solved: This pom file will build an executable JAR of example use cases of Pi4J. It will then transfer the JAR to the Raspberry Pi and then execute it. In netbeans, This is done via the build command. So one button to build, deploy and run!
One thing I don't like is that it brings dependencies as packages instead of the original JAR. It also creates 2 JAR's at build time; one with and one without dependencies. Open up the Jar and see what can be done to better the structure. Feel free to optimize and give feedback.
Also, for simplicity purposes on this answer, I put my RASPBERRY PI PROPERTIES in this pom file. However, those should be in a controlled user home location in a settings.xml file or something.
Note: Pi4J has a C code native ARM dependencies which prevent it from running on non ARM architectures and must be sent to Pi.
4.0.0
com.company
Swarm
1.0-SNAPSHOT
jar
UTF-8
1.8
1.8
192.168.1.20
22
root
root
/home/pi/artifacts
com.company.test.ControlGpioExample
junit
junit
3.8.1
test
com.pi4j
pi4j-core
1.0
maven-assembly-plugin
true
${pi.main.class}
jar-with-dependencies
make-my-jar-with-dependencies
package
single
org.apache.maven.plugins
maven-antrun-plugin
1.8
install
run
org.apache.ant
ant-jsch
1.9.6