Not so much a programming question but I figured I'd ask anyway.
How do I make it so ant doesn't require that all the junit tests pass before building? In netbeans I can build the project without it testing first. However, when I run ant, it makes sure all my junit tests pass first. I am running ant from the command line in my netbeans project directory. Which files do I need to modify to tell ant not to do that?
To add some detail, it looks like the ant script goes into the build.xml and build-impl.xml files to determine what to do. build-impl.xml says not to edit it and to edit build.xml instead. Build.xml doesn't have any options for junit testing though, so I'm wondering where to disable testing.
Please let me know.
Thanks, jbu
One of your Ant XML files should have a "junit" task in it; in your case, it sounds as if this task has the "haltonerror" attribute set to "on", which causes the build to halt if any of the JUnit tests fail. If you can't spot the junit directive immediately, it might be in an included file (look for "import" directives, usually near the top of the file).
You can set this attribute to "off" to change this behaviour, but I'd strongly advise against it; you want your unit tests to tell you when the code is broken. If any of the tests are going to be known failures due to changes in the code, it's better to fix the test before continuing with your code changes than to turn it off.
Depending on the exact project type, just run a target that does not include testing. For basic Java SE projects:
ant jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With