Hi all,
I'm trying to use mail ant mail task from gradle, but I'm getting the
following exception:

* What went wrong:
Execution failed for task ':sendMail'.
Cause: java.lang.ClassNotFoundException: javax.activation.DataHandler

I've tried different approaches with no success:
1- To put activation-1.1.jar, mail-1.4.jar and ant-javamail-1.8.1.jar in
$GRADLE_HOME/lib,
2- To define a configuration and define the jars listed above as
dependencies of that configuration. The code goes bellow:

configurations {
        antTask
}

dependencies
{
        antTask fileTree(dir: 'lib', include: '*.jar')
}

task sendMail << {
        ant {
                taskdef(name:'mail',
classname:'org.apache.tools.ant.taskdefs.email.EmailTask', classpath:
configurations.antTask.asPath)
                mail(mailhost:"192.168.50.1", mailport:"25", 
user:"[email protected]",
password:"user", subject:"dsafsad", tolist:new File("mailto.txt").text) {
                        from(name:"Ideais", address:"")
                        replyto(address:'')
                        message(src:"notification_sent.txt")      
                }
        }
}

If I print configurations.antTask.asPath. it outputs the following string:

R:\Projetos\checkout\Scripts\release\lib\jsch-0.1.42.jar;R:\Projetos\checkout\Scripts\release\lib\ant-jsch.jar;R:\Projetos\checkout\Scripts\release\lib\activation-1.1.jar;R:\Projetos\checkout\Scripts\release\lib\mail-1.4.jar;R:\Projetos\checkout\Scripts\release\lib\ant-javamail-1.8.1.jar

According to this output it seems that activation-1.1.jar is being read by
gradle.

3- To put activation1.1.jar in java lib folder.

I'm using java 1.5.

Any help is appreciated. Thanks!

Ricardo

--
View this message in context: 
http://gradle.1045684.n5.nabble.com/ClassNotFoundException-when-using-mail-task-tp4592221p4592221.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to