| Summary: | Ant 1.8.x reports build failed when optional jars are missing | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Martin Oberhuber <mober.at+eclipse> |
| Component: | Ant | Assignee: | Platform-Ant-Inbox <platform-ant-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, john.arthorne, kim.moir, Michael_Rennie, Mike_Wilson, remy.suen |
| Version: | 3.7 | Keywords: | Documentation, readme |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Probably caused by bug 302296? Most likely, yes. This change of behavior should probably be listed in the migration guide for 3.7. Apparently you need additional jars now to make the mail tasks work. Found on the Ant 1.8.2 user guide in the Library Dependencies section (http://ant.apache.org/manual/install.html#librarydependencies): mail.jar is required for the Mail task with Mime encoding, and the MimeMail task - can be found at: http://www.oracle.com/technetwork/java/index-jsp-139225.html activation.jar is required for the Mail task with Mime encoding, and the MimeMail task - can be found at http://www.oracle.com/technetwork/java/javase/jaf-135115.html The recommended course of action from Apache is to install all of the dependencies as described: http://ant.apache.org/manual/install.html#optionalTasks. I am not sure this is desired though as that will pull in all the dependencies for all of the optional tasks on that list - which looks like a lot of them. I think the best solution would be to provide all of the optional jars in org.apache.ant (in orbit) so that all of the functionality is maintained from the pre-1.8.x version of Ant. Although this could be problematic due to the different licenses for the optional jars. This definitely needs to be in the migration guide. A quick sum-up of our possible solutions: 1. An entry in the migration guide (required) 2. provide any optional jars in org.apache.ant to maintain pre-1.8.x functionality 3. roll an additional version of org.apache.ant that contains all of the optional Ant jars - similar to the mutli-version of JUnit, for example. Thoughts? > 1. An entry in the migration guide (required)
> 2. provide any optional jars in org.apache.ant to maintain pre-1.8.x
> functionality
> 3. roll an additional version of org.apache.ant that contains all of the
> optional Ant jars - similar to the mutli-version of JUnit, for example.
>
> Thoughts?
My vote at this point would be 2. (assuming there are no legal restrictions that prohibit this).
I've added it as discussion topic for tomorrow's PMC call.
Well I can only talk about my own experience here, doing builds with PDE build on build.eclipse.org. For me personally, the ant mail task never worked - my build log always had "failed to initialize MIME Mail", but apart from that message printed in the log, I knew the build was OK. With the new ant, I now get a backtrace which means I can no longer analyze my build log properly. It's unclear whether the build itself failed or succeeded, because the backtrace due to mail not available masks other errors. I guess for me personally, catching the ClassNotLoadException from mail and handling it in a nicer fashion would be an OK workaround that wouldn't require me to download / install additional dependencies. Others, who do need mail to work (and had it working in previous releases) may think differently. I'm adding Kim for comment. On another note, shipping activation.jar with Eclipse may not be a great idea since "The JavaBeans Activation Framework 1.1.1 final release is included with the Java SE 6 release". I'm not sure about other depdencies, but personally I'd prefer instructions how to get PDE Build / ant to run with J2SE-1.6 which I'm using anyways. When we ship JAF-1.1.1 with Eclipse, then depending on classpath load order, the wrong copy might be loaded. If I understood correctly, then also other (newly optional) tasks are affected. Before figuring out solutions, I just want to make sure I understand the problem. Is this a correct assessment? - The Ant Mail task is an optional task, meaning it may require additional libraries to function - In Ant 1.7, the Mail task did not require additional libraries, but in Ant 1.8 it may require java mail if you use Mime encoding in your mail - Java mail is available as a separate download for Java SE 5, and is included in Java SE 6. - Java Mail is available in Orbit Mike, can you verify whether the set of available tasks changed (especially reduced) from 1.7 to 1.8? That's the first thing we need to know for sure. (In reply to comment #9) > Before figuring out solutions, I just want to make sure I understand the > problem. Is this a correct assessment? > > - The Ant Mail task is an optional task, meaning it may require additional > libraries to function Correct. I discovered the link I posted above to get mail.jar is a dead link, so I ran %> ant -f fetch.xml -Ddest=optional to pull in all of the optional jars and discovered Apache is calling it mail-1.4.jar > - In Ant 1.7, the Mail task did not require additional libraries, but in Ant > 1.8 it may require java mail if you use Mime encoding in your mail Checking the previous versions of Ant (1.6.x, 1.7.x and 1.8.x) the mail task still did require the additional jars to run properly. The confusion comes in for versions < 1.8.x because the message reported from the mail task looks like: Buildfile: C:\Users\mrennie\workspaces\workspace3.4.x\AntTest\mail.xml main: [mail] Failed to initialise MIME mail: javax/mail/MessagingException BUILD SUCCESSFUL Total time: 124 milliseconds as opposed to the new message which is a stack trace and correctly reports the build has failed. Note this is the message from Apache, not an Eclipse message. > - Java mail is available as a separate download for Java SE 5, and is included > in Java SE 6. My understanding is that it is, but from my testing - using 1.5 and 1.6 - the mail task in Ant will still not work properly unless you add the mail-1.4.jar file to the Ant classpath. > - Java Mail is available in Orbit I am not sure about this. > Mike, can you verify whether the set of available tasks changed (especially > reduced) from 1.7 to 1.8? That's the first thing we need to know for sure. I scanned through the supplied jar files and the classes from ant 1.8.x and 1.7.1 and found: 1. 1.8.x added ant-apache-xalan2.jar which adds xalan to trace support 2. 1.8.x added ant-junit4.jar for JUnit 4 support 3. 1.8.x removed no-deps.jar - according to the release notes it has been merged into ant.jar (http://www.apache.org/dist/ant/RELEASE-NOTES-apache-ant-1.8.2.html) 4. 1.8.x removed ant-starteam.jar - removed because they did not work without additional deps (http://ant.1045680.n5.nabble.com/VOTE-Weblogic-and-Starteam-antlibs-for-ant-1-8-0-td1371107.html) 5. 1.8.x removed ant-stylebook.jar because it has been deprecated for a long time (http://ant.1045680.n5.nabble.com/removing-ant-stylebook-td1358185.html) 6. 1.8.x removed ant-trax.jar - merged it into ant.jar 7. 1.8.x removed ant-weblogic.jar - removed because they did not work without additional deps (http://ant.1045680.n5.nabble.com/VOTE-Weblogic-and-Starteam-antlibs-for-ant-1-8-0-td1371107.html) 8. 1.8.x added ant-testutil.jar which added test utilities. To sum up: the starteam and weblogic tasks are no longer present, but they had a dependency on third party commercial jars so the likely-hood of them being used is very small. Ant stopped shipping them because of this and the fact the weblogic supply their own tasks now. See http://ant.1045680.n5.nabble.com/VOTE-Weblogic-and-Starteam-antlibs-for-ant-1-8-0-td1371107.html for the complete discussion about it. (In reply to comment #11) > Checking the previous versions of Ant (1.6.x, 1.7.x and 1.8.x) the mail task > still did require the additional jars to run properly. The confusion comes in > for versions < 1.8.x because the message reported from the mail task looks > like: Thanks for digging up all these details Michael. If the only change from 1.7 to 1.8 is that the build failure is now reported correctly in this case (using Mail task without mail library), I think all we need to do is document it. > Thanks for digging up all these details Michael. If the only change from 1.7 to
> 1.8 is that the build failure is now reported correctly in this case (using
> Mail task without mail library), I think all we need to do is document it.
+1!
Marking as worksforme as the new 1.8.x behavior is working as intended. I have also updated the Eclipse readme file with migration information. |
With Eclipse 3.7m6 and later, the ant EmailTask fails with a J2SE-1.5 runtime: Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.eclipse.ant.internal.core.AntClassLoader.findClass(AntClassLoader.java:54) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:451) ... 104 more This didn't happen in 3.7m5. It looks like javax.activation.DataHandler has been a J2EE class since 1.4, and got into J2SE as per 1.6: http://download.oracle.com/javase/6/docs/api/javax/activation/DataHandler.html