Importing Java Web EE Netbeans Project to Eclipse - eclipse

Looking for a clean way to export a NetBeans Java Web Project (Java EE) to Eclipse.
Already tried importing the war file, but it outputs many errors. I think because EJB object is not contained there.
Netbeans project has a connection with PostgreSQL, and Glassfish server, everything installed on my Windows PC. It's using the EJB module, and it features a REST implementation, with JPA persistance.
Using Netbeans 7.2 and Eclipse IDE 1.5 (latest)
Here is a view of the Netbeans project:
Below is the project resulted from the import of the war file (generated by Netbeans) in Eclipse.
Which would be a clean way to do this?
I can also hear ideas about importing it to IntelliJ Idea.

Solution took long, but here are the basic steps:
Create empty EAR Project In Eclipse, add 2 modules, EJB and Web Module. Then added JPA facets to the EJB project. Imported src folders. Then exported the EAR Project to to JBoss (changed Glassfish, no particular reason).
Basically 1 project in Netbeans is equivalent to 3 projects in Eclipse in this case.

Prepare to get your hands dirty.
Netbeans uses Ant build scripts by default. These scripts cannot be directly converted to work with Eclipse.
The way I did it was to create a Maven project in Netbeans and copy all source files from the Ant project to the Maven project. Eclipse provides a Maven plugin which enables you to work with Maven projects. Maven projects (if set up correctly) tend to be IDE independent.

You could try to create new project in Eclipse, and choose "Create project from existing source". Then point src folder from NetBeans project. You probably will need to organize your REST services etc by yourself, but I think that is the way.

Related

Eclipse-Kepler, Maven and Setup Tomcat 7 debug (hot deploy)

I have maven based project with following structure:
main_project
module_webproject
module_java_proj_1
module_java_proj_2
module_java_proj_3
... ...
Everything compiles and packages fine with command line maven goals execution. I need to setup this project into eclipse environment for developers with tomcat deployment. Anyone know setup instructions?
Also, i am looking into tomcat hot deploy for debugging capabilities.
I have tried mvn eclipse:eclipse, this does only creation of .project and .classpath files. But projects directories are not treated as java or web projects.
Answer from following forum some what helps...
[Running Maven project on Tomcat from Eclipse
There can be a few reasons why you don't see the project in the Add/Remove projects dialog for Tomcat. Verify the following:
You have m2e installed (http://eclipse.org/m2e/download/)
You have m2e-wtp installed (http://www.eclipse.org/m2e-wtp/download/)
Your Maven project imported as a Dynamic Web Application. Look for a Deployment Descriptor entry when you expand the project, it should be somewhere in the first few entries. It is the second one down for me on Eclipse Juno. Not there? It's probably not a web app. Go back and verify 1 & 2, then remove and re-import your project.
Make sure that your web application is not too new for the version of Tomcat that you are using. Right-click the project and go to Properties > Project Facets. Look for Dynamic Web Module and check the version. If this version is too new for your Tomcat version, Eclipse won't let you add it. For instance, your Dynamic Web Module version is 3.0 and you're using Tomcat 6.

Eclipse glassfish plugin not publishing maven dependency jars to ear lib folder

I'm using the Eclipse "Internal Glassfish 3.1.2.2" server with the Eclipse Glassfish plugin (http://download.java.net/glassfish/eclipse/juno). I'm also using Maven with the m2e Eclipse plugin. The Glassfish plugin correctly deploys my EAR modules to the Internal Glassfish, but it does not deploy my dependency jars, which I believe should end up in a folder called "lib".
I found a partial solution here, which is to add my maven target lib folder to the EAR Deployment Assembly (double-click in the Deploy Path box to edit). This works, but m2e (or m2e-wtp) undoes the config change when I do Maven > Update Project.
There ought to be a cleaner solution. The Eclipse Ear Module Assembly dialog has a field to name the "EAR library directory", so it's aware of the lib folder. Where does Eclipse EAR assembly (without Maven) look for jars to put in the lib folder? I assume the Glassfish plugin is looking in the same place.
You can use the following steps to find the source of the problem:
Take Eclipse out of the equation and build EAR on command line using Maven, does it turn out ok? If not, look for a solution in your pom.xml.
If ok so far, open Eclipse and perform Maven -> Update Project. Then export EAR using Eclipse (look for EAR export wizard under File -> Export). Did the exported EAR turn out ok? If not, file a bug report for m2e-wtp plugin. It is still pretty raw, so it wouldn't be surprising if it doesn't setup Eclipse metadata correctly in some cases.
If ok so far, then it is time to look for a problem in Glassfish plugin. I doubt that you will get this far, but if you do I will help you to follow up.

How do I create a new eclipse project for jetty from a tomcat based project and versioned with svn/subclipse?

Is there a simple way to solve the following problem?
I have an eclipse workspace with a dynamic web project shared in svn using subclipse plug-in.
The project is based on tomcat7.
Now I would like to move the project to jetty8, leaving the source files in the same svn repository. Is that possible?
I don't want to kill the previous project on tomcat but I would like to mantain both projects.
I tryed importing the tomcat project into a new workspace as is but it's doesn't work.
Which steps should I do if there is a smothless procedure?
I solved in this way:
create a branch of the tomcat project in the repository
import the tomcat project into a new workspace
switch the project to the previously created branch
as the project cannot run on jetty as is, change the targeted runtimes property to jetty
as eclipse does not include all the jetty jars in the classpath, add the missing ones from the jetty lib directory
fix some other stuff, like JSF2 on Jetty gives randomly 'zip file closed' but works when running from maven jetty plugin (jetty:run)
and now it works perfectly!
Hope this could help someone else.

Eclipse not deploy all the jar files for a web app

We have a non-trivial multi-module maven project, then have a single module maven web-app that depends on 2 modules in the larger multi module project.
When we use eclipse to deploy to tomcat, it doesn't deploy all the jars that are required (spring, camel, etc) by the projects in the multi-module projects, but the multi-module jars are present???
But if we were to do an export of a war file on the single module app it includes everything we need spring, camel, and all the multi-module jars as expected? Why do export and deploy work differently and how can I get deploy to work the way I want.
We are using eclipse 3.6.2 with m2eclipse and other plugins. It seems Eclipse Indigo is worst at handling maven projects than 3.6.
This seems to be the same problem that I encounter semi-regularly. Open the build path for the project, and in the Exports tab, check the Maven dependencies checkbox. Do a clean and reploy the webapp.
It may be necessary to remove & readd the webapp to the server, and I usually have to quit Eclipse and restart it.

Can not run maven project in eclipse

We have existing maven project. I have imported it with m2eclipse plugin.But
I can not run the project. Tomcat can not see resources(WAR files under target folder).
What am I missing? BTW we have multi-module project(2 WAR files).
Thanks in advance!
You need to add the tomcat server in your eclipse.
The maven project should be a web based project
You need to add the web project to the tomcat server.
You need to add J2EE Module Dependencies - Eclipse 3.3 ( To enable all library dependencies to be available at runtime to tomcat). Paths that point to your m2 repo & the lib files.
It may be Java EE Dependencies in earlier versions.
Both your projects needed to be added similarly.