我们有一个使用“jrs-rest-java-client”的项目,版本:“6.3.1”
我们用来获取 jar 的网站自 9 月份以来就出现了证书问题。 https://jaspersoft.artifactoryonline.com
然后我们必须从另一个站点获取 jar 。 https://jaspersoft.jfrog.io/
问题是缺少依赖项 require,但如果我们使用具有“-jar-with-dependencies”的 jar,它就可以工作。我尝试在本地下载该 jar 并更改 .gradle 以使用本地版本。
我更喜欢的是让构建直接获取该版本,而无需先下载。
我们如何指定要使用的 jar?
dependencies {
compile fileTree(dir: 'lib',
includes: [
'ojdbc8.jar',
])
//compile group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1'
compile group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1', USETHISONE: 'jar-with-dependencies'
//compile files("${buildDir}/jrs-rest-java-client-6.3.1-jar-with-dependencies.jar")
}
我现在已按照建议进行尝试;
repositories {
mavenCentral()
// to handle broked jasper reports dependencies
maven {
url 'http://jasperreports.sourceforge.net/maven2'
url 'https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/'
url "https://jaspersoft.jfrog.io/jaspersoft/jaspersoft-clients-releases"
}
}
dependencies {
implementation project(':common:project-common-properties')
implementation project(':common:project-common-mail')
implementation fileTree(dir: 'lib', includes: [
'ojdbc8.jar'
])
implementation group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1', classifier: 'jar-with-dependencies'
}
我在构建时仍然遇到错误...
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':services:notificationService:compileClasspath'.
> Could not find com.jaspersoft.jasperserver:jasperserver-dto:6.3.0.
Required by:
project :services:notificationService > com.jaspersoft:jrs-rest-java-client:6.3.1
如果使用 jrs-rest-java-client-6.3.1-jar-with-dependency.jar,则不需要该库。
谢谢大家,
解决方案是,如视频所示(谢谢!) 添加新网址:
url "https://jaspersoft.jfrog.io/jaspersoft/jrs-ce-releases"
最佳答案
来自jfrog repo ,它向您展示了如何执行此操作:
compile(group: 'com.jaspersoft', name: 'jrs-rest-java-client', version: '6.3.1', classifier: 'jar-with-dependencies')
添加 gradle 的存储库:
repositories {
jcenter {
name "jaspersoft-releases"
url "https://jaspersoft.jfrog.io/jaspersoft/jaspersoft-clients-releases"
}
}
我推荐switching from compile
to implementation
并使用简写来声明依赖项:
implementation "com.jaspersoft:jrs-rest-java-client:6.3.1:jar-with-dependencies"
<小时/>
Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for his life time.
我决定录制一个简短的剪辑,说明我如何在 jfrog 上找到适合您所需工件的存储库:
关于java - Gradle 在编译任务中使用带有依赖项的 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58938619/