Ant MailLogger problem - email

I'm trying to establish MailLogger as the principle logger for my ant build. When I launch the ant build, I add the parameters -DMailLogger.properties.file=mail.properties -logger org.apache.tools.ant.listener.MailLogger. When the build finishes, it first tells me it couldn't send the e-mail and then it spits out the call stack:
BUILD SUCCESSFUL
Total time: 1 second
MailLogger failed to send e-mail!
java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.email.MimeMailer.send(MimeMailer.java:206)
at org.apache.tools.ant.listener.MailLogger.sendMimeMail(MailLogger.java:332)
at org.apache.tools.ant.listener.MailLogger.buildFinished(MailLogger.java:143)
at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2037)
at org.apache.tools.ant.Main.runBuild(Main.java:778)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
If I attempt the same thing without MailLogger.user and MailLogger.password set in mail.properties, it informs me that I wasn't authenticated (and correctly so).
I've included ant-javamail.jar which contains MimeMailer.class and as far as I can tell it's in the classpath along with all the other jars for ant. Perhaps I'm doing something wrong, but NullPointerException is certainly not helping me understand what it is.
I'm using Ant version 1.7.1. Any help would be greatly appreciated! I'm tearing my hair out!

It's an Ant bug - 44999. Looks like it's fixed in Ant 1.8.

Related

Azure build failing due to Method not found: 'System.ReadOnlySpan`1<Char> Microsoft.IO.Path.GetFileName(System.ReadOnlySpan`1<Char>)

Ugh....Microsoft have done something.
All our builds that have been kicked off in the last few hours (approx 10:00 GMT) are failing on our "Build Solution step" failing because of the following error (from the logs):
##[error]EXEC(0,0): Error : Error occurred during processing of input file 'XXX.XXX.dll' --> Method not found: 'System.ReadOnlySpan1 Microsoft.IO.Path.GetFileName(System.ReadOnlySpan1<Char>)'.
Does anyone have any ideas on this? Nothing in our codebase has changed.
If you need more information please let me know. Thanks
FYI, this seems to be caused by a recent update to MSBuild (https://github.com/dotnet/msbuild/pull/7680) that has updated the version of System.Memory.
It looks like the obfuscation tool you're using in your build pipeline is built against a previous version of System.Memory and now that the version provided by the MSBuild environment has changed, the obfuscation tool is broken. Most likely requires the obfuscation tool to be updated.
(PS. I'm just relaying the information that others have identified where other tools are having the same issue - see https://github.com/T4MVC/R4MVC/issues/172)

Testng - Ant - windows terminal how to deal with errant input

I have a java selenium QA project where we use ant and testng via the powershell terminal. What I would like help with is creating a redirect if a tester enters a typo in the terminal.
If I am in the run directory and I simply type ant, it will run the default.xml file listed in the build.xml file which is what I expect.
If I enter an actual ant command with a typo though:
ant -Dtestdir= c:\dev\qa\src\tests -Dtestxml=blablabla
it will attempt to run every test.xml file in the test directory. This is especially problematic because most of the those test.xml files call java classes that contain #Factory and #Dataprovider(s) and they allocate everything at once which just causes everything to fail.
What I would like is a way to tell ant if the input is erroneous, then run the default.xml file(which I have configured to populate an html error page). I've been reviewing both testng and ant docs and I'm not finding a solution, so your guidance would be appreciated.
Other than this one issue, the system works very well.
After digging around a bit more and learning how to ask the question properly, I found 2 great examples here on SO.
1) Create an additional ant target that checks for the existence of the file the user has typed. And add it to the depends attribute of the main target , and also adding the if attribute.
Example
2) Use the Ant fail task and fail the build (with a message) if the file is not available. I prefer this one because the tester can get some feedback.
Example 2

Makegood in Eclipse says "The main script is not found"

I googled this unexpected error message and there not a single result.
I am using Eclipse Helios (3.6) with Makegood plugin to run PHPUnit test.
PHPUnit is working just fine.
I can also use Makegood to one test class.
But when I run all test, Makegood refuse to do it and display
'Launching <currentfilename>' has encountered a problem.
The main script is not found.
Looks like there are some internal issue with Makegood. I just don t know how to get started debugging this. Is this a eclipse or makegood error message? What does it mean ? Is there any log or debug mode I could use to understand what s happen ?
Recently, I've encountered this problem when executing the Run All Test command. Then the project has no PHP script under the specified test folders. Since the Xdebug implementation of PDT requires a PHP file, test cannot be run in such state.
To prevent this, MakeGood checks whether the project has at least a PHP file under the specified test folders, and skips a test run if the project has no PHP scripts. But even so this error is raised by any reason...
I created a issue http://redmine.piece-framework.com/issues/310 to fix this problem.
Thank you for using MakeGood.

FxCop Nant Task Error: Error creating FileSet

I am getting following error whenever I run fxcop nant task.
Error creating FileSet.
Does anybody know what could be the reason?
Thanks,
Sachin
I got the reason behind the issue. Recently I had downloaded Binary Zip of latest NantContrib project. After downloading the zip, I extracted it without unblocking. As I am using Windows Server 2008, all assemblies extracted from the zip were blocked. The FxCop nant task is defined in NAnt.Contrib.Tasks.dll(which was locked). FxCop task needs IO permission to save report on the machine. Since the file were blocked, fxcop task was throwing exception due to lack of IO permissions.
To resolve this, I just unblocked the zip and re-extracted the NantContrib files. Thereafter everything worked fine.
Thanks Soner!!! Sorry about not being so specific :)
Thanks,
Sachin P

GWT Compilation

I am facing problem while GWT compilation. I am using ANT build file in which i run 'build' target. when execution comes to 'gwtc' target the compilation sometimes stop or somtime it compiles successfully. Can anyone please tell me what i am doing wrong ?
I am using GWT2.0
HELLO zeeshan Brother
I got the answer!!!
1] Remove unused import from project
2] Don't Use server side object on client side
That's it
Your problem 100% Solve
I have used a GWT's app creator. Which solves problem. Thanks