首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用farmRun任务时不应用Gretty配置

使用farmRun任务时不应用Gretty配置
EN

Stack Overflow用户
提问于 2019-07-08 15:48:52
回答 1查看 508关注 0票数 0

我正在使用Gretty示例:https://github.com/gretty-gradle-plugin/gretty-sample In master build.gradle,我只修改了存储库URL(使用镜像回购代理):

build.gradle

代码语言:javascript
复制
apply plugin: 'java'

buildscript {
    repositories {
        maven {
            //url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/'
            url 'http://10.0.0.1:7003/nexus/content/groups/public/'
        }
        //jcenter()
    }
    dependencies {
        classpath 'org.gretty:gretty:+' 
    }
}

subprojects {
    apply plugin: 'war'
    apply plugin: 'org.gretty'

    gretty {
        scanInterval = 1 //Scan for changes every second
        host = '0.0.0.0' //Enable network access from outside your local machine
        httpPort = 8011
        servletContainer = 'jetty7' //Use Jetty7 which is compatible with JDK6
        managedClassReload = true //Activate spring-loaded class reloading
        integrationTestTask = 'integrationTest'
    }

    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    version = '1.0'

repositories {
    maven {
        //url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/'
        url 'http://10.0.0.1:7003/nexus/content/groups/public/'
    }
    //jcenter()
}

}

apply plugin: 'org.gretty'

farm {
    webapp ':customer'
    webapp ':car'
}

repositories {
    maven {
        //url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/'
        url 'http://10.0.0.1:7003/nexus/content/groups/public/'
    }
    jcenter()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

您可以看到端口被指定为:

httpPort = 8011

在次级项目项下。当我跑台球的时候

梯度:farmRun

它报告说:

代码语言:javascript
复制
17:38:42 INFO  Jetty 9.2.26.v20180806 started and listening on port 8080
17:38:42 INFO  customer runs at:
17:38:42 INFO    http://localhost:8080/customer
17:38:42 INFO  car runs at:
17:38:42 INFO    http://localhost:8080/car

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':farmRun'.
> java.lang.Exception: Address already in use: bind

因此,jetty仍然试图使用默认端口8080。谢谢你的暗示。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-10 07:34:53

方法子项目不是由:farmRun调用的。gretty配置方法需要位于根层,或者直接作为农场方法的一部分。

代码语言:javascript
复制
farm {
    webapp ':customer'
    webapp ':car'

    gretty {
        httpPort = 8012
        servletContainer = 'jetty7' //Use Jetty7 which is compatible with JDK6
        managedClassReload = true //Activate spring-loaded class reloading
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56938497

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档