使用Cargo插件为Gradle部署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中的货物依赖:
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")
}
}
}
答案 0 :(得分:0)
似乎普通的发现jar文件没有正确加载。
我想您应该在org.gradle.debug=true
中启用gradle.properties
并尝试对其进行调整 -
设置为true时,Gradle将在启用远程调试的情况下运行构建,侦听端口5005.请注意,这相当于将-Xrunjdwp:transport = dt_socket,server = y,suspend = y,address = 5005添加到JVM命令line并将挂起虚拟机,直到连接调试器。
答案 1 :(得分:0)
如果您具有以下内容,请确保依赖项是可传递的,然后使其更具体
configurations.all {
transitive = false
}
例如
configurations.compile {
transitive = false
}
这样gradle会下载货物的所有依赖项