2014-11-26 2 views
0

Я компилирую коды и создаю банку своего настольного приложения. Но мне не удавалось отлаживать коды. Я хочу поставить контрольные точки и продолжать шаг за шагом, используя функции Eclipse F6 и F5. Есть какой-либо способ сделать это? Спасибо за вашу помощь? Мой муравей скрипт ниже:Как отлаживать приложение Java Desktop с помощью Ant Script?

<project name="R - 09 - tester"> 

<property name="app.name" value="Tester" /> 
<property name="app.version" value="2.0" /> 
<property name="dir.root" value="C:/.../trunk" /> 
<property name="dir.devel" value="${dir.root}/devel" /> 
<property name="dir.3rdparty" value="${dir.devel}/3rdparty" /> 
<property name="dir.deploy" value="${dir.root}/deploy" /> 
<property name="dir.binary" value="${dir.deploy}/bin" /> 
<property name="dir.class" value="${dir.deploy}/class" /> 


<property name="jar.xmlbeans" value="${dir.3rdparty}/xmlbeans/xbean.jar" /> 
<property name="jar.modelmesi" value="${dir.binary}/Model-Mesi-2.0.jar" /> 
<property name="jar.mesiapi" value="${dir.binary}/Mesi-API-2.0.jar" /> 
<property name="jar.mesimessages" value="${dir.binary}/Mesi-Messages-2.0.jar" /> 
<property name="jar.javaFX" value="${dir.3rdparty}/javafx/jfxrt.jar" /> 

<target name="init.property"> 
    <property name="manifest.created.by" value="..." /> 
    <property name="manifest.implementation.title" value="...." /> 
    <property name="manifest.implementation.vendor" value="..." /> 
    <property name="jar.mainclass" value="main.ApplicationMain" /> 
    <mkdir dir="${dir.class}" /> 
</target> 

<target name="init.application" depends="init.property"> 
    <mkdir dir="${dir.class}/${app.name}" /> 
    <echo message="(OUTPUT) Application JAR File Name: ${app.name}-${app.version}.jar" /> 

</target> 

<target name="clean.build" description="Clean Created Build Files" depends="init.property"> 
    <delete dir="${dir.class}/${app.name}" /> 
    <delete file="${dir.binary}/${app.name}-${app.version}.jar" /> 
</target> 

<target name="clean.all" description="Clean Created All Files" depends="clean.build"> 
    <delete dir="bin" /> 
    <delete dir=".codepro" /> 
    <delete dir=".sonar" /> 
</target> 

<target name="compile.application" depends="init.application"> 
    <!-- compile files on the src path --> 
    <copy file="src/SceneStyle.css" todir="${dir.class}/${app.name}"/> 
    <javac debug="true" srcdir="src" destdir="${dir.class}/${app.name}" debuglevel="lines,vars,source" includeantruntime="false"> 
     <classpath> 
      <pathelement location="${jar.xmlbeans}" /> 
      <pathelement location="${jar.mesiapi}" /> 
      <pathelement location="${jar.modelmesi}" /> 
      <pathelement location="${jar.mesimessages}" /> 
      <pathelement location="${jar.javaFX}" /> 
      <fileset dir="${dir.3rdparty}/jreport"> 
       <include name="**/*.jar"/> 
      </fileset> 
     </classpath> 
    </javac> 
</target> 

<target name="build" description="Build the Application" depends="compile.application"> 
    <tstamp /> 
    <!-- needed for TODAY --> 
    <manifestclasspath property="jar.classpaths" jarfile="${dir.binary}/${app.name}-${app.version}.jar"> 
     <classpath> 
      <pathelement location="${jar.xmlbeans}" /> 
      <pathelement location="${jar.mesiapi}" /> 
      <pathelement location="${jar.modelmesi}" /> 
      <pathelement location="${jar.mesimessages}" /> 
      <pathelement location="${jar.javaFX}" /> 
      <fileset dir="${dir.3rdparty}/jreport"> 
       <include name="**/*.jar" /> 
      </fileset> 
     </classpath> 
    </manifestclasspath> 

    <jar destfile="${dir.binary}/${app.name}-${app.version}.jar" basedir="${dir.class}/${app.name}"> 
     <manifest> 
      <attribute name="Created-By" value="${manifest.created.by}" /> 
      <attribute name="Built-By" value="${user.name}" /> 
      <attribute name="Built-Date" value="${TODAY}" /> 
      <attribute name="Main-Class" value="${jar.mainclass}" /> 
      <attribute name="Class-Path" value="${jar.classpaths}" /> 
      <attribute name="Implementation-Vendor" value="${manifest.implementation.vendor}" /> 
      <attribute name="Implementation-Title" value="${manifest.implementation.title}" /> 
      <attribute name="Implementation-Version" value="${app.version}-b${build.number}" /> 
     </manifest> 

    </jar> 
</target> 

<target name="rebuild" description="Rebuild the Application" depends="clean.build,build" /> 

<target name="run" description="Run the Application" depends="build"> 
    <java jar="${dir.binary}/${app.name}-${app.version}.jar"/> 

</target> 

ответ

0

Окончательное состояние antscript указано ниже:

<target name="compile"> 
    <javac srcdir="src" destdir="${dir.class}/${app.name}" debug="true" debuglevel="lines,vars,source" > 
     <classpath> 
      <pathelement location="..." /> 
     </classpath> 
    </javac> 
</target> 

<target name="debug" description="Debug the Application" depends="compile"> 
    <java jar="${dir.binary}/${app.name}-${app.version}.jar" fork="true"> 
     <jvmarg value="-Xdebug" /> 
     <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5555" /> 
    </java> 
</target> 
2

Вы должны включить удаленную отладку с помощью <java> тега.

<java ....> 
<jvmarg value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5555"/> 
</java> 

Теперь запустите свой скрипт для муравьев. Он запустит java-процесс и дождитесь, пока вы подключитесь к своему отладчику до porr 5555.

Если вы не хотите ждать изменения suspend=y - suspend=n.

+0

я исправил свою задачу выполнения, как показано ниже, и поставить точку останова, но Eclipse, не остановился в точке останова. GltknBtn

+0

ли Eclipse, подключиться к удаленному процессу или не удается подключиться? – AlexR

+0

Ошибка или информация, связанная с неудачей подключения или успехом. как я могу контролировать это соединение? – GltknBtn

Смежные вопросы