Closed zhankangbao closed 4 years ago
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-api</artifactId>
<version>3.0.6</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.gerrit/gerrit-acceptance-framework -->
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-acceptance-framework</artifactId>
<version>3.0.6</version>
</dependency>
I import above,maven can build it successfully,but when it start.log like: [2020-03-19 09:30:08,778] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon java.lang.IllegalStateException: Cannot start HTTP daemon at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:103) at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:95) at com.google.gerrit.pgm.Daemon.start(Daemon.java:346) at com.google.gerrit.pgm.Daemon.run(Daemon.java:252) at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:224) at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:120) at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:65) at Main.main(Main.java:28) Caused by: javax.servlet.ServletException: OAuth service provider wasn't installed at com.google.gerrit.httpd.auth.oauth.OAuthWebFilter.pickSSOServiceProvider(OAuthWebFilter.java:180) at com.google.gerrit.httpd.auth.oauth.OAuthWebFilter.init(OAuthWebFilter.java:74)
You don't need to build it yourself. You can download plugin binary from: release page: [1] or GerritForge CI: [2], [3].
[1] https://github.com/davido/gerrit-oauth-provider/releases/tag/v3.1.3 [2] https://gerrit-ci.gerritforge.com/view/Plugins-stable-3.0/job/plugin-oauth-bazel-stable-3.0/ [3] https://gerrit-ci.gerritforge.com/view/Plugins-master/job/plugin-oauth-bazel-master-master/
I want to build myself plugin to adapt my company oauth login
You can: build tool is Bazel and not Maven. You can build also standalone, only consume from Maven Central. Clone the plugin, and run:
$ bazel build oauth
See the documentation: https://github.com/davido/gerrit-oauth-provider/blob/master/src/main/resources/Documentation/build.md#build-standalone
root@18f3928e8f05:/home/zhankb/gerrit_plugin/gerrit-oauth-provider# bazel build gerrit-oauth-provider INFO: Call stack for the definition of repository 'com_googlesource_gerrit_bazlets' which is a git_repository (rule definition at /.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
/home/zhankb/gerrit_plugin/gerrit-oauth-provider/bazlets.bzl:9:9
/home/zhankb/gerrit_plugin/gerrit-oauth-provider/bazlets.bzl:9:9
/home/zhankb/gerrit_plugin/gerrit-oauth-provider/WORKSPACE:5:1
ERROR: An error occurred during the fetch of repository 'com_googlesource_gerrit_bazlets':
Traceback (most recent call last):
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl", line 177
_clone_or_update(ctx)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, in _clone_or_update
git_repo(ctx, directory)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, in git_repo
_update(ctx, git_repo)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, in _update
fetch(ctx, git_repo)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 129, in fetch
_git_maybe_shallow(ctx, <5 more arguments>)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 171, in _git_maybe_shallow
_error(ctx.name, <2 more arguments>)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 181, in _error
fail(<1 more arguments>)
error running 'git fetch origin refs/heads/:refs/remotes/origin/ refs/tags/:refs/tags/' while working with @com_googlesource_gerrit_bazlets:
git-remote-https: symbol lookup error: /usr/lib/x86_64-linux-gnu/libhogweed.so.4: undefined symbol: __gmpn_cnd_add_n
ERROR: no such package '@com_googlesource_gerrit_bazlets//': Traceback (most recent call last):
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl", line 177
_clone_or_update(ctx)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, in _clone_or_update
git_repo(ctx, directory)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, in git_repo
_update(ctx, git_repo)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, in _update
fetch(ctx, git_repo)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 129, in fetch
_git_maybe_shallow(ctx, <5 more arguments>)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 171, in _git_maybe_shallow
_error(ctx.name, <2 more arguments>)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 181, in _error
fail(<1 more arguments>)
error running 'git fetch origin refs/heads/:refs/remotes/origin/ refs/tags/:refs/tags/' while working with @com_googlesource_gerrit_bazlets:
git-remote-https: symbol lookup error: /usr/lib/x86_64-linux-gnu/libhogweed.so.4: undefined symbol: __gmpn_cnd_add_n
ERROR: no such package '@com_googlesource_gerrit_bazlets//': Traceback (most recent call last):
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl", line 177
_clone_or_update(ctx)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, in _clone_or_update
git_repo(ctx, directory)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, in git_repo
_update(ctx, git_repo)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 103, in _update
fetch(ctx, git_repo)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 129, in fetch
_git_maybe_shallow(ctx, <5 more arguments>)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 171, in _git_maybe_shallow
_error(ctx.name, <2 more arguments>)
File "/.cache/bazel/_bazel_root/87af3c5419bb7fa67fef478eef56afff/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 181, in _error
fail(<1 more arguments>)
error running 'git fetch origin refs/heads/:refs/remotes/origin/ refs/tags/:refs/tags/' while working with @com_googlesource_gerrit_bazlets:
git-remote-https: symbol lookup error: /usr/lib/x86_64-linux-gnu/libhogweed.so.4: undefined symbol: __gmpn_cnd_add_n
INFO: Elapsed time: 6.387s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
couldn't build on my env
It seems that your env is totally broken. I would recommend to build on docker image then from GerritForge CI:
$ docker pull gerritforge/jenkins-slave-bazel:debian-stretch
Or install clean Debian/Ubuntu/Fedora/OpenSUSE/... distribution and Bazel is available there and it should just work.
Will upload pom.xml
in a moment.
Copy attached pom.xml file and it should just work:
$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ----< com.googlesource.gerrit.plugins.oauth:gerrit-oauth-provider >-----
[INFO] Building Gerrit Code Review - OAuth plugin 3.1.3
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gerrit-oauth-provider ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 11 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ gerrit-oauth-provider ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gerrit-oauth-provider ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/davido/projects/gerrit-oauth-provider/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ gerrit-oauth-provider ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ gerrit-oauth-provider ---
[INFO] Surefire report directory: /home/davido/projects/gerrit-oauth-provider/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.googlesource.gerrit.plugins.oauth.GitLabApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.227 sec
Running com.googlesource.gerrit.plugins.oauth.GithubApiUrlTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.452 sec
Running com.googlesource.gerrit.plugins.oauth.DexApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.googlesource.gerrit.plugins.oauth.KeycloakApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.googlesource.gerrit.plugins.oauth.Google2ApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.googlesource.gerrit.plugins.oauth.BitbucketApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.googlesource.gerrit.plugins.oauth.Office365ApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running com.googlesource.gerrit.plugins.oauth.AirVantageApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.googlesource.gerrit.plugins.oauth.Facebook2ApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running com.googlesource.gerrit.plugins.oauth.CasApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running com.googlesource.gerrit.plugins.oauth.GitHub2ApiTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Results :
Tests run: 15, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ gerrit-oauth-provider ---
[INFO]
[INFO] >>> maven-source-plugin:3.2.1:jar (default) > generate-sources @ gerrit-oauth-provider >>>
[INFO]
[INFO] <<< maven-source-plugin:3.2.1:jar (default) < generate-sources @ gerrit-oauth-provider <<<
[INFO]
[INFO]
[INFO] --- maven-source-plugin:3.2.1:jar (default) @ gerrit-oauth-provider ---
[INFO]
[INFO] --- maven-javadoc-plugin:3.2.0:jar (attach-javadocs) @ gerrit-oauth-provider ---
[INFO] Skipping javadoc generation, everything is up to date.
[INFO] Building jar: /home/davido/projects/gerrit-oauth-provider/target/gerrit-oauth-provider-3.1.3-javadoc.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.2:shade (default) @ gerrit-oauth-provider ---
[INFO] Including com.github.scribejava:scribejava-core:jar:6.9.0 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-databind:jar:2.10.0 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-annotations:jar:2.10.0 in the shaded jar.
[INFO] Including com.fasterxml.jackson.core:jackson-core:jar:2.10.0 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-annotations-2.10.0.jar, jackson-core-2.10.0.jar, jackson-databind-2.10.0.jar, scribejava-core-6.9.0.jar define 1 overlapping resources:
[WARNING] - META-INF/MANIFEST.MF
[WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-databind-2.10.0.jar define 657 overlapping classes and resources:
[WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.properties
[WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml
[WARNING] - META-INF/services/com.fasterxml.jackson.core.ObjectCodec
[WARNING] - com.fasterxml.jackson.databind.AbstractTypeResolver
[WARNING] - com.fasterxml.jackson.databind.AnnotationIntrospector
[WARNING] - com.fasterxml.jackson.databind.AnnotationIntrospector$ReferenceProperty
[WARNING] - com.fasterxml.jackson.databind.AnnotationIntrospector$ReferenceProperty$Type
[WARNING] - com.fasterxml.jackson.databind.BeanDescription
[WARNING] - com.fasterxml.jackson.databind.BeanProperty
[WARNING] - com.fasterxml.jackson.databind.BeanProperty$Bogus
[WARNING] - 647 more...
[WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-annotations-2.10.0.jar define 70 overlapping classes and resources:
[WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-annotations/pom.properties
[WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-annotations/pom.xml
[WARNING] - com.fasterxml.jackson.annotation.JacksonAnnotation
[WARNING] - com.fasterxml.jackson.annotation.JacksonAnnotationValue
[WARNING] - com.fasterxml.jackson.annotation.JacksonAnnotationsInside
[WARNING] - com.fasterxml.jackson.annotation.JacksonInject
[WARNING] - com.fasterxml.jackson.annotation.JacksonInject$Value
[WARNING] - com.fasterxml.jackson.annotation.JsonAlias
[WARNING] - com.fasterxml.jackson.annotation.JsonAnyGetter
[WARNING] - com.fasterxml.jackson.annotation.JsonAnySetter
[WARNING] - 60 more...
[WARNING] gerrit-oauth-provider-3.1.3.jar, scribejava-core-6.9.0.jar define 110 overlapping classes and resources:
[WARNING] - META-INF/maven/com.github.scribejava/scribejava-core/pom.properties
[WARNING] - META-INF/maven/com.github.scribejava/scribejava-core/pom.xml
[WARNING] - META-INF/services/com.github.scribejava.core.httpclient.HttpClientProvider
[WARNING] - com.github.scribejava.core.builder.ServiceBuilder
[WARNING] - com.github.scribejava.core.builder.ServiceBuilderCommon
[WARNING] - com.github.scribejava.core.builder.ServiceBuilderOAuth10a
[WARNING] - com.github.scribejava.core.builder.ServiceBuilderOAuth20
[WARNING] - com.github.scribejava.core.builder.api.DefaultApi10a
[WARNING] - com.github.scribejava.core.builder.api.DefaultApi20
[WARNING] - com.github.scribejava.core.builder.api.OAuth1SignatureType
[WARNING] - 100 more...
[WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-core-2.10.0.jar define 120 overlapping classes and resources:
[WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties
[WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml
[WARNING] - META-INF/services/com.fasterxml.jackson.core.JsonFactory
[WARNING] - com.fasterxml.jackson.core.Base64Variant
[WARNING] - com.fasterxml.jackson.core.Base64Variants
[WARNING] - com.fasterxml.jackson.core.FormatFeature
[WARNING] - com.fasterxml.jackson.core.FormatSchema
[WARNING] - com.fasterxml.jackson.core.JsonEncoding
[WARNING] - com.fasterxml.jackson.core.JsonFactory
[WARNING] - com.fasterxml.jackson.core.JsonFactory$Feature
[WARNING] - 110 more...
[WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-core-2.10.0.jar, jackson-databind-2.10.0.jar define 1 overlapping resources:
[WARNING] - META-INF/NOTICE
[WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-annotations-2.10.0.jar, jackson-core-2.10.0.jar, jackson-databind-2.10.0.jar define 1 overlapping resources:
[WARNING] - META-INF/LICENSE
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /home/davido/projects/gerrit-oauth-provider/target/gerrit-oauth-provider-3.1.3.jar with /home/davido/projects/gerrit-oauth-provider/target/gerrit-oauth-provider-3.1.3-shaded.jar
[INFO] Dependency-reduced POM written at: /home/davido/projects/gerrit-oauth-provider/dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.775 s
[INFO] Finished at: 2020-03-20T20:28:58+01:00
[INFO] ------------------------------------------------------------------------
Copy attached pom.xml file and it should just work:
$ mvn package [INFO] Scanning for projects... [INFO] [INFO] ----< com.googlesource.gerrit.plugins.oauth:gerrit-oauth-provider >----- [INFO] Building Gerrit Code Review - OAuth plugin 3.1.3 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gerrit-oauth-provider --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 11 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ gerrit-oauth-provider --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gerrit-oauth-provider --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /home/davido/projects/gerrit-oauth-provider/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ gerrit-oauth-provider --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ gerrit-oauth-provider --- [INFO] Surefire report directory: /home/davido/projects/gerrit-oauth-provider/target/surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.googlesource.gerrit.plugins.oauth.GitLabApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.227 sec Running com.googlesource.gerrit.plugins.oauth.GithubApiUrlTest SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.452 sec Running com.googlesource.gerrit.plugins.oauth.DexApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Running com.googlesource.gerrit.plugins.oauth.KeycloakApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Running com.googlesource.gerrit.plugins.oauth.Google2ApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Running com.googlesource.gerrit.plugins.oauth.BitbucketApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Running com.googlesource.gerrit.plugins.oauth.Office365ApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec Running com.googlesource.gerrit.plugins.oauth.AirVantageApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Running com.googlesource.gerrit.plugins.oauth.Facebook2ApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec Running com.googlesource.gerrit.plugins.oauth.CasApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Running com.googlesource.gerrit.plugins.oauth.GitHub2ApiTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec Results : Tests run: 15, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ gerrit-oauth-provider --- [INFO] [INFO] >>> maven-source-plugin:3.2.1:jar (default) > generate-sources @ gerrit-oauth-provider >>> [INFO] [INFO] <<< maven-source-plugin:3.2.1:jar (default) < generate-sources @ gerrit-oauth-provider <<< [INFO] [INFO] [INFO] --- maven-source-plugin:3.2.1:jar (default) @ gerrit-oauth-provider --- [INFO] [INFO] --- maven-javadoc-plugin:3.2.0:jar (attach-javadocs) @ gerrit-oauth-provider --- [INFO] Skipping javadoc generation, everything is up to date. [INFO] Building jar: /home/davido/projects/gerrit-oauth-provider/target/gerrit-oauth-provider-3.1.3-javadoc.jar [INFO] [INFO] --- maven-shade-plugin:3.2.2:shade (default) @ gerrit-oauth-provider --- [INFO] Including com.github.scribejava:scribejava-core:jar:6.9.0 in the shaded jar. [INFO] Including com.fasterxml.jackson.core:jackson-databind:jar:2.10.0 in the shaded jar. [INFO] Including com.fasterxml.jackson.core:jackson-annotations:jar:2.10.0 in the shaded jar. [INFO] Including com.fasterxml.jackson.core:jackson-core:jar:2.10.0 in the shaded jar. [WARNING] Discovered module-info.class. Shading will break its strong encapsulation. [WARNING] Discovered module-info.class. Shading will break its strong encapsulation. [WARNING] Discovered module-info.class. Shading will break its strong encapsulation. [WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-annotations-2.10.0.jar, jackson-core-2.10.0.jar, jackson-databind-2.10.0.jar, scribejava-core-6.9.0.jar define 1 overlapping resources: [WARNING] - META-INF/MANIFEST.MF [WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-databind-2.10.0.jar define 657 overlapping classes and resources: [WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.properties [WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-databind/pom.xml [WARNING] - META-INF/services/com.fasterxml.jackson.core.ObjectCodec [WARNING] - com.fasterxml.jackson.databind.AbstractTypeResolver [WARNING] - com.fasterxml.jackson.databind.AnnotationIntrospector [WARNING] - com.fasterxml.jackson.databind.AnnotationIntrospector$ReferenceProperty [WARNING] - com.fasterxml.jackson.databind.AnnotationIntrospector$ReferenceProperty$Type [WARNING] - com.fasterxml.jackson.databind.BeanDescription [WARNING] - com.fasterxml.jackson.databind.BeanProperty [WARNING] - com.fasterxml.jackson.databind.BeanProperty$Bogus [WARNING] - 647 more... [WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-annotations-2.10.0.jar define 70 overlapping classes and resources: [WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-annotations/pom.properties [WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-annotations/pom.xml [WARNING] - com.fasterxml.jackson.annotation.JacksonAnnotation [WARNING] - com.fasterxml.jackson.annotation.JacksonAnnotationValue [WARNING] - com.fasterxml.jackson.annotation.JacksonAnnotationsInside [WARNING] - com.fasterxml.jackson.annotation.JacksonInject [WARNING] - com.fasterxml.jackson.annotation.JacksonInject$Value [WARNING] - com.fasterxml.jackson.annotation.JsonAlias [WARNING] - com.fasterxml.jackson.annotation.JsonAnyGetter [WARNING] - com.fasterxml.jackson.annotation.JsonAnySetter [WARNING] - 60 more... [WARNING] gerrit-oauth-provider-3.1.3.jar, scribejava-core-6.9.0.jar define 110 overlapping classes and resources: [WARNING] - META-INF/maven/com.github.scribejava/scribejava-core/pom.properties [WARNING] - META-INF/maven/com.github.scribejava/scribejava-core/pom.xml [WARNING] - META-INF/services/com.github.scribejava.core.httpclient.HttpClientProvider [WARNING] - com.github.scribejava.core.builder.ServiceBuilder [WARNING] - com.github.scribejava.core.builder.ServiceBuilderCommon [WARNING] - com.github.scribejava.core.builder.ServiceBuilderOAuth10a [WARNING] - com.github.scribejava.core.builder.ServiceBuilderOAuth20 [WARNING] - com.github.scribejava.core.builder.api.DefaultApi10a [WARNING] - com.github.scribejava.core.builder.api.DefaultApi20 [WARNING] - com.github.scribejava.core.builder.api.OAuth1SignatureType [WARNING] - 100 more... [WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-core-2.10.0.jar define 120 overlapping classes and resources: [WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties [WARNING] - META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml [WARNING] - META-INF/services/com.fasterxml.jackson.core.JsonFactory [WARNING] - com.fasterxml.jackson.core.Base64Variant [WARNING] - com.fasterxml.jackson.core.Base64Variants [WARNING] - com.fasterxml.jackson.core.FormatFeature [WARNING] - com.fasterxml.jackson.core.FormatSchema [WARNING] - com.fasterxml.jackson.core.JsonEncoding [WARNING] - com.fasterxml.jackson.core.JsonFactory [WARNING] - com.fasterxml.jackson.core.JsonFactory$Feature [WARNING] - 110 more... [WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-core-2.10.0.jar, jackson-databind-2.10.0.jar define 1 overlapping resources: [WARNING] - META-INF/NOTICE [WARNING] gerrit-oauth-provider-3.1.3.jar, jackson-annotations-2.10.0.jar, jackson-core-2.10.0.jar, jackson-databind-2.10.0.jar define 1 overlapping resources: [WARNING] - META-INF/LICENSE [WARNING] maven-shade-plugin has detected that some class files are [WARNING] present in two or more JARs. When this happens, only one [WARNING] single version of the class is copied to the uber jar. [WARNING] Usually this is not harmful and you can skip these warnings, [WARNING] otherwise try to manually exclude artifacts based on [WARNING] mvn dependency:tree -Ddetail=true and the above output. [WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/ [INFO] Replacing original artifact with shaded artifact. [INFO] Replacing /home/davido/projects/gerrit-oauth-provider/target/gerrit-oauth-provider-3.1.3.jar with /home/davido/projects/gerrit-oauth-provider/target/gerrit-oauth-provider-3.1.3-shaded.jar [INFO] Dependency-reduced POM written at: /home/davido/projects/gerrit-oauth-provider/dependency-reduced-pom.xml [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.775 s [INFO] Finished at: 2020-03-20T20:28:58+01:00 [INFO] ------------------------------------------------------------------------
thx!!!!!!!!! It works for me
If I want to user OAuth with grant_type=password Any suggestions david?
What provider? I would read the spec if it is supported, and what has to be done. Then patch the code, done.
It is the login system of our company intranet I see that OAuth20Service supports the getAccessTokenPasswordGrant method internally, so how do I call it in the implementation of the OAuthServiceProvider interface? It seems that only the OAuthToken getAccessToken (OAuthVerifier rv) method is supported. The parameter is a credential, how to convert it into username and password
It looks like our request was blocked by oauthSession.isOAuthFinal in the filter
boolean isOAuthFinal(HttpServletRequest request) {
return Strings.emptyToNull(request.getParameter("code")) != null;
}
Any suggestions on how to introduce your own filter in Gerrit plugin?
I'm done, I revised the source code of Gerrit, monitored my keywords, let him jump to my Service, and completed the login; but different login methods seem to report an error, like: Cannot assign external ID "username: zhankangbao" to account 1000626; external ID already in use. Gerrit recognizes him as a new user. Is there any good way besides deleting the files under All-User?
@zhankangbao Please, consider to report problem in appropriate places. See project page for references: https://gerritcodereview.com.
Members of the community will discuss most Gerrit related things on the repo-discuss mailing list: https://groups.google.com/group/repo-discuss.
Bugs are reported to the issue tracker: https://www.gerritcodereview.com/issues.html.
I want to use maven to build him, accessing googlesource in China is too slow