Reputation: 11
I've just tried to use gitlab4j API, in order to access a public GitLab repository, and I really don't want to restrict myself by adding authentication details, at least in the first step.
So, is there a way to access this repository as a public thing? and what is the most appropriate way to login and benefit from this API?
Note that the repository and project that I'm trying to access into, is Public access one.
Thanks.
Hi @AlexRudenko, Actually I've tried many ways, and after I find that the "AccessToken" way is the preferable one, I tried this: GitLabApi gitLabApi = new GitLabApi("gitlab.com", "MY_ACCESS_TOKEN"); List<Release> releases = gitLabApi.getReleasesApi().getReleases(14100417); System.out.println(releases.get(0).getName());
But, with no luck unfortunately, this is the error was occurring:
Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:405) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244) at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142) at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:444) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:182) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:27) at com.fasterxml.jackson.databind.DeserializationContext.handleSecondaryContextualization(DeserializationContext.java:682) at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:482) at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4178) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3997) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3072) at org.gitlab4j.api.Pager.<init>(Pager.java:95) at org.gitlab4j.api.ReleasesApi.getReleases(ReleasesApi.java:47) at org.gitlab4j.api.ReleasesApi.getReleases(ReleasesApi.java:33) at com.atypon.externaltaxonomies.GitLabTest.main(GitLabTest.java:31)
And the same error appeared when tried to use the ReleaseApi with the same ProjectId. So, I'm wondering here, am I using the Tags/RelasesApi in the correct way with regards to determining the project? or I missed something here?
Upvotes: 0
Views: 468
Reputation: 11
The last exception I mentioned, appeared bcz of dependencies-missed.
I've just added:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.0</version>
</dependency>
and everything ran as expected. closing...
Upvotes: 1