On 17/05/2011, at 2:46 PM, 敖小剑 wrote:

> Hi
> 
> I want to use gradle application plugin and I have some configuration need to 
> package into the application distribution. For example, log4j.xml, or 
> *.properties.
> 
> The target application directory should be like this:
> 
> /approot
>     -- libs
>     -- bin
>     -- conf
> 
> Now there is no similar feature supported by gradle application plugin. 
> I have to do this action by hand. My solution is to add a new task copyConf 
> and add 
> it as dependent task to the standard task of application plugin "install".
> 
> This is my build.gradle:
> 
> apply plugin:'application'
> apply plugin:'java'
> apply plugin:'eclipse'
> 
> mainClassName = 'net.sourcesky.study.gradle.application.DemoMain'
> 
> applicationName = 'gradleDemoApp'
> 
> task copyConf(type: Copy) {
>    from 'src/main/conf'
>    into "build/install/gradleDemoApp/conf"
> }
> 
> install.dependsOn copyConf

The task was renamed 'installApp' in Gradle 1.0-milestone-3:

installApp.dependsOn copyConf.

Here's another approach you could use instead of adding another task:

installApp {
    from 'src/main/conf'
}

distZip {
    from 'src/main/conf'
}


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com

Reply via email to