Gradle Ear-plugin 与 ejb 依赖项的问题

发布于 2024-11-16 22:29:45 字数 256 浏览 1 评论 0原文

我正在尝试将新的 Ear-plugin (gradle-1.0-milestone-4-20110610162713+0200) 与 ejb 一起使用。我将 ejb-jar 添加为部署依赖项。但是,由于部署依赖项是间接添加的,所以我没有获得 ejb-jar 的依赖项。我发现的唯一方法是将 ejb-jar 添加为earlib,但随后将 ejb-jar 添加到ear lib 目录。

无论如何,是否可以优雅地添加此内容,以便将 ejb-jar 添加到根目录并将其依赖项添加到 lib?

I'm trying to use the new ear-plugin (gradle-1.0-milestone-4-20110610162713+0200) with ejb's. I add the ejb-jar as a deploy dependency. However since the deploy dependencies are added intransitivily I don't get the dependencies of the ejb-jar. The only way I found was to also add the ejb-jar as earlib, but then the ejb-jar is added to ear lib directory.

Is there anyway to gracefully add this so that the ejb-jar is added to the root and its dependencies to lib?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

游魂 2024-11-23 22:29:45

Creating ears that support ejbs and skinny wars will be implemented as a part of http://issues.gradle.org/browse/GRADLE-37 and/or http://issues.gradle.org/browse/GRADLE-1637.

十秒萌定你 2024-11-23 22:29:45

这段代码对我有用:

task doEarlib(dependsOn: 'ear') {
    def earibConfig = configurations.deploy.copy()
    earibConfig.transitive = true
    earibConfig.resolvedConfiguration.firstLevelModuleDependencies.each { 
        dependency ->
        dependency.children.each { 
            transitiveDependency ->
            dependencies.add('earlib', transitiveDependency.name)
        }
    }
}

This code works for me:

task doEarlib(dependsOn: 'ear') {
    def earibConfig = configurations.deploy.copy()
    earibConfig.transitive = true
    earibConfig.resolvedConfiguration.firstLevelModuleDependencies.each { 
        dependency ->
        dependency.children.each { 
            transitiveDependency ->
            dependencies.add('earlib', transitiveDependency.name)
        }
    }
}
奢望 2024-11-23 22:29:45

五年后 GRADLE-1637 仍然开放......这就是我解决问题的方法使用 Gradle 2.13。希望这对某人有帮助。

apply plugin: 'ear'

def deployedModules = [ 'projectA', 'projectB', 'projectC' ]

deployedModules.forEach {
    def projectPath = ":${it}"

    evaluationDependsOn(projectPath)

    dependencies.add('deploy', dependencies.project(path: projectPath,
                                                    configuration: 'archives'))
    findProject(projectPath).configurations.runtime.allDependencies.forEach {
        boolean isEarModule = it instanceof ProjectDependency &&
                (it as ProjectDependency).dependencyProject.name in deployedModules
        if (!isEarModule) {
            dependencies.add('earlib', it)
        }
    }
}

Five years later GRADLE-1637 is still open... This is how I solved the problem with Gradle 2.13. Hope this helps someone.

apply plugin: 'ear'

def deployedModules = [ 'projectA', 'projectB', 'projectC' ]

deployedModules.forEach {
    def projectPath = ":${it}"

    evaluationDependsOn(projectPath)

    dependencies.add('deploy', dependencies.project(path: projectPath,
                                                    configuration: 'archives'))
    findProject(projectPath).configurations.runtime.allDependencies.forEach {
        boolean isEarModule = it instanceof ProjectDependency &&
                (it as ProjectDependency).dependencyProject.name in deployedModules
        if (!isEarModule) {
            dependencies.add('earlib', it)
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文