第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java jar 文件無法識別從 gradle 添加的外部庫

Java jar 文件無法識別從 gradle 添加的外部庫

暮色呼如 2023-07-28 09:33:55
各位,基本上我在 java 項目中使用 gradle,并且無法導(dǎo)出我正在使用的 jar 文件中的庫。嘗試了一些解決方案但沒有任何效果。你知道我在 gradle 文件中缺少什么嗎?或者我在導(dǎo)出時需要指定一些內(nèi)容。我正在使用 Eclipse謝謝,這是我的 gradle 文件    enter code hereplugins {    // Apply the java-library plugin to add support for Java Library    id 'java-library'}repositories {    // Use jcenter for resolving your dependencies.    // You can declare any Maven/Ivy/file repository here.    jcenter()    mavenCentral()}dependencies {    // This dependency is exported to consumers, that is to say found on their compile classpath.    api 'org.apache.commons:commons-math3:3.6.1'    // This dependency is used internally, and not exposed to consumers on their own compile classpath.    implementation 'com.google.guava:guava:27.0.1-jre'    // Use JUnit test framework    testImplementation 'junit:junit:4.12'    implementation "redis.clients:jedis:3.0.1"    implementation  'org.pixsee.java-fcm:Java-fcm:1.0.0'      implementation 'com.google.firebase:firebase-admin:6.10.0'    compile "org.slf4j:slf4j-api:1.6.1"     implementation 'org.slf4j:slf4j-simple:1.7.25'     implementation "com.google.maps:google-maps-services:0.9.4"     implementation 'io.vertx:vertx-core:3.8.1'}sourceCompatibility = 1.8version = '1.0'jar {    manifest {        attributes 'Implementation-Title': 'GeofenceServer',                   'Implementation-Version': version    }}apply plugin: "eclipse"
查看完整描述

1 回答

?
喵喵時光機

TA貢獻1846條經(jīng)驗 獲得超7個贊

問題是當我嘗試創(chuàng)建 fatJar 時它說找不到主類,原因是因為我的文件位于 src/test/java 而不是 src /main/java 不知怎的,當我嘗試運行 fatJar 時,它編譯了它,但仍然找不到依賴項,所以我將實現(xiàn)更改為在 build.gradle 文件中編譯,現(xiàn)在它可以工作了。所以這是我的最終 build.gradle 文件如何看起來像 。


? ? /*

?* This file was generated by the Gradle 'init' task.

?*

?* This generated file contains a sample Java Library project to get you started.

?* For more details take a look at the Java Libraries chapter in the Gradle

?* User Manual available at https://docs.gradle.org/5.4/userguide/java_library_plugin.html

?*/

plugins {

? ? // Apply the java-library plugin to add support for Java Library

? ? id 'java-library'

}

repositories {

? ? // Use jcenter for resolving your dependencies.

? ? // You can declare any Maven/Ivy/file repository here.

? ? jcenter()

? ? mavenCentral()

}



apply plugin: "java"

apply plugin: "eclipse"


version = '1.0'


//create a single Jar with all dependencies

task fatJar(type: Jar) {

? ? manifest {

? ? ? ? attributes 'Implementation-Title': 'Gradle Jar File Example',?

? ? ? ? ? ? 'Implementation-Version': version,

? ? ? ? ? ? 'Main-Class': 'Server.Test'

? ? }

? ? baseName = project.name + '-all'

? ? from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }

? ? with jar

}



dependencies {

? ? // This dependency is exported to consumers, that is to say found on their compile classpath.

? ? api 'org.apache.commons:commons-math3:3.6.1'



? ? // This dependency is used internally, and not exposed to consumers on their own compile classpath.

? ? implementation 'com.google.guava:guava:27.0.1-jre'


? ? // Use JUnit test framework

? ? testImplementation 'junit:junit:4.12'



? ? implementation "redis.clients:jedis:3.0.1"

? ? implementation 'com.google.firebase:firebase-admin:6.10.0'

? ? implementation 'org.slf4j:slf4j-simple:1.7.25'

? ? implementation 'com.google.maps:google-maps-services:0.10.0'

? ? compile 'io.vertx:vertx-core:3.8.1'

? ? implementation 'com.google.code.gson:gson:2.8.5'

}


查看完整回答
反對 回復(fù) 2023-07-28
  • 1 回答
  • 0 關(guān)注
  • 190 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號