IntelliJ and Maven - Can't create a maven project - java

I have the newest IntelliJ, and the create Maven project button is gone. I also cant find it in any of the lists.
See the intellij menu
You can see the difference here, in IntelliJ's Getting Started with Maven page:
https://www.jetbrains.com/help/idea/2016.1/getting-started-with-maven.html
Anyone know how to get it back?
I want it because then you get the structure, and the pom.xml file automatically.

You need to install the Maven plugin.
Go to Plugins (in IntelliJ; press shift-shift, and search for "plugins"). In Plugins window, search for Maven and install the Maven Plugins.

You can create java project and later right click on your project -> add framework support -> choose maven.

Related

Why do i can't to add library in maven?

I use intellij IDEA 15.0.3 and it has a built-in version of maven. When I try to add a library (mysql-connector), maven can't seem to find it.
image
If you did not tell Intellij to download dependencies automatically, it will continue showing like that on the picture. There are possible ways to follow. You can build your project with mvn clean install or you can change the settings of intellij to download artifacts automatically or you can triger download by clicking the button on the maven menu of the intellij.

Create Camel project with Eclipse

I am trying to create a camel project using only the Eclipse IDE. Apparently, the newest versions of Eclipse have Maven support out of the box, so there i no need to install the m2e plugin. Still, I cannot create a camel project using Eclipse (even with m2e plugin) because the camel archetypes don't even appear ! What am I missing?
I decided to take 4 screen shots to save your time and and so you can understand the problem:
Eclipse version and m2e plugin details
Using the Maven wizard to create a new project
Creating a default project
Using the filter to search for camel archetypes
At first I assumed that the problem was mine, and that I was typing something wrong in the filter. But after searching for all the archetypes available, I still could not find anything related to camel.
And thanks for the help guys, you're all being great.
Try another way around. Generate with maven Camel project and import it into eclipse:
Instructions for creating Camel project from maven are on Camel site
And then use:
mvn eclipse:eclipse
to generate eclipse workspace that you will import.
If you want to do it from eclipse you should add catalog for Camel archetype , so you should go to: Window / Preferences / Maven / Archetype / Add Remote Catalog...
Or
when you are creating a maven project press "Add Archetype" button, and enter following values:
groupId:org.apache.camel.archetypes
artifactId:camel-archetype-java
version:2.12.1
URL:http://mvnrepository.com/artifact

How to build and run Maven projects after importing into Eclipse IDE

I am learning building a Java project in Eclipse using Maven. I created a Java project HelloWorld from
“maven-archetype-quickstart” template in a folder D:/maven_projects. Then to convert the Maven project to support Eclipse IDE, I navigated into the project folder and issued the commands:
mvn eclipse:eclipse and mvn package .
Then I imported the project in Eclipse and did the necessary Eclipse configurations like setting the Maven local repository in Eclipse classpath. Now the project in D:/EclipseWorkspace folder. I ran the project successfully in Eclipse printing "helloworld".
Now if I want to go on develop the project and for that reason want to add new dependencies in pom.xml in Eclipse, then the new jars are not added in classpath when I run the project.
So my question is after importing a Maven project into Eclipse how can I add more and more dependencies in pom.xml, then build and run the project? What is the recommended and efficient way to do this?
I would recommend you don't use the m2eclipse command line tools (i.e. mvn eclipse:eclipse) and instead use the built-in Maven support, known as m2e.
Delete your project from Eclipse, then run mvn eclipse:clean on your project to remove the m2eclipse project data. Finally, with a modern version of Eclipse, just do "Import > Maven > Existing project into workspace..." and select your pom.xml.
M2e will automatically manage your dependencies and download them as required. It also supports Maven builds through a new "Run as Maven build..." interface. It's rather nifty.
1.Update project
Right Click on your project maven > update project
2.Build project
Right Click on your project again. run as > Maven build
If you have not created a “Run configuration” yet, it will open a new configuration with some auto filled values.
You can change the name. "Base directory" will be a auto filled value for you. Keep it as it is. Give maven command to ”Goals” fields.
i.e, “clean install” for building purpose
Click apply
Click run.
3.Run project on tomcat
Right Click on your project again. run as > Run-Configuration.
It will open Run-Configuration window for you.
Right Click on “Maven Build” from the right side column and Select “New”.
It will open a blank configuration for you.
Change the name as you want. For the base directory field you can choose values using 3 buttons(workspace,FileSystem,Variables). You can also copy and paste the auto generated value from previously created Run-configuration. Give the Goals as “tomcat:run”. Click apply. Click run.
If you want to get more clear idea with snapshots use the following link.
Build and Run Maven project in Eclipse
(I hope this answer will help someone come after the topic of the question)
Dependencies can be updated by using "Maven --> Update Project.." in Eclipse using m2e plugin, after pom.xml file modification.
Just install the m2e plugin for Eclipse. Then a new command in Eclipse's Import statement will be added called "Import existing maven projects".
answer 1
Right click on your project in eclipse
go to maven -> Update Project
answer 2
simply press Alt+F5
after updating your pom.xml. This will build your project again and download all jar files
Right Click on your project
Go to Maven>Update Project
Check the Force Update of Snapshots/Releases Checkbox
Click Ok
That's all. You can see progression of build in left below corner.
When you add dependency in pom.xml , do a maven clean , and then maven build , it will add the jars into you project.
You can search dependency artifacts at http://mvnrepository.com/
And if it doesn't add jars it should give you errors which will mean that it is not able to fetch the jar, that could be due to broken repository or connection problems.
Well sometimes if it is one or two jars, better download them and add to build path , but with a lot of dependencies use maven.
If you are getting this error :in cucumber Exception
Cucumber Exception: java.lang.ClassNotFoundException:
cucumber.io.ResourceLoader :
then add following jar file to your pom.xml
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.1.8</version>
</dependency>
Run the maven build once and should be gone

m2eclipse project - missing 'update dependencies'

I checked out a maven project and imported to my Eclipse (Indigo) with maven integration via the m2eclipse plugin. I configured the project as a maven project. When I r click on my project and click Run As... I'm able to see all the maven configurations (maven build, maven clean, maven install etc.) The project icon has an m indicating that it's a maven project. When I r click an go to Maven I'm able to see
Add Dependency
Add Plugin
New Maven
Download Javadoc
Download Sources
Update Project
Disable Workspace Resolution
Disable Maven Nature
-I was told that I'd be able to see 'Update Dependencies' under the Maven menu but it seems to be missing. Is this to be expected given my Eclipse version or something? Or do I have to configure the project in some way to get 'Update Dependencies' to show up under the Maven menu?
Are you able to see the option "Convert to Maven Project" under the "Configure" menu?
This answer is based on m2e in Eclipse Helios, I haven't tried it in later Eclipse versions yet.
On the latest m2e version I installed today, I've found I need to go to Maven / Update Project... in the context menu, then select the options you want. (The Update Dependencies option seems to be fixed in the "on" position on mine.)
It may be that the current version can still be configured to show the menus as they used to be; I don't know. I say this because my old version was of a later date than the original post here, but still had the Update Deps and Update Project Conf options in the Maven menu.

Maven option is not found in Eclipse

I am in Eclipse Indigo and I have installed m2eclipse plugin. I saw in Eclipse Helios there is an option Maven in the right click menu, when I clicked on a Project, but this option is not present now.
I have installed Maven from both of the marketplace and also from adding site in Install new software option in Eclipse(Help->Install New Software).
What I am doing wrong.
This question was asked before in SO, but I tried the solution provided there.
Is this option is really not present? What I want is to enable Maven Dependency Management of a Dynamic Web Project of Eclipse.
You have to do a right click on the project, then choose Configure → Convert to Maven project
Right Click on the Project --> Configure --> Convert to Maven Project.
It will show Maven Related Options.
One way is to import the project as Maven project.
If you are trying to install in Eclipse older versions, use YOXOS Marketplace - by EclipseSource. Search for "Maven" in marketplace. You will get Maven Integration for Eclipse provided by Sonatype. Use that to install.
After installing m2eclipse plugin, go to Window -> Preferences. Check "Maven" is enlisted at the left panel list
this happened to me because I imported a parent folder as a project. so all my projects where sub directories of this parent folder and not a project them selves. after deleting them (only) from the workspace and re importing them as separate projects, maven worked fine.

Categories