Eclipse没有正确部署Gradle项目

时间:2014-02-09 10:50:54

标签: eclipse gradle ejb-3.1

所以我有一个gradle项目,显然有一些与eclipse完全集成的问题。 当我用“gradle build”命令构建整个东西并在glassfish4服务器上部署EAR文件时,一切看起来都很好,但是当我尝试运行时 “gradle eclipse” “gradle eclipseWtp” 将项目导入eclipse并按“运行在服务器上”只有应用程序的部分实际部署...我的意思是,当你去管理面板时,你实际上可以在那里看到应用程序,但应用程序仍然无法正常工作当我去glassfish_home / domains / domain1 / applications时,目录是空的......

这是我的gradle文件: 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"    
    }
}

2 个答案:

答案 0 :(得分:2)

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

allprojects {
    apply plugin: 'eclipse-wtp'
}

我发现了here

答案 1 :(得分:0)

Buildship插件中的WTP支持为yet to come.