Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem developing on a remote PC #78

Open
qzic opened this issue Feb 18, 2025 · 9 comments
Open

Problem developing on a remote PC #78

qzic opened this issue Feb 18, 2025 · 9 comments

Comments

@qzic
Copy link

qzic commented Feb 18, 2025

I'm trying to run the pi4j archetype on a raspberry 5.0 from Windows 10 with Netbeans 24. I have set up the raspberry.properties and can run/debug it.

The problem is it runs on my local machine not on the raspberry.
I changed the first statement in main to
console.box("Hello Rasbian world ! OS = " + System.getProperty("os.name")); I also commented out the code following this statement because it just caused a crash (because its running on the wrong platform).
`
to figure out what was going on.

running with maven -X this is the final part of the output

env: __COMPAT_LAYER=RunAsAdmin
Toolchains are ignored, 'executable' parameter is set to C:\Program Files\Java\zulu11.76.21-ca-jdk11.0.25-win_x64\zulu11.76.21-ca-jdk11.0.25-win_x64\bin\java.exe
Executing command line: [C:\Program Files\Java\zulu11.76.21-ca-jdk11.0.25-win_x64\zulu11.76.21-ca-jdk11.0.25-win_x64\bin\java.exe, -classpath, C:\Users\Quentin\Documents\NetBeansProjects\mavenproject1\target\classes;C:\Users\Quentin\.m2\repository\org\slf4j\slf4j-api\1.7.32\slf4j-api-1.7.32.jar;C:\Users\Quentin\.m2\repository\org\slf4j\slf4j-simple\1.7.32\slf4j-simple-1.7.32.jar;C:\Users\Quentin\.m2\repository\com\pi4j\pi4j-core\2.4.0\pi4j-core-2.4.0.jar;C:\Users\Quentin\.m2\repository\com\pi4j\pi4j-plugin-raspberrypi\2.4.0\pi4j-plugin-raspberrypi-2.4.0.jar;C:\Users\Quentin\.m2\repository\com\pi4j\pi4j-plugin-pigpio\2.4.0\pi4j-plugin-pigpio-2.4.0.jar;C:\Users\Quentin\.m2\repository\com\pi4j\pi4j-library-pigpio\2.4.0\pi4j-library-pigpio-2.4.0.jar, com.pi4j.mavenproject1.Main]
15:07:12 [main] INFO com.pi4j.util.Console - --------------------------------------------
15:07:12 [main] INFO com.pi4j.util.Console - |  Hello Rasbian world !  OS = Windows 10  |
15:07:12 [main] INFO com.pi4j.util.Console - --------------------------------------------
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time:  1.981 s
Finished at: 2025-02-18T15:07:12-05:00
@qzic
Copy link
Author

qzic commented Feb 18, 2025

Sorry for the noise. I solved it. It was my misunderstanding of how to run a custom goal in Netbeans.

@qzic qzic closed this as completed Feb 18, 2025
@FDelporte
Copy link
Member

@qzic thanks for solving and closing :-)
Is there something you learned from this that we should add to pi4j.com as documentation to help others using Netbeans?

@qzic qzic reopened this Feb 19, 2025
@qzic
Copy link
Author

qzic commented Feb 19, 2025

Well I'm quite new to maven, have been using ant in netbeans for years. After setting up the two custom actions. I could find the Custom entry in the Project rt-click menu. Then I found Run Maven and it had the two custom entries remote run and remote debug.

I have reopened the issue because although remote run works, remote debug does not.
Here is the final error output after running remote debug

--- antrun:3.0.0:run (debug) @ mavenproject1 ---
Executing tasks
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  3.075 s
Finished at: 2025-02-19T10:18:17-05:00
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.0.0:run (debug) on project mavenproject1: An Ant BuildException has occured: The following error occurred while executing this line:
C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1\antrun\build.xml:191: Can't assign value '${remote.platform.port}' to attribute port, reason: class java.lang.NumberFormatException with message 'For input string: "${remote.platform.port}"'
around Ant part ...<ant antfile="antrun/build.xml" target="debug-remote" />... @ 9:61 in C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1\target\antrun\build-main.xml
-> [Help 1]

It seems remote.platform.port has not been defined for/in the build.xml

@qzic
Copy link
Author

qzic commented Feb 19, 2025

I made a little progress (might be the wrong path??)
Added the following lines to build.xml since it appears it was not able to resolve these properties

        <property name="remote.platform.host" value="192.168.1.168"/>
        <property name="remote.platform.port" value="22"/>
        <property name="remote.platform.username" value="pi"/>
        <property name="remote.platform.keyfile" value="C:/Users/Quentin/.ssh/id_ecdsa"/>
        <property name="remote.platform.passphrase" value=""/>

I hadn't noticed this line so I updated it with my Netbeans defined remote platform

    '<fail unless="target.platform.name">RPi-5-1</fail>'

Now there are no errors but with a breakpoint set on the "Hello Rasbian" statement in Main.java this is the output

--- antrun:3.0.0:run (debug) @ mavenproject1 ---
Executing tasks
[sshsession] Connecting to 192.168.1.168:22
  [sshexec] Connecting to 192.168.1.168:22
  [sshexec] cmd : cd '/home/pi/NetBeansProjects/mavenproject1';  '/usr/lib/jvm/default-java/bin/java'  -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=192.168.1.168:1955 -Dfile.encoding=UTF-8  -p /home/pi/NetBeansProjects/mavenproject1/dist/lib -m com.pi4j.mavenproject1/com.pi4j.mavenproject1.Main 
Listening for transport dt_socket at address: 1955

So it seems to be running but not hitting the break point. Is "Listening for transport dt_socket at address: 1955
" coming from the jvm or netbeans. I suspect JVM and Netbeans debugging has not been started

When I try the Netbeans Debug button with this this project set as main project, here is what I see:

JPDA Listening Start...
JPDA Address: 127.0.0.1:58867
Port:58867
cd C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1; "JAVA_HOME=C:\\Program Files\\Java\\zulu17.54.21-ca-jdk17.0.13-win_x64\\zulu17.54.21-ca-jdk17.0.13-win_x64" cmd /c "\"C:\\Program Files\\NetBeans-24\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dexec.vmArgs=-agentlib:jdwp=transport=dt_socket,server=n,address=58867 \"-Dexec.args=${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}\" -Dexec.appArgs= -Dexec.mainClass=com.pi4j.mavenproject1.Main \"-Dexec.executable=C:\\Program Files\\Java\\zulu17.54.21-ca-jdk17.0.13-win_x64\\zulu17.54.21-ca-jdk17.0.13-win_x64\\bin\\java.exe\" -Djpda.listen=true -DskipTests=true -Djpda.address=58867 \"-Dmaven.ext.class.path=C:\\Program Files\\NetBeans-24\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -DskipTests=true process-classes org.codehaus.mojo:exec-maven-plugin:3.1.0:exec"
Scanning for projects...

-----------------------< com.pi4j:mavenproject1 >-----------------------
Building Raspi Project 1.0
  from pom.xml
--------------------------------[ jar ]---------------------------------

--- resources:3.3.1:resources (default-resources) @ mavenproject1 ---
Copying 1 resource from src\main\resources to target\classes

--- compiler:3.8.1:compile (default-compile) @ mavenproject1 ---
Nothing to compile - all classes are up to date

--- antrun:3.0.0:run (setMavenJarPluginOutputDir) @ mavenproject1 ---
Executing tasks
Executed tasks

Also the debug toolbar shows up with the red debug stop button etc.
I think the problem is that running the custom remote debug from the Project context menu isn't starting Netbeans debug mode because I don't see the debug toolbar unless I click the debug button.

@qzic
Copy link
Author

qzic commented Feb 19, 2025

I noticed that Remote Run and Remote Debug show up in the Netbeans action list for the project. So I copied the execute goals to Run and Debug which are activated from the main Run Debug buttons. I removed everything in the properties for Run and Debug except jpda.listen=true for Debug. Both buttons work and after clicking Debug, the Debug toolbar appears.
In raspberry.properties I set target.debug.port=${jpda.address} since the port is randomly chosen by netbeans when running in debug.
After clicking Debug I see JPDA starting in the output but the result is the same as previously. Seems to hang waiting for the debugger to attach. See below

Note that the 1st chunk of output "cd ..." references the jvm on my local windows??? Later we see it downloaded and running on the raspberry.

JPDA Listening Start...
JPDA Address: 127.0.0.1:50939
Port:50939
cd C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1; "JAVA_HOME=C:\\Program Files\\Java\\zulu17.54.21-ca-jdk17.0.13-win_x64\\zulu17.54.21-ca-jdk17.0.13-win_x64" cmd /c "\"C:\\Program Files\\NetBeans-24\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Djpda.listen=true -DskipTests=true -Dexec.vmArgs= -Dexec.appArgs= -Djpda.address=50939 \"-Dmaven.ext.class.path=C:\\Program Files\\NetBeans-24\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -DskipTests=true install antrun:run@debug"
Scanning for projects...

-----------------------< com.pi4j:mavenproject1 >-----------------------
Building Raspi Project 1.0
  from pom.xml
--------------------------------[ jar ]---------------------------------

--- resources:3.3.1:resources (default-resources) @ mavenproject1 ---
Copying 1 resource from src\main\resources to target\classes

--- compiler:3.8.1:compile (default-compile) @ mavenproject1 ---
Nothing to compile - all classes are up to date

--- antrun:3.0.0:run (setMavenJarPluginOutputDir) @ mavenproject1 ---
Executing tasks
Executed tasks

--- resources:3.3.1:testResources (default-testResources) @ mavenproject1 ---
skip non existing resourceDirectory C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1\src\test\resources

--- compiler:3.8.1:testCompile (default-testCompile) @ mavenproject1 ---
Nothing to compile - all classes are up to date

--- surefire:3.2.5:test (default-test) @ mavenproject1 ---
Tests are skipped.

--- dependency:3.1.2:copy-dependencies (copy-dependencies) @ mavenproject1 ---
org.slf4j:slf4j-api:jar:1.7.32 already exists in destination.
org.slf4j:slf4j-simple:jar:1.7.32 already exists in destination.
com.pi4j:pi4j-core:jar:2.4.0 already exists in destination.
com.pi4j:pi4j-plugin-raspberrypi:jar:2.4.0 already exists in destination.
com.pi4j:pi4j-plugin-pigpio:jar:2.4.0 already exists in destination.
com.pi4j:pi4j-library-pigpio:jar:2.4.0 already exists in destination.

--- jar:3.2.0:jar (default-jar) @ mavenproject1 ---

--- install:3.1.2:install (default-install) @ mavenproject1 ---
Installing C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1\pom.xml to C:\Users\Quentin\.m2\repository\com\pi4j\mavenproject1\1.0\mavenproject1-1.0.pom
Installing C:\Users\Quentin\Documents\NetBeansProjects\MAVEN\mavenproject1\target\lib\mavenproject1.jar to C:\Users\Quentin\.m2\repository\com\pi4j\mavenproject1\1.0\mavenproject1-1.0.jar

--- antrun:3.0.0:run (build) @ mavenproject1 ---
Executing tasks
  [sshexec] Connecting to 192.168.1.168:22
  [sshexec] cmd : mkdir -p '/home/pi/NetBeansProjects/mavenproject1/dist'
      [scp] Connecting to 192.168.1.168:22
      [scp] done.
Executed tasks

--- antrun:3.0.0:run (debug) @ mavenproject1 ---
Executing tasks
[sshsession] Connecting to 192.168.1.168:22
  [sshexec] Connecting to 192.168.1.168:22
  [sshexec] cmd : cd '/home/pi/NetBeansProjects/mavenproject1';  '/usr/lib/jvm/default-java/bin/java'  -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=192.168.1.168:50939 -Dfile.encoding=UTF-8  -p /home/pi/NetBeansProjects/mavenproject1/dist/lib -m com.pi4j.mavenproject1/com.pi4j.mavenproject1.Main 
Listening for transport dt_socket at address: 50939

@qzic
Copy link
Author

qzic commented Feb 20, 2025

Duh! So I see that platform line in build.xml should be raspberry
and then I don't need to define all those properties for remote run. BUT, I still need them for remote debug ??

@qzic
Copy link
Author

qzic commented Feb 20, 2025

I have messed around with build.xml and I found I had to correct the <target name="-debug-remote-key" .... section because it was not using the some variables defined in raspberry.properties. Despite this I have the same result with it hanging

Final output on remote debug (remote run is fine)

--- antrun:3.0.0:run (debug) @ mavenproject1 ---
Executing tasks
[sshsession] Connecting to 192.168.1.168:22
  [sshexec] Connecting to 192.168.1.168:22
  [sshexec] cmd : cd '/home/pi/NetBeansProjects/mavenproject1';  '/usr/lib/jvm/default-java/bin/java'  -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=192.168.1.168:59548 -Dfile.encoding=UTF-8  -p /home/pi/NetBeansProjects/mavenproject1/dist/lib -m com.pi4j.mavenproject1/com.pi4j.mavenproject1.Main 
Listening for transport dt_socket at address: 59548

Here is the current build.xml which resolves all variables when running remote debug


<?xml version="1.0" encoding="UTF-8"?>
<project name="RemotePlatform" default="default" basedir=".." xmlns:remote="http://www.netbeans.org/ns/j2se-project/remote-platform/1" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3">
    <description></description>
    <target name="default">
        <echo message="Default target is not set, you must specify which target you want to run."/>
    </target>

    <target name="-init">
        <property name="remote.run.jvmargs" value=""/>
        <property name="remote.debug.jvmargs" value=""/>
        <property name="remote.debug.suspend" value="y"/>
        <property name="remote.application.args" value=""/>
        
        <fail unless="target.platform.name">raspberry</fail>
        <property name="target.platform.filename" value="./platform/${target.platform.name}.properties"/>
        <property file="${target.platform.filename}"/>
        <fail unless="target.platform.host">'target.platform.host' property is missing in ${target.platform.filename}.</fail>
        <fail unless="target.platform.port">'target.platform.port' property is missing in ${target.platform.filename}.</fail>
        <fail unless="target.platform.username">'target.platform.username' property is missing in ${target.platform.filename}.</fail>
        <condition property="remote.platform.auth.passwd">
            <isset property="target.platform.password"/>
        </condition>
        <condition property="remote.platform.auth.key">
            <and>
                <not>
                    <isset property="remote.platform.auth.passwd"/>
                </not>
                <isset property="target.platform.privatekey"/>
                <isset property="target.platform.passphrase"/>
            </and>
        </condition>
        <condition property="auth.ok">
            <or>
                <isset property="remote.platform.auth.passwd"/>
                <isset property="remote.platform.auth.key"/>
            </or>
        </condition>
        <condition property="run.mode" value="sudo">
            <equals arg1="${target.run.as.root}" arg2="true" casesensitive="" />
        </condition>
        <property name="run.mode" value=""/>
        <fail unless="auth.ok">Either 'target.platform.password' or 'target.platform.privatekey' + 'target.platform.passphrase' properties must be set in ${target.platform.filename}.</fail>
        <fail unless="target.remote.jre">'target.remote.jre' property is missing in ${target.platform.filename}.</fail>
        <fail unless="target.remote.home">'target.remote.home' property is missing in ${target.platform.filename}.</fail>
        <!--basename file="${dist.jar}" property="dist.jar.name"/-->
        <basename file="${basedir}" property="remote.project.name"/>
        <property name="remote.project.dir" value="${target.remote.home}/${remote.project.name}"/>
        <property name="remote.dist.dir" value="${remote.project.dir}/dist"/>
        <property name="remote.java.executable" value="${target.remote.jre}/bin/java"/>    
        <property name="remote.dist.jar" value="${remote.dist.dir}/${dist.jar.name}.${project.packaging}"/>
        <property name="local.dist.jar" value="${local.dist.dir}/${dist.jar.name}.${project.packaging}"/>
        <property name="remote.dist.fatjar" value="${remote.dist.dir}/${dist.jar.name}-jar-with-dependencies.${project.packaging}"/>
        <property name="local.dist.fatjar" value="${local.dist.dir}/${dist.jar.name}-jar-with-dependencies.${project.packaging}"/>

        <fail message="The 'target.run.module.class' property must be set in ${target.platform.filename} if 'run.with.java.module'=true in the 'pom.xml'.">
            <condition>
                <and>
                    <equals arg1="${target.run.as.module}" arg2="true" casesensitive="" />
                    <not>
                        <isset property="target.run.module.class"/>
                    </not>
                </and>
            </condition>
        </fail>

        <condition property="project.run.cmd" value="-p ${remote.dist.dir}/lib -m ${target.run.module.class}" else="-jar ${remote.dist.jar}">
            <equals arg1="${target.run.as.module}" arg2="true" casesensitive="" />
        </condition>
    </target>

    <target name="-check-fatjar" depends="-init">
        <available file="${local.dist.fatjar}" property="fatjar.exist"/>
    </target>
    
    <target name="-rename-fatjar" depends="-check-fatjar" if="fatjar.exist">
        <move file="${local.dist.fatjar}" tofile="${local.dist.jar}"/>
    </target>
    
    <target name="-declare-macros" depends="-rename-fatjar">
        <macrodef name="cleanwithpasswd" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1">
            <sequential>
                <sshexec host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" 
                         password="${target.platform.password}" trust="true" 
                         command="cd '${remote.dist.dir}'; rm -rf *.jar lib/*.jar"/>
            </sequential>
        </macrodef>
        <macrodef name="cleanwithkey" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1">
            <sequential>
                <sshexec host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}"
                         keyfile="${target.platform.privatekey}" passphrase="${target.platform.passphrase}" trust="true" 
                         command="cd '${remote.dist.dir}'; rm -rf *.jar lib/*.jar"/>
            </sequential>
        </macrodef>
        <macrodef name="copywithpasswd" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1">
            <attribute name="additionaljvmargs" default=""/>
            <sequential>
                <sshexec host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" password="${target.platform.password}" trust="true" command="mkdir -p '${remote.dist.dir}'"/>
                <scp todir="${target.platform.username}@${target.platform.host}:${remote.dist.dir}" port="${target.platform.port}" password="${target.platform.password}" trust="true">
                    <fileset dir="${local.dist.dir}">
                        <include name="*.${project.packaging}"/>
                        <include name="lib/*.${project.packaging}"/>
                    </fileset>
                </scp>
            </sequential>
        </macrodef>
        <macrodef name="copywithkey" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1">
            <attribute name="additionaljvmargs" default=""/>
            <sequential>
                <sshexec host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" keyfile="${target.platform.privatekey}" passphrase="${target.platform.passphrase}" trust="true" command="mkdir -p '${remote.dist.dir}'"/>
                <scp todir="${target.platform.username}@${target.platform.host}:${remote.dist.dir}" port="${target.platform.port}" keyfile="${target.platform.privatekey}" passphrase="${target.platform.passphrase}" trust="true">
                    <fileset dir="${local.dist.dir}">
                        <include name="*.${project.packaging}"/>
                        <include name="lib/*.${project.packaging}"/>
                    </fileset>
                </scp>
            </sequential>
        </macrodef>
        <macrodef name="runwithpasswd" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1">
            <attribute name="additionaljvmargs" default=""/>
            <sequential>
                <!--antcall target="profile-rp-calibrate-passwd"/-->
                <sshexec host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" password="${target.platform.password}" trust="true" usepty="true"
                         command="cd '${remote.project.dir}'; ${run.mode} '${remote.java.executable}' @{additionaljvmargs} -Dfile.encoding=${remote.runtime.encoding} ${remote.run.jvmargs} ${project.run.cmd} ${remote.application.args}"/>
            </sequential>
        </macrodef>
        <macrodef name="runwithkey" uri="http://www.netbeans.org/ns/j2se-project/remote-platform/1">
            <attribute name="additionaljvmargs" default=""/>
            <sequential>
                <!--antcall target="profile-rp-calibrate-key"/-->
                <sshexec host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" keyfile="${target.platform.privatekey}" passphrase="${target.platform.passphrase}" trust="true" usepty="true"
                         command="cd '${remote.project.dir}'; ${run.mode} '${remote.java.executable}' @{additionaljvmargs} -Dfile.encoding=${remote.runtime.encoding} ${remote.run.jvmargs} ${project.run.cmd} ${remote.application.args}"/>
            </sequential>
        </macrodef>
    </target>
        
    <target name="-ask-password" unless="target.platform.password" if="remote.platform.auth.passwd">
        <input message="Password ${target.platform.user}@${target.platform.host}:" addproperty="target.platform.password">
            <handler type="secure"/>
        </input>
    </target>

    <target name="-ask-passphrase" unless="target.platform.passphrase" if="remote.platform.auth.key">
        <input message="Passphrase ${target.platform.user}@${target.platform.host}:" addproperty="target.platform.passphrase">
            <handler type="secure"/>
        </input>
    </target>

    <target name="-check-vm-debug" depends="-init">
        <condition property="remote.debug.available" value="true">
            <or>
                <istrue value="${target.debug.supported}"/>
            </or>
        </condition>
        <fail unless="remote.debug.available" message="The Runtime JVM ${target.platform.host} does not support debugging."/>
    </target>

    <target name="-copy-remote-passwd" depends="-init, -declare-macros, -ask-password" if="remote.platform.auth.passwd">
        <remote:copywithpasswd/>
    </target>
        
    <target name="-copy-remote-key" depends="-init, -declare-macros, -ask-passphrase" if="remote.platform.auth.key">
        <remote:copywithkey/>
    </target>

    <target name="-run-remote-passwd" depends="-init, -declare-macros, -ask-password, -copy-remote-passwd" if="remote.platform.auth.passwd">
        <remote:runwithpasswd/>
    </target>
        
    <target name="-run-remote-key" depends="-init, -declare-macros, -ask-passphrase, -copy-remote-key" if="remote.platform.auth.key">
        <remote:runwithkey/>
    </target>

    <target name="-clean-remote-passwd" depends="-init, -declare-macros, -ask-password" if="remote.platform.auth.passwd">
        <remote:cleanwithpasswd/>
    </target>
        
    <target name="-clean-remote-key" depends="-init, -declare-macros, -ask-passphrase" if="remote.platform.auth.key">
        <remote:cleanwithkey/>
    </target>

    <target name="-debug-remote-passwd" depends="-init, -declare-macros, -ask-password" if="remote.platform.auth.passwd">
        <sshsession host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" password="${target.platform.password}" trust="true">
            <remotetunnel lport="${target.debug.port}" lhost="localhost" rport="${target.debug.port}"/>
            <sequential>
                <remote:runwithpasswd additionaljvmargs="${remote.debug.jvmargs} -agentlib:jdwp=transport=dt_socket,server=y,suspend=${remote.debug.suspend},address=${target.platform.host}:${target.debug.port}"/>
            </sequential>
        </sshsession>
    </target>

    <target name="-debug-remote-key" depends="-init, -declare-macros, -ask-passphrase" if="remote.platform.auth.key">
        <sshsession host="${target.platform.host}" port="${target.platform.port}" username="${target.platform.username}" keyfile="${target.platform.privatekey}" passphrase="${target.platform.passphrase}" trust="true">
            <remotetunnel lport="${target.debug.port}" lhost="localhost" rport="${target.debug.port}"/>
            <sequential>
                <remote:runwithkey additionaljvmargs="${remote.debug.jvmargs} -agentlib:jdwp=transport=dt_socket,server=y,suspend=${remote.debug.suspend},address=${target.platform.host}:${target.debug.port}"/>
            </sequential>
        </sshsession>
    </target>
    
    <target name="build-remote" depends="-copy-remote-passwd, -copy-remote-key">
        
    </target>
    
    <target name="run-remote" depends="-run-remote-passwd, -run-remote-key">
        
    </target>

    <target name="clean-remote" depends="-clean-remote-passwd, -clean-remote-key">
        
    </target>

    <target name="debug-remote" depends="-debug-remote-passwd, -debug-remote-key">
        
    </target>

</project>

@DieterHolz
Copy link
Contributor

Hi qzic,
here you can can find a complete setup for a Raspi project (including debugging):

https://gitlab.fhnw.ch/ip_12_preparation/hellopi5.git

It is used at our university. The README is in German. But with Google Translate you should be able to set up your laptop and the Raspberry Pi (a setup script for the RaspPi is also included).

Essentially it's a Maven project. The whole setup is in the pom.xml .

Even if IntelliJ IDEA is referenced, you don't need to use it. It should work fine with NetBeans as well.

Greetings from Switzerland
Dieter

@qzic
Copy link
Author

qzic commented Feb 20, 2025

I think the pi4j-maven-archetype needs to be updated with the previous build.xml file (which works as it should) plus a fix for debug.
I've never pulled a repo , done a fix etc. so I hope someone knowledgeable can do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants