I followed this Getting Started with Spring/Maven Tutorial to well, get started with spring and maven. I thought Maven helps me with deploying libraries/dependencies etc.
But in the tutorial for maven, there are two libraries (joda/hamcast) already, which are not included in IntelliJ. If I just follow the guide though, nothing works as its stated there, I have to manually download the .jar files and add them to my Project Structure.
What is to gain here or did I understand Maven wrong?
EDIT: You wanted additional information, which I will provide now to clarify things. Thanks for all the replies so far!
After adding the joda dependecy as stated by the tutorial, the first maven compile downloaded the .jars. Nevertheless, it is saying "No sources to compile" and "BUILD SUCCESS". Still, in my project, LocalTime is still red and unknown, even after refreshing/rebuilding the project.
The "reimport" feature solved my problem, thanks everyone!
In the Intellij Idea this can be accomplished by using "Reimport all Maven Projects"
Related
Trying to migrate an ant project to the maven project and was able to use translate to the maven project feature of the eclipse. Though I have an idea of working with maven projects so far, but still would like to know if there are any best practices to follow while migrating it.
Also, would really appreciate if anyone can help like how to set up the same on bamboo that would be ideal for all the working developers.
The steps achieved so far are :
Created pom.xml with all the required jars and repositories.
Created a local .m2 folder with dependencies present and installed.
I would like a meaningful transition from ant to maven. I know how things work on local but when it comes to deploying it to bamboo, I am a bit confused with so much distributed information on the internet.
Any specific leads would be really helpful
I'm following this tutorial: http://spring.io/guides/tutorials/rest/ to get familiar with spring/REST. However, the git repo (git clone https://github.com/spring-guides/tut-rest.git) has many individual java projects each with their own gradle build. I'd like to edit the code in Eclipse, as that's the whole point, but this hasn't proved trivial.
So far, I've created a general project for the git repo, and then separate java projects for each of the folders from the repo, linking the source in my java projects to the source/test folders in the repo. This has worked great except that I don't have the spring jars in my dependencies for the java projects, I get a ton of errors as well as lose the nice autocomplete of function names, etc.
What is the correct way to fix this? It seems like there isn't a good way to install the jars for spring in each java project without using maven or some other build tool, which seems redundant and inefficient since I can build the source from the repo project. If this is the case, should I make a build for each separate project even though the idea for the tutorial is that they each come with gradle?
Thanks for your help, and please excuse the slight open endedness of it--I'm not sure I'm on the right track.
I have a project implemented in ADF.
I need to build it using Maven now.
I wrote the POM but now stuck at adding dependancies.
There are way too many JAR files, specifically about ADF, Toplink etc which I believe I will need to put in my POM.
Now, only way till now i could figure out is to go to each JAR, open manifest file, get version etc, and then get the dependancy block from maven online repository.
Is there a diff and easier and faster way of doing it.
Please help!!
Note: Chances are high that my question may sound illogical or stupid cause I have been using maven only for a week now.
-Santosh
If you are using a decend IDE, it could resolve your dependencies for you. If it can't import a class, you can ask it to look up the class in the Maven repository. Then you can choose which dependency to add to your pom.xml.
As a matter of fact the project compiles just fine with eclipse as well but for some reason IntelliJ is not able to deal with it.
We have other large multi-module projects which load just fine - so I don't think this is a general problem with using maven with intellij.
Anyone else faced similar problems please share ideas on fixing this problem.
I am sorry I cannot post the pom for the project here but in general what I see from the way the pom is structured is that the common dependencies are in a parent pom. If I keep copying some of the dependencies to child modules I can get the compilation to move forward but I still do not get why I need to do this at all.
For the better Maven 3 support it's recommended to use the latest IntelliJ IDEA version (12.1.2 at the moment of this writing). There is an option to Use Maven3 to import project that should be enabled.
I'm expiriencing multiple compilation errors in my project, most of the code is in red, but the strange(or not) thing is that while building the project with maven everything is build successfully and the war is assemled as it should be.
The thing is that auto suggest is not working because code is not compiling. What can I do to fix this?
I'm using eclipse, sorry
UPDATE:
I've tried all suggestions below but none worked
If you are using Eclipse, try Project > clean.. your project.
I don't know why, but Eclipse sometimes just think your project was wrong but it's not. Clean it to entirely build it again.
If it's Eclipse do
Project > Clean
then right click at the parent-most project and do
Maven > Update Project Configuration
Maven > Update Dependencies
I guess you have m2eclipse installed, already.
Use a maven plugin in your IDE
plugin for eclipse
plugin for netbeans
Most likely you have to include external libraries/dependencies in your IDE. It seems when you're building with maven, those dependencies are solved for you.
Some IDE's support Maven projects, try to see if yours does.
You haven't specified what IDE you're using or what the errors are, which makes it pretty hard to give you advice. My guess is that you haven't configured your project (or whatever the equivalent IDE concept is) to tell it the libraries you're using... whereas the Maven build file already contains that information.
EDIT: Okay, so it can't find the right libraries. Options:
Use a Maven plugin and let it manage the project
Edit the project's build path and explicitly tell it which jar files to use.