【问题标题】:Gradle jettyRuns works but no dependencies in EclipseGradle jettyRuns 可以工作,但在 Eclipse 中没有依赖项
【发布时间】:2015-07-17 02:14:26
【问题描述】:

我正在尝试使此应用程序正常工作,并且建筑物是在 gradle 中配置的。当我在 cmd 中使用 jettyRun 运行应用程序时,它按预期工作,但是当我在 eclipse 中打开实际代码时,我错过了所有这些依赖项,例如 spring 或 hibernate 等等......我不确定如何解决这个问题

gradle.build 看起来像这样

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

// JDK 7
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
}


dependencies {

     compile 'ch.qos.logback:logback-classic:1.1.3'
     compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
     compile 'javax.servlet:jstl:1.2'
     compile 'org.springframework:spring-orm:4.1.6.RELEASE'
     compile 'org.springframework:spring-tx:4.1.6.RELEASE'
     compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
     compile 'mysql:mysql-connector-java:5.1.31'
     compile 'org.hibernate:hibernate-core:4.3.10.Final'
     compile 'org.hibernate:hibernate-entitymanager:4.3.10.Final'   
}

// Embeded Jetty for testing
jettyRun{
    contextPath = "etnshop"
    httpPort = 8080
}

jettyRunWar{
    contextPath = "etnshop"
    httpPort = 8080
}

//For Eclipse IDE only
eclipse {

  wtp {
    component {

      //define context path, default to project folder name
      contextPath = 'etnshop'

    }

  }
}

【问题讨论】:

    标签: java eclipse spring hibernate gradle


    【解决方案1】:

    使用命令gradle eclipse 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-08
      • 2015-01-06
      • 2015-11-14
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 2014-12-04
      相关资源
      最近更新 更多