Eclipse project structure ANT and MAVEN - eclipse

I am trying to set up a project, but feel completely overwhelmed with lack of knowledge. In university we used netbeans which resolved project structure gently for us. As community leans towards eclipse I am trying to migrate there, but feel myself like a penguin not able to fly. I can't understand project structure where and what has to be added, do I have to define ANT or MAVEN manually in eclipse can they be integrated? Where to go ? Apache manuals are so complicated, why is that I can program in Java , but don't know the fundamentals, soo depressed, please anyone guide me. I find pieces on web, but seems can't build full picture in my head.

You have a couple of options. Basically, eclipse uses a workspace, which contains one .metadata directory used by the plugins and all of the project folders. Projects can then be things like java projects, PDE projects, PHP projects, etc.
There is maven integration in eclipse which I would use, http://www.eclipse.org/m2e/ It was part of Indigo, which released June 2011.
Set up your java projects in your workspace, and then use m2e to mavenize them, or use m2e to generate the java projects into your workspace.

maven provides a facility to create a new project with the required structure based on the type of project (jar, war, etc.).
You can do this or achieve it directly from Eclipse as suggested by Paul Webster, by installing the m2e plugin.
This structure can then be easily built using maven, as well as developed in Eclipse.

Related

Eclipse and MyEclipse Using Same project Different Settings

I am working on a java project. The developer who started working on it is pretty firm on using myeclipse and I am pretty firm on using eclipse. Is there a way I can use the project settings that would not conflict with MyEclipse. When I open the project in Eclipse, I see a lot of myeclipse jar files for Java EE and what not. He's not using maven.
You will need to keep your project folders private and only share the source. Both of you cannot use the same project metadata.
Sharing metadata will cause both of you pain. And even more when upgrading to newer versions of eclipse and reading old projects.
Our solution was to switch to maven, and NOT having any metadata in source control repository. The m2e plugin then generates exactly the metadata you need when you import the maven projects in Eclipse.
An added benefit was that suddenly our projects worked with Netbeans and IntelliJ without any extra effort.

Differences in NetBeans and Eclipse for maven projects [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What are the differences between Netbeans and Eclipse for working with maven projects?
I'm Eclipse user, but to be perfectly honest I have to say that Maven support in Eclipse isn't perfect and often cause weird errors you resolving by cleaning, recompiling, regenerating project files etc.
As far as I know, IDEA and NetBeans have far better support for Maven.
NetBeans has native support for Maven.
What does that mean exactly? It means that if you have a Maven-based project in NetBeans then the pom.xml is what the IDE uses for project definition. The POM is the definition!
Contrast this with Eclipse where Maven support is bolted on top of Eclipse's project definition. This means that any Eclipse solution will have to concentrate on converting to/from Eclipse's own project definition and the POM. I believe this is the root cause of Eclipse's sometimes-less-than-optimal Maven support.
In NetBeans, if your project is Maven-based, then all actions are carried out by Maven. Even the "run" action is effectively done by Maven. The IDE only triggers it. Having this consistency means that you can be sure that your project behaves exactly the same for example if in a non-IDE environment such as a Jenkins/Hudson.
I've met many people who believe that Maven is cumbersome. When you talk some more about it turns out that their bad experience to a large extent comes down to their experience with Maven from within Eclipse, not so much Maven itself. Users of Eclipse tend to think that this is just the way it is supposed to be because they've never seen anything else. (NetBeans users do the same in the opposite direction in the areas where NetBeans is sub-optimal and Eclipse shines)
Let there be no doubt: Eclipse has MANY virtues. Maven support is not one of them.
Starting on an maven based project is much more easier in Netbeans and IDEA than using Eclipse.
in Eclipse, you have to configure your existing project to use maven. Starting by enabling a appropriate maven plugin
using Netbeans and maven is much more easier. Open -> Projekt -> select the pom.xml and you are ready
IDEA has a similar approach. You simply have to import a the project from the existing pom.xml
I have chosen IDEA as my favorite IDE and I'm quite happy with the maven support. Sometimes I have to open NetBeans and at least the maven support works as expected. My own experiences with Eclipse are a little bit outdated but I hear a lot of complaints from my colleagues using Eclipse together with maven.
m2e is the "latest" maven eclipse integration (not to confuse with the old m2eclipse). I really thank all people who spend their time in developing eclipse, maven and m2e - it's my daily work setup, but m2e is far from perfect. Just have a look at the latest "M2E plugin execution not covered" dilemma. If you use non mainstream plugins you have to modify your pom.xml for the m2e usage - just to avoid project errors in eclipse.
To run my mave commands I prefer the command line instead m2e.
As I know Netbeans uses maven more "native" and therefore has not that kind of integration problems. But I am not sure about it. If you have the choice you should compare both possibilities.
I've used both Eclipse and Netbeans. I've used Eclipse more at the university, and professionally it was mixed between Eclipse and Netbeans.
Eclipse is far better than Netbeans depending on the domain.
If you want to work with scala - no other way, eclipse scala plugin is heavily maintained and works much better than Netbeans. If you want to work with perl, same thing.
If you have a massive project with more than 50 large modules and need to do cross cutting refactoring, you are faster with mvn eclipse:eclipse on your root pom, and leting eclipse import and build the project, and then starting with your refactoring.
With that said, when you are doing feature development. And your base project is built in the CI by maven. Oh! Then I can promise you, Netbeans is light years better than eclipse. They are not in the same league when you add maven as the build tool into the equation.
With eclipse, you have to give in and say:
- It is beyond me I let eclipse work as my own built tool and I keep away from the command line. If I even go to a folder and do mvn clean install, eclipse with fight against me.
With netbeans, he just does not try to re-invent the wheel. He lets maven do what maven does, and build your project. It runs your tests with surefire.
In my personal opinion, for Java EE development - namely adding features and "NOT" doing cross cutting massive refactoring and your project is built on maven, Netbeans is by far the best IDE. It is perfect.
It is simplicity in itself. A simple and confortable user interface.
A perfect debugger.
Perfect JSF to bean navication.
Perfect maven integration.
Perfect colaboration with Jrebel.
Netbeans is simple and super effective.
I've found Eclipse to be my enemy, when i want to use maven to run all unit tests or for wahtever reason. If I want to deploy a WAR built by maven ... better not! I need to absolutely give myself into eclipse and let it own everything. I need to keep well away from a command line.

Migrate Java web project from netbeans to eclipse

I have looked at some forums on how to migrate Netbean’s java project to eclipse. But I was looking for a way how to migrate Netbean’s java web project (I used JSF and Primefaces) to eclipse. Since the project is not that much big, I will also dedicate my time to do it manually. But, I have not sure on how to do that. Should I have to move just packages, classes, jar files and xml files manually? I don't have a knowledge in maven or scripting as well.
Thank you for your help guys.
Convert your application to a Maven application, that way you can have portability between any of the major IDEs.
If you haven't done anything odd with your build scripts then its as easy as copying and pasting into your new project.

How can I execute Maven goals from Eclipse without M2Eclipse?

I am using the eclipse plugin for maven to generate eclipse projects from maven pom.xml files.
mvn -Dwtpversion=1.5 eclipse:eclipse
This works fine and, after some experimenting with several of the 400 different archetypes available, I settled on using the webapp-javaee6 archetype, which was the only one which generated a set of dependencies that were both all available and which created a project that was useable by the WTP plugin.
The problem now is that I would like to be able to invoke mvn goals from eclipse. The accepted way to do this I understand is to use the m2eclipse plugin, which I have installed.
However, after playing around a bit and getting nowhere I discovered this comment in my .project file:
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
Further searching (see this lengthy diatribe from October) suggests I'm not (just) being stupid in not being able to get this to work.
The how-to linked in the top answer to this question seems hopelessly out of date.
So, the real question - what is currently the correct way to use maven to generate a WTP-friendly project that can be converted to eclipse and then use eclipse to call the project's goals?
Have you tried File -> Import -> Check out existing Maven Projects from SCM? My understanding is that m2eclipse will then create the eclipse project for you. If the packaging defined in the pom is war, the project should be deployable with WTP. (The latter used to require an the maven-wtp-integration plugin as well, don't know whether that's still the case).
Not sure about WTP or maven archetypes, but have you come across SpringSource Tool Suite (Spring packaged eclipse) and created a Spring Roo project? You can use this to create a data driven maven built web-app in a few mins. You can even remove the spring roo bits if you don't want them, it will give you a good starting point for a web-app with very little pain.

Managing external jar dependencies

I'v written a selenium framework which needs to be extended to the team. I've checked in the code in SVN. How can I make sure that external jars are added to build path and folder that folder by other team members? Basically I want to manage these dependencies better. Somebody said, Maven can take care of these so I tried to install m2eclipse plugin for eclipse 3.2 without any success. Can Maven solve this problem and is there any better way of managing it?
Do the easy way: commit the jars into SVN. It will save everybody a lot of time.
If you are amenable to using Eclipse, Maven, and m2eclipse, I would suggest using SpringSource Tool Suite. It is an Eclipse based IDE with Maven and m2eclipse pre-bundled. This bundling makes getting those three tools to work together very easy.