Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8941779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:22:40+00:00 2026-06-15T11:22:40+00:00

Here is my ANT JUnit target <target name=test depends=compile > <junit failureProperty=test.failure > <jvmarg

  • 0

Here is my ANT JUnit target

<target name="test" depends="compile" >
    <junit failureProperty="test.failure" >

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

        <classpath>
            <pathelement path="${basedir}\..\Core\lib\junit-4.10.jar"/>
            <pathelement path="${basedir}\..\Suggestion\lib\ssce.jar"/>
            <pathelement path="C:\Java\javamail-1.4.1\mail.jar"/>
            <pathelement path="C:\Java\commons-net-2.0\commons-net-ftp-2.0.jar"/>
            <pathelement path="${basedir}\WebContent\WEB-INF\lib\gson-2.2.1.jar"/>
            <pathelement path="${tomcatLibs}\servlet-api.jar"/>
        </classpath>
        <classpath>
            <pathelement path="${build}"/>
        </classpath>
        <formatter type="brief" usefile="false" />          
        <test name="com.server.junit.ServerTestSuite" />
        <test name="com.junit.DictionaryTestSuite" />   
        <test name="com.util.junit.SuggestionTestSuite" />              
    </junit>

    <fail message="Unit test failed" if="test.failure"/>
</target>

My unit tests pass fine if run through Eclipse but fail if I laund them from ANT.
I want it to stop at my break point in a Unit test.
From documentation I know I need to add these jvmarg but can’t get it to stop so I obviously don’t have them in the right place.
Also, I don’t think I have the port correct but what port should I use? I didn’t have to set up any debug port when debugging JUnits through eclipse, it just worked

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:22:41+00:00Added an answer on June 15, 2026 at 11:22 am

    You need to forget a moment that you can run JUnit tests and ANT targets from within Eclipse. What you want is to debug a Java application that happens to have the main class org.apache.tools.ant.Main and which can be started with ant from the command line.

    You have now two options: You can create a launch config that invokes org.apache.tools.ant.Main but that’s pretty complicated to set up (you will have to replicate everything that the ant script does at startup).

    The other alternative is to configure ant correctly. In your case, the tests run within the ant process but I know no simple way to pass -Xdebug to Ant itself. Therefore, you must run the tests in a new process. Add this to the junit task:

    <junit fork="yes" forkmode="once" ...>
    

    Without this, jvmarg parameters will be ignored.

    The next step is to create a debug configuration in Eclipse. This article explains this in detail. For you, only the last part right before “Conclusion” is important.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run Junit test from my ant build.xml file. I read here
I'm trying to compile a Flex application in Ant (no problems here, I can
I try to run JUNIT test with eclipse and ANT they both are complainen
Here's the situation: I trying to make a ant test script that does the
Here is my ant apply task: <apply executable=${7z.exec} failonerror=true> <arg value=x/> <fileset dir=${distdir}> <include
Using Ant 1.8.0 <target name=main> <delete includeEmptyDirs=true> <fileset dir=target/xxx/WEB-INF/lib casesensitive=yes> <filename name=junit-*.jar/> <filename name=gin-*.jar/>
Firstly, the bash script works fine when I call it outside of ant. Here
I just used MyEclipse to automatically generate some JUnit test cases. One of the
Another classic ant junit problem. Like the other questions I found on the topic,
I found a strange behaviour in an ant build of a git repository. Here's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.