how the best way to create project with maven on eclips? - maven

i know there are 2 methode to create project with Maven.
Create Dynamic project on eclipse and convert it into maven project
Create Maven project with command line and then import the project into eclips.
i always do the 1. choise.

If You have latest eclipse IDE then its very simple.
Go to Create new Project wizard and search maven project. (if its old eclipse IDE then you probably need to install m2e plug in from market place).
select maven project and next. Check (Create a simple project) if you want customization other wise just click Next and You will be presented a number of ready made archtypes.
For simple console projects you can chose maven-archtype-quickstart. or what ever project you want to create.
Now Give groupId e.g. com.yourcompany or com.yourprojectgroup and artifactId e.g. projectname-alias . and Click Finish.
First Time eclipse will create local repo if its not already created and then put default dependencies defined by provided pom in your local repo. Further you just need maven knowledge to customize project. e.g. New Dependencies and build system etc.
I hope this will clear your mind. I prefer this way because its fast and easy.

If you create a new project in Eclipse (at least in Mars or Neon), you can choose "Maven Project" and get everything you need. Don't use eclipse goals of Maven. They are deprecated.

Related

How to make Spring Tool Suite like a multi-maven-module project?

I'm trying to create a Spring Boot project with multiple Maven modules. I've used the tutorial at https://spring.io/guides/gs/multi-module/ .
This site recommends a directory tree like this:
parent
application
src, and other subdirectories
pom.xml
library
src, and other subdirectories
pom.xml
pom.xml
I developed this project using Visual Source Code.
Wanting to see the project in another light, I tried to import the project directories into Spring Tool Suite. I'm using a recent one, where you apply the STS plugin to an up-to-date Eclipse installation.
Well, STS doesn't really like this project.
The (File, Open projects from file system) sees the project, but the Finish button doesn't actually do anything.
The (File, Import, General, Existing Projects into Workspace) imports a project, but as a Maven project (no "J" icon). When I try the (Run, Run Configurations) it won't see my project.
How can such a project be made friendly to Spring Tool Suite?
Thanks,
Jerome.
To make multi maven projects what you can do is, simply download two separate maven projects from start.spring.io and then extract them and move both folders to one parent folder and try grabbing the parent folder to Intellij, so it automatically downloads the dependencies and other requirement for the project in which we have two maven projects in one single entity
Eclipse can be a bit confusing with several different Wizards to import projects. Ironically the wizards are supposed to make importing projects easy, and in a sense they do... but... unfortunately picking the right wizard itself can be a bit challenging / confusing. Which wizard you use depends on the type of project.
Since your projects are maven projects, the best wizard to use would be the one for maven projects. You can find it at "File >> Import >> Existing Maven Projects".
So give that a try, point it at the 'parent' folder of your project and you should be presented with a relatively intuitive UI to import all 3 projects and configure them for use in Eclipse.

unable to create maven project in eclipse photon

I have been trying to create a maven project in eclipse photon.I also tried checking proxy settings,linked a "settings.xml" file in user settings,linked a "catalog.xml" under archetype.But it didn't worked.Eclipse is configured with java 8 version.I am unable to upload photos so i will describe.
These are the steps I followed while creating Maven project.
File->New->other->Maven->Maven Project->Next->Next->Selected Archetype-quickstart1.1->Next->provided Artifact and Group Id and Finish.
Here I'm getting could not resolve archetype error.
It's not very clear the issue you are facing and how you are creating the maven project. Eclipse comes with a great in built maven support. It's not necessary to configure settings.xml unless you are using your own repository instead of the default repository .m2
However assuming that you have installed Eclipse Photon correctly. Here are the steps involved in creation of simple maven project.
Click on File-->New-->Others.
On the new window look for maven and click on Maven Project.
This will launch new window **New Maven Project*. If you don't want to select available archetypes, then click on the checkbox named "Create Simple Project(Skip Archetype Selection)" and click on next.
Fill in your project details and click on finish. That's it.
Eclipse will generate a fresh maven project for you.
The other configurations are required based on the type of project you are creating.
Hope this helps !!!

Can i add my own project type?

I would like to add a new button here that creates a project with the SBT build system. How do i go about adding a project type in this menu?
Menu image found below
fabric8 project type picker
There are 2 options really
create a maven archetype (as in a tarball of stuff you wanna use as the basis of new projects); the tooling will then just work with your archetypes.
Note that the use of maven archetypes is just a way to package sample projects - it doesn't really matter how you build them. e.g. we use maven archetypes to create lots of different projects not using Java (Swift, Node JS, .NET etc)
If you have a sample project and don't mind sharing, we could clone it into the fabric8-quickstarts organisation & it'll get automatically included in the console in the next release
create a JBoss Forge addon. If you wish to create a custom wizard to create new projects using SBT, you can add a new addon to JBoss Forge and we (or you) can then install it into the fabric8-forge docker image

Add a remote Archetype Catalog in IntelliJ

I am new to IntelliJ but coming from Eclipse I expected Maven support to be far better. It really is but I could not find how to define a remote archetype catalog in IntelliJ (14.1).
All I could find was a way to add a Archetype manually but that is not what I need. I would like to point to a XML file on a remote server that contains the list of all archetypes available.
In Eclipse, it looks like this :
Maybe you would like to try an Intellij Plugin that I wrote yesterday. It enables you to add remote archetype catalogs to Idea: Maven Archetype Catalog plugin
To make my answer more clear: I had the same issue that it struggles me that you can add Maven Archetype Catalog files in Eclipse, but not in IntelliJ IDEA. So I tried to write a plugin for IntelliJ IDEA, so that you can actually define URLs to archetype-catalog.xml.
The plugin just parses those URLs and provides the Maven Archetypes to the list of available Archetypes in IntelliJ IDEA.
After installing the Plugin you can find a new entry in the Settings menu at File - Settings - Build, Execution and Deployment - Build tools.
I know this is kinda old thread, but in the future if some one will look for it.
This Maven Archetype Catalogs is a plugin for intellij that allows import external archetypes from a URL.
It solved my problem on Linux, haven't tried it on Windows.
To add this plugin go to File->Settings->Plugins->Browse repositories
in the search bar type "Maven Archetype Catalogs". Install and restart.
To use it go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven Archetype Catalogs. click the '+' and add the archetype-catalog
It seems that there is a plugin to do this - Maven Archetypes. The reviews are not favourable, and I have never used it though so cannot comment to its effectiveness.
You could also (assuming Windows/IntelliJ 14), edit C:\Users\<username>\.IntelliJIdea14\system\Maven\Indices\UserArchetypes.xml and add the archetypes manually. Not ideal, but still workable.
Screenshots are made in IDEA 14, I've also checked IDEA 13, it's also true for it.
If this is what you need
Then it's in the Preferences:

Why i should add dynamic web module when installing maven facet?

I want to add Maven facet to some project in Eclipse, but when I do that, it adds Dynamic Web Module to the project.
The first question is why ?
Second is how can I make it without adding web module??
thanks :)
I assume you are using MyEclipse, rather than just eclipse, with the m2e plugin. Also, I'm assuming the latest release of MyEclipse (2015 CI). If these assumptions are correct, note that the facet your are adding is for Maven Support of Java EE projects, which is why it is asking for the web project facet version. If you simply want to convert a java project to a maven project, right click on the project then select Configure->Convert to Maven project.

Resources