Ant: how do I disable all non-error messages? - command-line

When running ant from command line on my Netbeans projects, I get the following messages hundreds of times, which is very annoying:
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:javac
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:depend
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/1:nbjpdastart
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/3:debug
Trying to override old definition of task http://www.netbeans.org/ns/j2se-project/1:java
Depending of the kind of the project, there can be much more of such lines.
And this is with the -q or -quiet option.
Any idea, how to disable this message?
Thank you!

A bit of a hack, but if you are on a unix like system, perhaps do:
alias ant="ant | grep -v 'Trying to override old definition of task'"

Related

Run task's "problemMatcher" on console/terminal output

Is there a way to run a problem matcher on output programmatically? I'd make a certain command (compile files to DB) and then runnnig problem matcher on recevied console/terminal output, as an extension command.
I could expose a task with custom problem matcher If I could reach command from task. (feature-request #11396)
Is there maybe some other way to pass "non-shell" commands through problem matcher in extension? Or maybe run a task inside extension?
Anything that would make it work... :)

"scala" command terminates batch scripts

during my work here I collided with a somewhat peculiar problem. It's possible that there is a highly simple explanation for this behaviour, but to me it just doesn't make much sense.
Here's the situation:
I wrote a batch file "test.bat" that, right now, looks like this:
echo 1
scala myProgram
echo 2
When I open the command prompt in the according directory and run test.bat, it starts by echoing 1, then runs myProgram (which also has certain outputs that appear in the console, so the scala program myProgram works properly) - and then stops. 2 does not appear in the console and the console waits for me to input another command.
Why this behaviour? Is is a malfunction of the console? Or of the scala command? Or not a malfunction at all and it is actually meant to behave that way?
What I was actually trying to do is redirecting the output of "scala myProgram" to a file (which works well) and rename this file after the scala program has terminated, so my batch file originally looked somewhat like this:
scala myProgram > log.txt 2>&1
ren "log.txt" "log2.txt"
And I was confused about the fact that "log2.txt" was never created.
Your answers are greatly appreciated, thank you.
Adding -nc to scala command worked for me:
$ scala -nc /tmp/2.scala
Hello world
So I guess, the issue has something to do with the compilation daemon
-nc no compilation daemon: do not use the fsc offline compiler
Could you try that?

ant: command not found

I am having some trouble running ant. Here is a simplified verison of my problem. I have a shell script script1.sh:
export ANT_HOME=/opt/Ant
ant -version
This works. but when I try create another script script2:
cd /location/of/script1
sudo -E ./script1.sh | tee log.txt
I get the error ant: command not found. Does anyone know why this is happening.
Sounds like you're losing your PATH setting after sudo. Try adding echo $PATH in script1.sh to see the before and after values. Or just define script1.sh as
export ANT_HOME=/opt/Ant
${ANT_HOME}/ant -version
Without knowing what shell, or seeing more of the scripts it's hard to tell exactly what is happening. But if you want script2 to know about ANT_HOME you're probably going to need to source or eval script1. See here. Also I know pipes '|' cause Bash to perform operations within sub-shells which can be problematic under certain circumstances (if you're using Bash).
EDIT:
Double check that you are using the version of ant that you think you are:
#!/bin/bash
# Capital A here seems suspicious to me...
export ANT_HOME=/opt/Ant
echo "`${ANT_HOME}/ant -version`"

Fitnesse command line fixture

Does anyone have/"run into" a Fitnesse a Windows commnand line fixutre? I need to run executables then run my test suites and would appreciate if someone has such a fixture laying around.
Basically, what I am trying to do is the following:
|CommandlineFixture|
|C:\dev\myFileImporter.exe -f c:\dev\data\file.txt|
If you're using Fit, you can try Bob Martin's CommandLineFixture. You can use it by creating a simple test table as follows:
| com.objectmentor.fixtures.CommandLineFixture |
| command | C:\dev\myFileImporter.exe -f c:\dev\data\file.txt |
It also has some nice functionality like being able to search stderr/stdout for certain messages, wait for forked processes to finish, etc.
It's written in Java, and source code is available in case you have to customize it (when I used this, I customized it fairly heavily to add new functionality).

How can I run Perl test suite automatically when files change?

Is there a tool that would watch file changes in a directory tree of a Perl application and re-run the test suite every time I save changes to some module? Something akin to masak’s tote.
Have a look at Test::Continuous
Some Test::Continuous links:
Video presentation with slides from YAPC::Asia 2008
Run continuous tests on remote host
Github repo
The old school unix solution would be to write up a Makefile and trigger it regularly through a cron job (as frequently as once a minute), and have it mail you the results if something broke.
Alternatively if you use a revision control system such as svn, you could use a commit hook to kick off a build/test cycle when you commit a file.
One other thing you could do is write a wrapper script around your editor (such that when you close or save a file, the build/test cycle is triggered).
Win32::FileNotify can help with monitoring changes to the file system if you are on Windows.
The basic way to do this is through source control and an continuous integration package, say, like Smolder. When you check in files, the CI server notices the changes and runs the test suite for you.
Many CI products collect cross-run information for you and can show you trends in your tests, test cover, and so on.
Ironically I just ported stakeout.rb to PHP this week.
http://joshribakoff.com/?p=106
I don't know of any generic filesystem monitoring widget, but here's the Perl specific half.
sub run_tests {
my $prove_out = `prove -lr`;
my $tests_passed = $? == 0;
return "" if $tests_passed;
return $prove_out;
}
This uses the prove utility that comes with Test::Harness 3. It exits non-zero on test failure. Plug that into your filesystem monitoring thing and you're set.
I haven't managed to get Test::Continuous installed successfully on Windows, I use the following script, and it works pretty well for me:
use File::ChangeNotify;
$| = 1;
my $watcher = File::ChangeNotify->instantiate_watcher(
directories => [ 't', 'lib' ],
filter => qr/\.t|\.pl|\.pm/,
);
while (my #events = $watcher->wait_for_events) {
print `prove -l -r -t --timer`;
}