Not really making much progress:

the task I want to use is in the ant-1.8.1.jar file that is available
in the lib folder of GRADLE_HOME.
It is called 'EmailTask' and resides at:
org.apache.tools.ant.taskdefs.email.EmailTask

Its dependencies are found in the jar files I have:

mail.jar
activation.jar
and maybe
java-mail.jar, which comes with the ant installation.

I still get the same exception no matter how I do this:

java.lang.ClassNotFoundException.
Execution failed for task ':doEMail'.
Cause: java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage


I have placed all these libraries in the lib directory of gradle, and
have tried the following two methods ...... both to no avail.
I'm using fixed directory here, just for test purposes.

repositories {
       flatDir name: 'localRepository', dirs: "D:\\dev\\apps\\gradle-0.9\\lib\\"
}

configurations {
   mailAntTask
}

dependencies {
   mailAntTask ":mail"
   mailAntTask ":activation"
   mailAntTask ":ant:1.8.1"
   mailAntTask ":ant-javamail"
}


task doMail << {

        println "in the domail task"

   ant {
       taskdef(name: 'mail',
               classname: 'org.apache.tools.ant.taskdefs.email.EmailTask',
               classpath: configurations.mailAntTask.asPath)

        mail(mailhost: 'mailserver', mailport: '25', subject: "test",
user: '[email protected]', password: "", message: "the body"){
                                from(address: '[email protected]')
                                to(address: "[email protected]")
                                
                        }

   }
}



task doEMail << {

        println "in the do email task"

        ant.path(id: 'mail.path'){
                fileset(dir: "D:\\dev\\apps\\gradle-0.9\\lib"){
                        include(name: 'mail.jar')
                        include(name: 'activation.jar')
                        include(name: 'ant.1.8.1.jar')
                        include(name: 'ant-javamail.jar')
                }
        }

        
        ant.typedef(name: 'email', classname:
"org.apache.tools.ant.taskdefs.email.EmailTask", classpathref:
'mail.path')
        
        ant.email(mailhost: 'emailserver', mailport: '25', subject: "the
title", user: '[email protected]', password: "", message: "the body"){
                        from(address: '[email protected]')
                        to(address: "[email protected]")                  
        }       
}


I would have thought the 2nd method at least work (I am familiar with
having done with this my own custom tasks... and it worked) ....
why the b.h does it not work here? I have that mail.jar in the
classpath ( which contains  javax.mail.internet.MimeMessage  ) yet it
still cannot find it. ...


arrgghh!





On 19 January 2011 00:07, Rene Groeschke <[email protected]> wrote:
> Am Di, 18.01.2011, 10:58, schrieb Sean Van Buggenum:
>> Hi all,
>>
>>
>> mail is an optional ant task. First i've tried adding the mail.java and
>> activation.jar files to the appropriate places (in the gradle/lib path)
>> like I had already before for ant. That didn't work.
>>
>>
>> I've seen an example a similar problem, in the gradle doco
>>
>>
>> http://www.gradle.org/0.8/docs/userguide/organizing_build_logic.html
>>
>>
>> configurations { ftpAntTask }
>>
>>
>> dependencies { ftpAntTask("org.apache.ant:ant-commons-net:1.7.0") {
>> module("commons-net:commons-net:1.4.1") {
>> dependencies "oro:oro:2.0.8:jar" }
>> }
>> }
>>
>>
>> but I do not quite understand it, and how I can apply it to my problem.
>>
>>
>> What is that string that is used the keyword 'dependencies'
>> And that string in the module task ("commons-net:commons-net:1.4.1)
>> What sort of string is this?
> This string is used as a unique identifier for the artifact you depend on.
>
> If you have the snippet:
> dependencies {
>   ftpAntTask("org.apache.ant:ant-commons-net:1.7.0")
> }
>
> is just a common shortcut for
> dependencies {
>   ftpAntTask(group:"org.apache.ant", name:"ant-commons-net"version:"1.7.0")
> }
>
> with these informations you can resolve your artifact from a common maven
> repository. if you're not sure about the detailed unique version string,
> you can have a look at
> http://mvnrepository.com/artifact/org.apache.ant/ant-javamail/1.8.2
>
> This is explained in detail in the gradle user guide (chapter 32) have
> look at
> gradle.org/0.9.1/docs/userguide/dependency_management.html#sec:dependency_configurations
> .
>
> regards,
> René
>
>>
>>
>> I would have to add the mail.jar and activation.jar in this somehow ,
>> but I don't understand this syntax.
>>
>> Would be helpful if someone can tell me what it should look like.
>> But also, obviously I am new to groovy (as well as gradle) .... and
>> this is probably the reason why I have no real idea of how to work this out
>> for myself, without a concrete example. What should I read/look at to
>> inform myself? Is this groovy knowledge I need in this particular case, or
>> gradle knowledge only?
>>
>> thanks,
>>
>> sean
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

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

    http://xircles.codehaus.org/manage_email


Reply via email to