无法使用Grago的Cargo插件在本地部署

2019年10月23日 8点热度 0条评论

我在使用Grago的Cargo插件部署Java应用程序时遇到问题。

我尝试将commons-discovery和commons-logging添加为依赖项,但效果不佳。

:build
:copyWarToTomcat
:removeSymLinks
:removeExplodedWar UP-TO-DATE
:cargoRunLocal FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cargoRunLocal'.
> Could not create type cargo due to java.lang.NoClassDefFoundError: org/apache/commons/discovery/resource/ClassLoaders

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':cargoRunLocal'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)

BUILD FAILED

这是我build.gradle中的 cargo 依赖关系:

dependencies {
    classpath 'com.bmuschko:gradle-cargo-plugin:2.1.1'
}

这是我添加了Cargo配置的localDeploy.gradle:

apply plugin: 'com.bmuschko.cargo'

cargo {
    containerId = 'tomcat7x'

    local {
        installer {
            installUrl = 'https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.67/bin/apache-tomcat-7.0.67.zip'
            downloadDir = file("$buildDir/download")
            extractDir = file("$buildDir/extract")
        }
    }
}

解决方案如下:

似乎常见的搜索jar文件未正确加载。

我想您应该在org.gradle.debug=true中启用gradle.properties并尝试对其进行调试-
设置为true时,Gradle将在启用远程调试的情况下运行构建,侦听端口5005。请注意,这等效于将-Xrunjdwp:transport = dt_socket,server = y,suspend = y,address = 5005添加到JVM命令。行,并将挂起虚拟机,直到连接了调试器。