If I remember correctly I don't think that will work…I believe doing 'apply 
from: foo.gradle' the script in foo.gradle is processed with a new ClassLoader, 
so the classes won't be accessible to the calling script.  

Generally classes like the one you are describing would be better suited to be 
defined in the buildSrc folder so it is compiled and added to your build's 
class path 
(http://www.gradle.org/docs/current/userguide/organizing_build_logic.html)  

--  
John Engelman


On Tuesday, January 7, 2014 at 12:38 PM, Xavier Ducrohet [via Gradle] wrote:

> Hi,
>  
> trying to refactor some internal code, I'm running into another issue with 
> 'apply from'
>  
> There's a foo.gradle file that only declares a new class extending 
> DefaultTask, and we're trying to use it from another gradle file after doing 
> 'apply from: foo.gradle' but it doesn't find the type.  
>  
> Is there a way to make this work?  
>  
> If you reply to this email, your message will be added to the discussion 
> below: 
> http://gradle.1045684.n5.nabble.com/declaring-a-class-in-a-gradle-file-and-using-it-through-apply-from-tp5712170.html
>   
> To start a new topic under gradle-dev, email 
> ml-node+s1045684n1436218...@n5.nabble.com 
> (mailto:ml-node+s1045684n1436218...@n5.nabble.com)  
> To unsubscribe from gradle-dev, click here 
> (http://gradle.1045684.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1436218&code=am9obi5yLmVuZ2VsbWFuQGdtYWlsLmNvbXwxNDM2MjE4fDIyMTUyNjEzNQ==).
> NAML 
> (http://gradle.1045684.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml)
>   





--
View this message in context: 
http://gradle.1045684.n5.nabble.com/declaring-a-class-in-a-gradle-file-and-using-it-through-apply-from-tp5712170p5712171.html
Sent from the gradle-dev mailing list archive at Nabble.com.

Reply via email to