-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolve twingly/twingly-search-api-java#10 #15
Conversation
added support for getting version for gradle and Java from one version.properties file
] | ||
|
||
javadocFolder = "doc" | ||
|
||
sharedManifest = manifest { | ||
attributes("Implementation-Title": 'Twingly Search API Java', | ||
"Implementation-Version": version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this block evaluated? Looks to me that version could be undefined here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean ? What block exactly ?
javadocFolder = "doc"
is part of obsolete functionality.
And all new magic is done by versionProperties.load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean this part: "Implementation-Version": version)
.
version
is defined below, to my understanding, but that might not be a problem depending upon when things are evaluated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap, already understood what do you mean.
I'll check it a bit later.
When running the examples we run into this problem: $ gradlew :example:execute -PmainClass="HelloWorld" -DTWINGLY_SEARCH_KEY=`echo $TWINGLY_SEARCH_KEY`
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:example:compileJava UP-TO-DATE
:example:processResources UP-TO-DATE
:example:classes UP-TO-DATE
:example:execute
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.twingly.search.client.UrlConnectionClient.<clinit>(UrlConnectionClient.java:33)
at com.twingly.search.Query.<init>(Query.java:33)
at HelloWorld.main(HelloWorld.java:13)
Caused by: java.lang.RuntimeException: version.properties was not found or cannot be read
at com.twingly.search.Constants.<clinit>(Constants.java:32)
... 3 more
Caused by: java.io.FileNotFoundException: file:/Users/twingly/repos/twingly-search-api-java/build/libs/twingly-search-api-java-1.0.0.jar!/version.properties (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at com.twingly.search.Constants.<clinit>(Constants.java:29)
... 3 more
:example:execute FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':example:execute'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.047 secs |
ensured that correct version is saved in jar added build-time to manifest properties added manifest to all generated jar, not to only fat-jar
@twingly-mob try it now again, please. |
Nice, it works now! We happened to notice this output when running one of the examples for the first time and after removing the build directory:
Any idea what that is? |
It was related to runtime path creation. .properties file is packed into jar and is pointed as /somepath/twingly.jar!/version.properties. It's not always correctly handled, now it's just input stream, so that we don't need to think about path.
It's kind of javac (java compiler) warning, that in most cases says, that you're using newer version of JDK and trying to compile older one bytecode. It could be fixed with some "magic" scripts to find fully-compatible version of JDK in runtime, but, actually I think that this "magic" doesn't worth it. |
Thanks for your explanations |
added support for getting version for gradle and Java from one version.properties file