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

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

Related

Spring, Maven: Correct the classpath of your application

I am trying to create a maven version of the gradle-based treehouse 'unit-testing-a-spring-application' project used in this course. See course code here.
After not being able to build initially, I ended up adding dependency versions specified in the original gradle build file. Maven will build fine, but running the app gives this:
The following method did not exist:
org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)
Ljava/lang/String;
The method's class, org.springframework.data.repository.config.RepositoryConfigurationSource, is
available from the following locations:
jar:file:/C:/Users/home/.m2/repository/org/springframework/data/spring-data-
commons/2.1.6.RELEASE/spring-data-commons-2.1.6.RELEASE.jar!/org/springframework/data/repository/config/RepositoryConfigurationSource.class
It was loaded from the following location:
file:/C:/Users/home/.m2/repository/org/springframework/data/spring-data-commons/2.1.6.RELEASE/spring-
data-commons-2.1.6.RELEASE.jar
Action
Correct the classpath of your application so that it contains a single, compatible version of
org.springframework.data.repository.config.RepositoryConfigurationSource.
Several similar problems are solved here on S.O. by changing the version of some related dependency. I have tried various versions of the following to no avail (I stick normally with spring-boot-starter-parent v2.1.4 cause it works all the time with my projects):
spring-data-commons
spring-boot-starter-parent
I see the needed class below listed in my project Dependencies directory, but what dependency versions will work in this case? How can I solve this otherwise?
org/springframework/data/repository/config/RepositoryConfigurationSource.class
I looked at your code and found some mistakes. Since your project is a spring-boot one, you mustn't add direct spring dependencies in your pom file. Instead try to use spring-boot based dependencies. For instance, instead of having such this dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.9.2.RELEASE</version>
</dependency>
You must have the following one in your pom file.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

How to download files from Gitlab account using 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>

Why does Bintray Maven dependency snippet to copy include <type>pom</type>

I just spend all day trying to figure out why I was not able to include FontawesomeFX to my Maven project. It turns out that the dependency to copy includes an extra line that prevented my maven eclipse project from downloading the dependency.
So why is <type>pom</type> included?
So why is <type>pom</type> included?
Perhaps an unsatisfying answer, but this looks like a bug in Bintray. The artifact is not of type pom, and the suggested syntax appears to be wrong. (The suggested Ivy snippet makes the same mistake.)
JFrog do not appear to have a public issue tracker to report this without a support contract, but they suggest using the artifactory tag.
For comparison, the Central Repository shows the correct form:
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx</artifactId>
<version>8.9</version>
</dependency>
but doesn't include versions since 8.10.

Intellij can not resolve class of external library

Need a help !
I'm trying to connect spring security library to my project using Maven.
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
Library org.springframework.security.core have been downloaded successfully.
But when i'm trying to extend my class(AuthorizedUser.class) from org.springframework.security.core.userdetails.User
Intellij says, that can not resolve it. But other classes and interfaces from: org.springframework.security.core.userdetails resolving well. See the link...
When i goes to external library tree and opened org.springframework.security.core.userdetails library i saw User.class like this See the link...
Please, if anyone knows something about this problem, I'll be very thankful for any information
Windows 7
Intellij IDEA version 2017.2.4 Ultimate
Java version 1.8.0_144
Maven version 3.5.0
Maybe, you just need to create a constructor matching with super class or first try to create a class property instead of extending it just for test. apidoc
if it does not help, probably it is not related to ide, it is possible maven could not resolve dependencies because of some misconfiguration.
You can try these:
1- check local maven repository and confirm right version of jar files are there.
c:\users{username}.m2\repository\org\springframework\security
2- try build from commandline with following command and confirm build finish succesfully
mvn clean install
3- Try reimport all maven project
4 - Also, confirm intellij use right maven version, repository and settings xml. You can write "maven settings" on search bar, ant it will lead you to maven settings page.
if you find any of them is not as expected, let me know so I will try to help.

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