在同一个项目中使用gradle war和ear插件是否可行/合理? [英] Is it possible/sensible to use the gradle war and ear plugin in the same project?

查看:122
本文介绍了在同一个项目中使用gradle war和ear插件是否可行/合理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现耳塞插件覆盖了战争插件并阻止战争任务被调用。我直接调用它。

I found that the ear plugin overrides the war plugin and prevents the war task being called. I got around it by calling it directly.

这是远程合理还是应该放弃并转移到eclipse和gradle中的多项目设置?

Is this remotely sensible or should I give up and move to a multi-project setup in eclipse and gradle?

ear {
    doFirst {
        println " - force build war..."
        tasks.war.execute()
    }

    from("$destinationDir") {
        exclude('nz')
        rename ('TrialApp(.*)(.war)', 'TrialApp.war')
        include 'TrialApp*.war'
        into('')
    }
    deploymentDescriptor {  
                applicationName = "trialapp"
                initializeInOrder = true
                displayName = "Trial App"  
                description = "Trial App EAR for Gradle documentation"
                libraryDirectory = "WEB-INF/lib"  
                webModule("TrialApp.war", "TrialApp")  
    }
}


推荐答案

Ear插件没有' t override War插件,默认情况下它不会执行 war 任务。无论如何,你试图做的事当然是可能的。而不是将依赖项添加到单独的战争项目中(如文档中所述) a>您可以简单地依靠 war 任务本身。

The Ear plugin doesn't override the War plugin, it simply doesn't execute the war task by default. Anyway, what you are trying to do is certainly possible. Instead of adding a dependency to a separate war project (as is described in the documentation you can simply depend on the war task itself.

apply plugin: 'war'
apply plugin: 'ear'

dependencies {
    deploy files(war)
}   

这篇关于在同一个项目中使用gradle war和ear插件是否可行/合理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆