Skip to content
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

Merged
merged 3 commits into from
Mar 10, 2016

Conversation

xSAVIKx
Copy link
Contributor

@xSAVIKx xSAVIKx commented Mar 9, 2016

added support for getting version for gradle and Java from one version.properties file

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

@twingly-mob
Copy link
Member

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

xSAVIKx added 2 commits March 9, 2016 17:57
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
@xSAVIKx
Copy link
Contributor Author

xSAVIKx commented Mar 9, 2016

@twingly-mob try it now again, please.

@twingly-mob
Copy link
Member

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:

warning: [options] bootstrap class path not set in conjunction with -source 1.7

Any idea what that is?

@xSAVIKx
Copy link
Contributor Author

xSAVIKx commented Mar 9, 2016

Just curious, was this due to performance reasons? Or did something not work?

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.

We happened to notice this output when running one of the examples for the first time and after removing the build directory:

warning: [options] bootstrap class path not set in conjunction with -source 1.7

Any idea what that is?

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.

@walro
Copy link
Contributor

walro commented Mar 10, 2016

Thanks for your explanations

walro added a commit that referenced this pull request Mar 10, 2016
@walro walro merged commit 64074b6 into twingly:master Mar 10, 2016
@xSAVIKx xSAVIKx deleted the versionFeature branch May 11, 2017 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants