jitpack下载构建工件到哪里去了?

时间:2016-03-10 10:00:48

标签: java gradle jar build.gradle jitpack

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(' '))
    }
}

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

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:~$ 

1 个答案:

答案 0 :(得分:1)

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