我在使用 Gradle 的 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 中的货物依赖项:
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")
}
}
}