gpt4 book ai didi

java - jitpack 将构建工件下载到哪里?

转载 作者:行者123 更新时间:2023-11-30 07:32:22 27 4
gpt4 key购买 nike

这个hello world project运行正常,但是 hello_api-latest.jar 文件在哪里? (无论客户端实际上并不“需要”JAR,它仍然应该下载。)

JAR 位于类路径中:

thufir@mordor:~/NetBeansProjects/hello_client$ 
thufir@mordor:~/NetBeansProjects/hello_client$ gradle clean build;java -jar build/libs/hello_client.jar
:clean
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:startScripts
:distTar
:distZip
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build

BUILD SUCCESSFUL

Total time: 1.229 secs

hello world

thufir@mordor:~/NetBeansProjects/hello_client$
thufir@mordor:~/NetBeansProjects/hello_client$ jar -xf build/libs/hello_client.jar
thufir@mordor:~/NetBeansProjects/hello_client$
thufir@mordor:~/NetBeansProjects/hello_client$ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Main-Class: net.bounceme.mordor.Main
Class-Path: hello_api-latest.jar

thufir@mordor:~/NetBeansProjects/hello_client$
thufir@mordor:~/NetBeansProjects/hello_client$ tree build
build
├── classes
│   └── main
│   └── net
│   └── bounceme
│   └── mordor
│   └── Main.class
├── dependency-cache
├── distributions
│   ├── hello_client.tar
│   └── hello_client.zip
├── libs
│   └── hello_client.jar
├── scripts
│   ├── hello_client
│   └── hello_client.bat
└── tmp
├── compileJava
│   └── emptySourcePathRef
└── jar
└── MANIFEST.MF

13 directories, 7 files
thufir@mordor:~/NetBeansProjects/hello_client$

构建文件:

apply plugin: 'java'
apply plugin: 'application'

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
if (!hasProperty('mainClass')) {
ext.mainClass = 'Main'
}

mainClassName = 'net.bounceme.mordor.Main'

repositories {
mavenCentral()
maven { url "https://jitpack.io" }

}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.10'
compile 'com.github.THUFIR:hello_api:latest'

}



jar {
manifest {
attributes ('Main-Class': 'net.bounceme.mordor.Main',
"Class-Path": configurations.compile.collect { it.getName() }.join(' '))
}
}

值得注意的是,jitpack 依赖项在 Netbeans 中不显示:

enter image description here

log 末尾的构建工件似乎表明已找到 JAR hello_api-latest.jar:

latest
commit 244c611ae48dc95daee544fbfb5767ae1f961e10
Author: thufir
Date: Fri Feb 5 05:39:47 2016 -0800

increment

submodule status:
Run gradle build
Gradle build script
WARNING: Gradle wrapper not found. Please add. Using default gradle to build.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

------------------------------------------------------------
Gradle 2.7
------------------------------------------------------------

Build time: 2015-09-14 07:26:16 UTC
Build number: none
Revision: c41505168da69fb0650f4e31c9e01b50ffc97893

Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_60 (Oracle Corporation 25.60-b23)
OS: Linux 3.14.32-xxxx-grs-ipv6-64 amd64

0m0.684s
Getting a list of gradle tasks
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Found javadoc task

WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/

Looking for android-library
Looking for com.android.application
Adding maven plugin
Running: gradle clean -Pgroup=com.github.THUFIR -Pversion=latest -xtest install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
:clean UP-TO-DATE
:compileJava
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.pom
Download https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.4.1/groovy-all-2.4.1.jar
:processResources UP-TO-DATE
:classes
:jar
:install

BUILD SUCCESSFUL

Total time: 1.883 secs
Gradle exit code 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Found artifact: com.github.THUFIR:hello_api:latest
EXIT_CODE=0
2016-03-10T09:47:34.133966887Z
Exit code: 0

Build artifacts:
com.github.THUFIR:hello_api:latest

Files:
com/github/THUFIR/hello_api/latest
com/github/THUFIR/hello_api/latest/build.log
com/github/THUFIR/hello_api/latest/hello_api-latest.jar
com/github/THUFIR/hello_api/latest/hello_api-latest.pom
com/github/THUFIR/hello_api/latest/hello_api-latest.pom.md5
com/github/THUFIR/hello_api/latest/hello_api-latest.pom.sha1

但是它下载到哪里了?

另请参阅:

https://stackoverflow.com/a/22724504/262852

https://stackoverflow.com/a/30094915/262852

https://stackoverflow.com/a/34329145/262852

更新

这里是:

thufir@mordor:~$ 
thufir@mordor:~$ tree .gradle/ | grep latest
│   │   │   └── latest
│   │   │   │   └── hello_api-latest.pom
│   │   │   └── hello_api-latest.jar
│   │   │   │   └── latest
│   │   │   │   └── latest
thufir@mordor:~$

最佳答案

与任何外部依赖项一样,它会下载到 gradle 缓存中。默认位置是~/.gradle

关于java - jitpack 将构建工件下载到哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35913193/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com