0

我正在更改我们的项目以使用 gradle 作为构建工具,但我正在努力解决两个问题;

上下文:它是一个多项目的gradle配置

:project-root
------:client //GWT Java Files & GWT Centric resources, e.g. CSS, Images, ui-xml etc..
------:server //Server based logic, e.g. controllers, services, repositories etc.
------:web-app//NON GWT resources for the web-app, e.g. , web.xml, static pages, images 

1:为了让gwtCompile任务在 中运行:client build.gradle,我将其添加为对 war 任务的依赖,如下所示:

war{
    dependsOn ':client:compileGwt'
    from {'src/main/root-content'}
    webInf {from 'src/main/web-inf-content'}
}

我不喜欢这样,是否有更简单的方法来执行此操作,以便在项目中的任务完成gwtCompile时调用任务,以便 GWT 编译器可以访问生成的字节码?通过简单地放入:web-app 依赖项调用而不是任务(正如我所期望的那样)..javaCompile:clientcompile project(':client')javaCompilegwtCompile

2:我努力从项目中获取 GWT JavaScript 输出:client并将这些文件复制到 war 文件中。我在属性中需要以下内容from

war{
    from {'src/main/root-content','$:CLIENT/gwt-compiler-js-output-dir-as-declared-in-client-build-file}
    webInf {from 'src/main/web-inf-content'}
}

提前谢谢了,

伊恩。

4

1 回答 1

1

您可以手动声明自己的任务依赖项,前提是您没有引入依赖项问题。:) 你试过做这样的事情吗?

javaCompile.dependsOn(project(':yourproject').taskName)

希望有帮助!

于 2012-11-06T22:23:16.077 回答