このhello world プロジェクトは正常に実行されますが、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 には表示されません。
ログの最後のビルド アーティファクトは、JARhello_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:~$