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*

When I run "gradle install", I failed for this error:

> Loading* What went wrong:
A problem occurred evaluating root project 'gradleApplicationTest'.
> LoadingCause: Could not find property 'install' on root project
'gradleApplicationTest'.

I tried to add the copyConf task to other task of application plugin such
as startScripts. It works. And I tried to remove this line from build.xml,
"gradle install" runs successfully.

So, what's the problem for "*install.dependsOn copyConf*" ??


Sky Ao

Reply via email to