Created by: jmini
PR checklist
-
Read the contribution guidelines. -
Ran the shell script under ./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. -
Filed the PR against the correct branch: master
,. Default:3.4.x
,4.0.x
master
. -
Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
@wing328 (author of #1838). Java tech committee @bbdouglas (2017/07) @JFCote (2017/08) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01)
Description of the PR
Follow up from of PR #1838:
The org.apache.oltu.oauth2:org.apache.oltu.oauth2.client
is now only included if hasOAuthMethods
is true. See:
This means that when a spec do not use OAuth, the generated code should not use any of the classes provided by the dependency. Otherwise maven build for the generated lib looks like this:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[10,37] package org.apache.oltu.oauth2.client does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[11,45] package org.apache.oltu.oauth2.client.request does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[12,45] package org.apache.oltu.oauth2.client.request does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[13,64] package org.apache.oltu.oauth2.client.request.OAuthClientRequest does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[14,46] package org.apache.oltu.oauth2.client.response does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[15,47] package org.apache.oltu.oauth2.common.exception does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[16,47] package org.apache.oltu.oauth2.common.exception does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[17,51] package org.apache.oltu.oauth2.common.message.types does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[25,13] cannot find symbol
symbol: class OAuthClient
location: class xxxxx.okhttpgson.auth.RetryingOAuth
...
This PR add more {#hasOAuthMethods}..{/hasOAuthMethods}
to the templates.