How to download files from Gitlab account using java - java

I am writing one utility job in java to download JSON files from particular URL of Gitlab account and further process them according to requirement. I tried to do same using java-gitlab-api dependency. However, even after including below maven dependency,
I get error as :
Missing artifact org.gitlab:java-gitlab-api:jar:1.1.8-
The import org.gitlab cannot be resolved.
Maven dependency I am using is :
<dependency>
<groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>1.1.8-SNAPSHOT</version>
</dependency>
I tried to update, clean maven project but nothing worked. Anyone has an idea of how can I rectify issues and download files from gitlab account.

Use appropriate maven java-gitlab-api version(s). There is most recent version is available too.
https://mvnrepository.com/artifact/org.gitlab/java-gitlab-api/1.1.8
https://mvnrepository.com/artifact/org.gitlab/java-gitlab-api
<!-- https://mvnrepository.com/artifact/org.gitlab/java-gitlab-api -->
<dependency>
<groupId>org.gitlab</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>1.1.8</version>
</dependency>

Related

Updating Twitter4j in a Java project

I have an application that streams Twitter data using Twitter4j. In Maven Dependencies, I've got the 4.0.2 version, but I want to update to the 4.0.4.
How do I do that? In Configure Build Path it is not possible to edit the selection of the jar file.
This is the major advantage of using Maven, that it fetches the required jars and caches it for your further usage.
You don't have to download the updated JAR, just update the version number of the JAR in your Maven POM file and do a clean and rebuild.
When you do that, Maven will check your local repository (cache) and, if the jar hasn't already been downloaded, it will go to the maven repositories, find a copy, and download it (this is assuming you didn't do an offline build!), then it will use that copy to do your new build with.
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>4.0.4</version>
</dependency>
Hope that this helps!
Updating your pom.xml by adding this snippet in the dependencies section:
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>4.0.6</version>
</dependency>
Note, that there are several important fixes incoming with 4.0.6. For example, the support for enhanced_media_entities is added, which is quite important for compatibility reasons with Twitter API.
For more details about the API changes in 2016 check this link.

What is the best way of adding a jar file to a maven project if we could not find it the maven central repository?

I need to add the package "uk.ac.shef.wit.simmetrics.similaritymetrics"
to my maven project but I am not able to find any remote repository which contains it. I have to add it via dependency to the project, but not successful yet.
-I already added the jar file to the referenced library but in that wat I get the following error:
package uk.ac.shef.wit.simmetrics.similaritymetrics does not exist.
-Adding it through following dependency to the Pom.xml also does not help
<dependency>
<groupId>uk.ac.shef.wit</groupId>
<artifactId>simmetrics</artifactId>
version>1.6.2</version>
<scope>system</scope>
<systemPath>LocalPath\simmetrics-1.6.2.jar</systemPath>
</dependency>
Any help is appreciated!!
If this is a small project that you intend to only build locally or on a few machines then the simplest way is follow directions at the site below to add a 3rd party jar. Those instructions will help you install it in your local repository. You will need to do that for all machines that you intend to run the build on.
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
If you plan to run it on many machines then the best thing to do is to install the artifact to your own private repository. If that is the case then I suggest you create a project for it in version control. Then upload the file as part of that project.
I appear to be the current maintainer of Simmetrics. You can add this dependency to your pom file.
<dependency>
<groupId>com.github.mpkorstanje</groupId>
<artifactId>simmetrics-core</artifactId>
<version>4.0.1</version>
</dependency>
Simmetrics has been given a much needed serious overhaul since 1.6.2. You may have to adjust your code accordingly. For source code and documentation see https://github.com/Simmetrics/simmetrics

POM.xml error fix

I am very new to eclipse and maven repository. I got a project to config the errors of POM.xml. I fixed many of it, but I am unable to fix some. Following are that errors.
<dependency>
<groupId>jlibs</groupId>
<artifactId>jlibs-jdbc</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.jgodies.form</groupId>
<artifactId>forms</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
<scope>runtime</scope>
In Maven repository folder there are not all the files which are in the other folders, so I put them manually, but still no results.
All the Oracle realted jars are not the part of the Central Maven Repository.
May be the case with the other oracle related jars. That is the reason why its not able to resolve the dependencies.
You should create a separate custom repository on your company server where you can put all these jar and configure that in POM.xml. Maven will first check the Central reposiroty and if it does not find the files will later check the custom repositry.
For locally running Maven you will have to do a MVN Install manually. you should never manuallly copy any jars to the m2 repositiry
Getting the JDBC drivers is a bit tricky. Please check this article for directions.
Due to Oracle license restriction, there is NO public Maven repository provides Oracle JDBC driver. To use Oracle jdbc drive with Maven, you have to install it manually into your Maven local repository.

Java The import com.google.common.io.Files cannot be resolved

I am working on building and running an android application in Eclipse. I have successfully installed the Android kit, along with the google api. I went here: https://developers.google.com/maps/documentation/tracks/auth and followed the sample code.
However both com.google.common.io.Files and com.google.common.base.Preconditions are giving me an error.
any idea what I need to do next to get this issue resolved please?
To Solve this issue,
I went to this link : https://code.google.com/p/guava-libraries/wiki/Release14, downloaded the guava jar file. Then I added it to the classpath and compiled successfully..
If you are having a maven project you can add the dependency to the pom.xml as below.
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r05</version>
</dependency>
The above dependency would solve the problem.
Please refer the maven repository for the latest versions Maven Repo

Is there a maven repository for flash-selenium.jar?

I recently moved to maven project and since then I found adding dependencies very difficult. Before that I just needed to download the jar and add to library folder .
Now I am searching flash-selenium.jar dependency but I failed to find any. So I added it manually in my C:.m2\repository\org\seleniumhq\selenium\flash-selenium folder but still it is giving error. So how can I use this jar in my maven project?Its a request to people those have 1500 points here , could you please create a label for selenium flash related problems. Thanks
There's no flash-selenium dependency in maven central, but there are other artifacts like:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium</artifactId>
<version>2.0rc2</version>
</dependency>
the complete list:
http://search.maven.org/#search|ga|1|selenium
Maybe some of this fits what you need.

Categories