Eclipse没有正确部署Gradle项目 [英] Eclipse doesn't deploy Gradle project properly

查看:201
本文介绍了Eclipse没有正确部署Gradle项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个毕业的项目,显然有一些问题与日食完全整合。
当我使用gradle build命令构建整个事物并在glassfish4服务器上部署EAR文件时,一切似乎都可以正常工作,但是当我尝试运行
gradle eclipse
gradle eclipseWtp
将项目导入eclipse并按在服务器上运行只有应用程序的一部分实际被部署...我的意思是,当你去管理面板,你可以看到那里的应用程序,但应用程序仍然不起作用,当我去glassfish_home / domains / domain1 /应用程序时,目录为空...



这里是我的毕业文件:
gradle.build(root)

 子项目{
应用插件:'java'
应用插件:'eclipse'

存储库{
mavenCentral()
}

依赖关系{
testCompile'junit:junit:4.11'
}

version ='1.0'

jar {
manifest.attributes provider:'gradle'
}
}

settings.gradle(root)

  include:ejb,:common,:web,:ejb-integration-tests,:ear
/ pre>

build.gradle(web)

 应用插件: 'war'
应用插件:'eclipse-wtp'

jar {
manifest {
attributes'Implementation-Title':'WorldFighter-WEB','Implementation -Version':version
}
}

war {
archiveName'WorldFighter.war'
from'src / webapp /'
webInf {from'src / additionalWebInf'}
}

springVersion ='3.2.2.RELEASE'
sl4jVersion ='1.7.2'

依赖关系{

运行时javax.servlet:servlet-api:2.5'

编译项目(':common')

compile(
[group:'org.springframework',name:'spring-orm',version:springVersion],
[group:'org.springframework',name: spring-tx',version:springVersion],
[group:'org.springframework',name:'spring-core',version:springVersion],
[group:'org.springframework' :'spring-web',version:springVersion],
[group:'org.springframework',name:'spring-webmvc',version:springVersion],
[group:'org.springframework' ,name:'spring-context',version:springVersion],
[group:'org.springframework',name:'spring-context-support',version:springVersion]


compile(
[group:'org.slf4j',name:'slf4j-jcl',version:sl4jVersion],
[group:'org.slf4j',name:'slf4j- api',version:sl4jVersion]


compile(org.apache.tiles:tiles-extras:3.0.1){
exclude module:'org.slf4j :jcl-over-slf4j'
exclude module:'org.slf4j:slf4j-jdk14'
}

compile'taglibs:standard:1.1.2' ,
'javax.transaction:jta:1.1',
'log4j:log4j:1.2.14',
'commons-lang:commons-lang:2.6',
' commons-validator:commons-validator:1.4.0'

}

build.gradle(ejb)

  jar {
manifest {
attributes'Implementation-Title' WorldFighter-EJB','Implementation-Version':version
}
}

依赖项{
编译项目(':common')
}

build.gradle(ear)

 应用插件:'ear'
应用插件:'eclipse-wtp'

jar {
manifest {
attributes'标题':'WorldFighter-EAR','实现版本':版本
}
}

依赖项{
部署项目(路径:':web'配置:'archives')
deploy project(':ejb')
deploy p roject(':common')

earlib'org.glassfish.extras:glassfish-embedded-all:3.0'
}

ear {

deploymentDescriptor {
applicationName =WorldFighter
displayName =WorldFighter
description =包含EJB和Web App的WorldFighter EAR
}
}


解决方案

看起来所有依赖项目也应该是eclipse-wtp插入。以下为我工作

  allprojects {
apply plugin:'eclipse-wtp'
}

我发现这个 here


So I have a gradle project that apparently has some problems fully integrating with eclipse. When I build the whole thing with "gradle build" command and deploy the EAR file on glassfish4 server, everything appears to work perfectly fine, but when I try to run "gradle eclipse" "gradle eclipseWtp" import the project to eclipse and press "run on server" only the part of the app actually gets deployed... I mean, when you go to admin panel, you can actually see the app there, but the application still doesn't work and when I go to glassfish_home/domains/domain1/applications the directory is empty...

here are my gradle files: gradle.build (root)

subprojects {
    apply plugin: 'java'
    apply plugin: 'eclipse'

    repositories {
       mavenCentral()
    }

    dependencies {
        testCompile 'junit:junit:4.11'
    }

    version = '1.0'

    jar {
        manifest.attributes provider: 'gradle'
    }
}

settings.gradle (root)

include ":ejb", ":common", ":web", ":ejb-integration-tests", ":ear"

build.gradle (web)

apply plugin: 'war'
apply plugin: 'eclipse-wtp'

jar {
    manifest {
        attributes 'Implementation-Title': 'WorldFighter-WEB', 'Implementation-Version': version
    }
}

war {
    archiveName 'WorldFighter.war'
    from 'src/webapp/'
    webInf { from 'src/additionalWebInf' }
}

springVersion = '3.2.2.RELEASE'
sl4jVersion = '1.7.2'

dependencies {

    runtime 'javax.servlet:servlet-api:2.5'

    compile project(':common')

    compile(
        [group: 'org.springframework', name: 'spring-orm', version: springVersion],
        [group: 'org.springframework', name: 'spring-tx', version: springVersion],
        [group: 'org.springframework', name: 'spring-core', version: springVersion],
        [group: 'org.springframework', name: 'spring-web', version: springVersion],
        [group: 'org.springframework', name: 'spring-webmvc', version: springVersion],
        [group: 'org.springframework', name: 'spring-context', version: springVersion],
        [group: 'org.springframework', name: 'spring-context-support', version: springVersion]
    )

    compile(
        [group: 'org.slf4j', name: 'slf4j-jcl', version: sl4jVersion],
        [group: 'org.slf4j', name: 'slf4j-api', version: sl4jVersion]
    )

    compile("org.apache.tiles:tiles-extras:3.0.1") {
        exclude module: 'org.slf4j:jcl-over-slf4j'
        exclude module: 'org.slf4j:slf4j-jdk14'
    }

    compile 'taglibs:standard:1.1.2',
            'javax.transaction:jta:1.1',
            'log4j:log4j:1.2.14',
            'commons-lang:commons-lang:2.6',
            'commons-validator:commons-validator:1.4.0'

}

build.gradle (ejb)

jar {
    manifest {
        attributes 'Implementation-Title': 'WorldFighter-EJB', 'Implementation-Version': version
    }
}

dependencies {
    compile project(':common')
}

build.gradle (ear)

apply plugin: 'ear'
apply plugin: 'eclipse-wtp'

jar {
    manifest {
        attributes 'Implementation-Title': 'WorldFighter-EAR', 'Implementation-Version': version
    }
}

dependencies {
    deploy project(path: ':web', configuration: 'archives')
    deploy project(':ejb')
    deploy project(':common')

    earlib 'org.glassfish.extras:glassfish-embedded-all:3.0'
}

ear {

    deploymentDescriptor {
        applicationName = "WorldFighter"
        displayName = "WorldFighter"
        description = "WorldFighter EAR containing EJBs and Web App"    
    }
}

解决方案

Looks like all dependent projects also should be having eclipse-wtp plugin. Following works for me.

allprojects {
    apply plugin: 'eclipse-wtp'
}

I found this here

这篇关于Eclipse没有正确部署Gradle项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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