I was following this tutorial to understand the Spring and Hibernate. After I added the hibernate dependency like this:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.3.ga</version>
</dependency>
I got this error
Project 'SpringExample' is missing required library: 'C:\Users\gmuniandy\.m2\repository\hibernate\hibernate3\3.2.3.GA\hibernate3-3.2.3.GA.jar' SpringExample Build path Build Path Problem
.
I have downloaded the jar file and placed in the folder manually but the issue still remain. Please advice.
EDIT
I guess it is an wrong writing in thy pom.xml: Instead of "ga" use "GA" as Ragu already wrote.
Did you try already the downloadable project from the Website?
And what looks strange to me, I found no hint about case-sensitivity on maven.org, though maven uses case-sensitive match when matching against property values. Referring to Maven Model
May I suggest, that you follow this tutorial?
Accessing Relational Data using JDBC with Spring
At the bottom of the Article you will see a complete pom.xml which obtains the required and correct versions of libs from a inherited pom.
It should keep your pom short and simple. So you can better concentrate on your task rather than bothering around with libs at an early stage of your project.
Have you tried to clean up your local Maven repository and resolve dependencies again?
version is wrong -correct one 3.2.3.GA , In mvn repository you can search specific jar maven dependency.
Related
Here is the situation :
I want to use a locally installed jar in a springboot project. I included the dependency to this artifact in my pom.xml :
<dependency>
<groupId>org.mycie.myjar</groupId>
<artifactId>myjar</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
This jar uses the artifact snakeyaml with version 1.16
But in my main project, Springboot uses snakeyaml version 1.23
The concurrency seems to cause some issues when running the application.
Do you have any idea on the good practices to tackle this issue?
Maven will only let one of the jars into the resulting application. You can find out by calling mvn dependency:list which jar Maven chose.
The resulting problem cannot be really solved by Maven. Instead, you need to figure out which version of snakeyaml works for all scenarios. Since one of the jars belongs to you, it is probably best to just update the dependency of myjar to avoid this problem.
I am trying to use the javaFXGL library. Which is the java gaming library. I am not sure how to use maven to download the library to eclipse. Does anyone know a step by step way to download this. I need to this get some example code running.
I would be easier to get the help if you add your code in the question along with the problems/errors you are facing. Anyways I would suggest you to first read this and this to understand what is maven and how it works with Eclipse IDE.
After reading the articles you will understand that maven project has pom.xml file which is used for maven settings or you can say for Dependency Management, Build Management, etc.
To add the library you need to add its maven dependency in the pom.xml inside the <dependencies> tag like below:
<!-- https://mvnrepository.com/artifact/com.github.almasb/fxgl -->
<dependency>
<groupId>com.github.almasb</groupId>
<artifactId>fxgl</artifactId>
<version>0.2.9</version>
</dependency>
You can also find other dependencies on www.mvnrepository.com
I'm not familiar with using java package. Now I'm given a set of java files that import plenty of stuff. But there's no pom.xml file provided.
First I tried to directly compile the files, but was told com.amazonaws is not found. So I think I may need to download all the dependencies. But there are simply too many import statements so it seems not very practical to download them one by one manually.
Then I found that I may use maven. But after I tried creating this pom.xml
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.341</version>
</dependency>
</dependencies>
and use mvn package. I got an error telling me building failed. I thought that might be because I didn't specify all the dependencies. Is there a way to automatically pull dependencies based on import statements in the java files?
Maven is the right way to go. And you've made a good start.
Although Maven is very good about pulling "implicit dependencies", it can't "guess" everything. It sounds like you're going to have to add just a bit more to your pom.xml
SUGGESTIONS:
Read this:
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-project-maven.html
Post the specific errors you're getting with your current pom.xml. Be sure to copy/paste the exact errors, along with updating the exact contents of the pom.xml that you used in that iteration.
Using MVN is best approach to add dependencies to you project. You need to write some more stuff in your pom.xml . You can go through this example https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html to create a maven project step by step
I have just started to learn Spring using Maven. Can somebody clearly explain?
In your codebase, you will have a multitude of packages. Each of those packages will have a pom.xml file which have maven dependencies in there. Those are the dependencies that get pulled in when doing an 'mvn install' on that particular package. E.g. one of your packages which uses spring will probably have this :
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
Further, your package will also depend on other packages, and so will have dependencies on those packages. Each package gets a .jar file of its own when built (which contains .class files). A certain package doesn't rely on all other packages in the codebase, so it just pulls in the ones needed. These packages can be published and pulled in from a locally hosted Artifactory, and in the case of spring it probably gets pulled in from an online maven repo.
The fetched artifacts (.jar files) get put into a hidden repository folder (mine's called .m2/repository) which you can configure in your IDE, and the fetching is done smartly. If it exists already, it won't do the effort to pull in a new one. If you however do want to override the currently fetched artifact, look at this question I asked when I was struggling to understand maven myself.
Notice the < version > tag. This tells maven the version to fetch, and if it sees that version already exists (I'm not sure how it checks, it probably looks at the folder name or some file inside like MANIFEST.MF) it doesn't bother fetching it. In case you have a dependency which has frequent updates, changing this version field all the time can be bothersome, you can make it such that it fetches the latest all the time.
Hope that helps.
I've installed m2eclipse, and using the embedded Maven3.
Now I want to add dependencies to my project(there are existing jars), but the search result is always 0, how do I deal with this ?
I don't want to download all jars for now, just want to create the dependencies now.
"spring" and "spring" are not valid specifiers for the Spring libraries.
Here is a link to a helpful article about artifact names for Spring:
http://spring.io/blog/2009/12/02/obtaining-spring-3-artifacts-with-maven/
You should be using names like:
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
if you want to convert a project to eclipse maven project, you can open terminal and run
mvn eclipse:eclipse
or convert to idea maven project:
mvn idea:idea
Try searching for spring-context instead of spring. If you are not sure about the name of the artifact you are looking for you can use wildcards, eg *spring*.
The dialog in your question is a bit confusing. It's actually two dialogs and should be using tabs. In the upper part, you can manually add a dependency if you happen to know all the details.
In the lower part, you can search for dependencies. The search will only work if you leave the fields at the top empty.
Let me see, you want to use along with the maven dependencies existing in the project, right?
Assuming your project structure already in structured maven, you can follow this tip below, but beware, i think maybe you can have some sort of conflict between dependencies..
https://stackoverflow.com/a/11320920/1133742
http://charlie.cu.cc/2012/06/how-add-external-libraries-maven/
Use the website below to browse dependencies:
http://mvnrepository.com/