It allows for a finer level of control over dependencies. 
Compile will define the bare minimum requirements for your code to compile. 
Runtime inherits all entries in compile, but can add additional dependencies 
required to run.
 
There are also corresponding dependencies for tests.
 
This way, you can control what things your code depends on, and as an example 
might find a dependency on a testing library that has creeped into your 
shipping code.

________________________________

From: Dean Schulze [mailto:[email protected]]
Sent: Sun 26/09/2010 11:08 AM
To: [email protected]
Subject: Re: [gradle-user] Re: Example or tutorial of migrating from Ant to 
Gradle



So the compile and runtime classpaths are set by compile and runtime members of 
the dependencies.  Why didn't they just call them classpath?

I've searched the user guide for classpath and there are some classpath members 
for other closures.  Unfortunately it's not clear at all from the Gradle docs 
how I would use Gradle in place of the simplest Ant script.


--- On Sat, 9/25/10, Rene Groeschke <[email protected]> wrote:



        From: Rene Groeschke <[email protected]>
        Subject: Re: [gradle-user] Re: Example or tutorial of migrating from 
Ant to Gradle
        To: [email protected]
        Date: Saturday, September 25, 2010, 2:46 AM
        
        
        Hi Dean,
        
        I've just choose struts2-core as an example on how to add libs to your
        classpath. Of course you need to add all libs your code needs to
        compile. For runtime libs you have to use "runtime" instead of complile
        (e.g. slf4j-over-log4j):
        -------------------
        dependencies{
            compile ...
            compile ...
        
            runtime ...
        }
        -------------------
        
        
        regards,
        René
        Am 25.09.10 01:50, schrieb Dean Schulze:
        > Why do I need that and not all the other .jar files in the lib/ 
directory?  They are also needed to compile (some only at runtime).
        >
        > --- On Fri, 9/24/10, Jim Moore <[email protected]> wrote:
        >
        > From: Jim Moore <[email protected]>
        > Subject: Re: [gradle-user] Re: Example or tutorial of migrating from 
Ant to Gradle
        > To: [email protected]
        > Date: Friday, September 24, 2010, 5:39 PM
        >
        > Then you need
        >   compile name: 'struts2-core', version: '2.2.1'
        >
        > -Jim Moore
        >
        > On Fri, Sep 24, 2010 at 6:53 PM, Dean Schulze 
<[email protected]> wrote:
        >
        >
        > It's struts2-core-2.2.1.jar that is in the lib/ directory.
        >
        >
        > --- On Fri, 9/24/10, Jim Moore <[email protected]> wrote:
        >
        >
        > From: Jim Moore <[email protected]>
        > Subject: Re: [gradle-user] Re: Example or tutorial of migrating from 
Ant to Gradle
        > To: [email protected]
        >
        > Date: Friday, September 24, 2010, 2:57 PM
        >
        > Is struts2-core.jar in 
C:\dean\src\projects\struts2-examples\Struts2HW-Part3\StrutsHelloWorld\lib ?
        >
        >
        >
        >
        > On Fri, Sep 24, 2010 at 4:08 PM, dwschulze <[email protected]> 
wrote:
        >
        >
        >
        >
        > Getting closer.  The error I get now and my build.gradle are below.
        >
        >
        >
        > What does the
        >
        >
        >
        >     compile name: 'struts2-core'
        >
        >
        >
        > do?  I have a library file struts2-core-2.2.1.jar, but that is not 
what
        >
        > compiles my code.  It just belongs in the javac classpath.
        >
        >
        >
        >
        >
        >
        >
        > :compileJava
        >
        > :: problems summary ::
        >
        > :::: WARNINGS
        >
        >                 module not found: #struts2-core;
        >
        >
        >
        >         ==== clientModule: tried
        >
        >
        >
        >         ==== internal-repository: tried
        >
        >
        >
        >         ==== localRepository: tried
        >
        >
        >
        >           -- artifact #struts2-core;!struts2-core.jar:
        >
        >
        >
        >
        >
        > C:\dean\src\projects\struts2-examples\Struts2HW-Part3\StrutsHelloWorld
        >
        > \lib/struts2-core.jar
        >
        >
        >
        >                 ::::::::::::::::::::::::::::::::::::::::::::::
        >
        >
        >
        >                 ::          UNRESOLVED DEPENDENCIES         ::
        >
        >
        >
        >                 ::::::::::::::::::::::::::::::::::::::::::::::
        >
        >
        >
        >                 :: #struts2-core;: not found
        >
        >
        >
        >                 ::::::::::::::::::::::::::::::::::::::::::::::
        >
        >
        >
        >
        >
        >
        >
        > FAILURE: Build failed with an exception.
        >
        >
        >
        > * What went wrong:
        >
        > Could not resolve all dependencies for configuration ':compile':
        >
        >     - unresolved dependency: #struts2-core;: not found
        >
        >
        >
        > * Try:
        >
        > Run with -s or -d option to get more details. Run with -S option to 
get the
        >
        > full
        >
        >  (very verbose) stacktrace.
        >
        >
        >
        > BUILD FAILED
        >
        >
        >
        >
        >
        > apply plugin: 'war'
        >
        >
        >
        >
        >
        > dependencies {
        >
        >
        >
        >         compile name: 'struts2-core'
        >
        > }
        >
        >
        >
        > repositories {
        >
        >     flatDir name: 'localRepository', dirs: 'lib'
        >
        > }
        >
        >
        >
        > sourceSets.main.java.srcDirs = ['src']
        >
        > sourceSets.main.resources.srcDirs = ['src']
        >
        >
        >
        > webAppDirName = "WebContent"
        >
        >
        >
        >
        >
        > //    compile name: 'struts2-core'
        >
        > //      runtime name: 'spring-core'
        >
        >
        >
        >
        >
        >
        >
        > --
        >
        > View this message in context: 
http://gradle.1045684.n5.nabble.com/Example-or-tutorial-of-migrating-from-Ant-to-Gradle-tp2852129p2853196.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
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >       
        >
        >
        >
        >
        >       
        
        
        -- 
        ------------------------------------
        Rene Groeschke
        
        [email protected]
        http://www.breskeby.com <http://www.breskeby.com/> 
        http://twitter.com/breskeby
        ------------------------------------
        
        
        ---------------------------------------------------------------------
        To unsubscribe from this list, please visit:
        
            http://xircles.codehaus.org/manage_email
        
        
        


<<winmail.dat>>

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

    http://xircles.codehaus.org/manage_email

Reply via email to