Eclipse not generating META-INF for .ear - eclipse

I'm trying to add a web project to my ear, but eclipse won't generate the /EarContent/META-INF.
What I do:
Web project test_web_project_1 already created.
New->Enterprise Application Project, create ear.
Right Click->Properties-> Deployment Assembly
Add test_web_project_1 as a project.
The test_web_project_1 war is then added to modules, but EarContent/META-INF and the corresponding application.xml is not created.
What am I doing wrong?

The Java EE 5 specification makes the deployment descriptor xml files
optional. This results in an EAR 5 project that is created without application.xml by default.
You can create one for your EAR project by Clicking once on the project parent folder in the Project Explorer pane and then right-click > Java EE Tools > Generate Deployment Descriptor Stub.
This should populate your ear content folder with a META-INF/application.xml file.

Have you tried with EAR project -> right-click -> properties -> Java EE Module Dependencies ( or 'Project References' depending on the used version of Eclipse) ?

Related

Why jars added to Deployment Assembly do not show up in Project Explorer (Eclipse Photon) under WebContent/WEB-INF/lib folder?

Working on a Dynamic Web Project I added a guava jar file to Deployment Assembly (Eclipse Photon) - thru Add -> Java Path Build Entry (same happens with Add -> Archives From File System)
I see that this jar gets deployed to the server and is actually inside /WEB-INF/lib of the generated and deployed WAR.
But my Project Explorer window looks like this and its WebContent/WEB-INF/lib folder is empty (I did project refresh)!
Is it normal behaviour?
In my opinion it breaks Least Astonishment Principle a lot!
It shouldn't appear there unless you actually copy the jar into the workspace (or link it, possibly).

Change the EAR deployment name in JBoss 7.x

I use Eclipse Oxygen (4.7.2). I have JBoss Tools in my eclipse. I have JBoss AS7.1.
I have a maven "ear" project. It is called abc-project. It is a maven project from the git repository. It's version in maven pom.xml is 4.7.5-SNAPSHOT. Its Artifact Id is abc-project. When I right click the server (under the Servers tab), and added the project, it is added as abc(abc-4.7.5-SNAPSHOT).
In the ear's application.xml, we have the display name as 'abc'
After I build and publish the project to JBoss, then in the standalone/deployments folder, the ear project is deployed under the folder with name abc-4.7.5-SNAPSHOT.ear
Now in one of our code, we refer as abc.ear while looking for some default labels files. The server starts fine, but it fails to access the project, because it s deployed under the folder name abc-4.7.5-SNAPSHOT.ear.
Can I change the deployment folder or the deployment name of this project?
I would like it to be deployed under the folder abc.ear
Wherever your project is, locate the .settings folder for your project. I believe this is the eclipse settings folder. Underneath this folder, there is a file called
org.eclipse.wst.common.component
Open this file, and change the name of your project in this following entry
from:
<wb-module deploy-name="abc-4.7.5-SNAPSHOT">
to:
<wb-module deploy-name="abc">
Then, remove the project from the jboss server in eclipse under the server tab/view.
Then restart eclipse clean.
Add the project again to jboss server in eclipse under the server tab/view
Publish and restart jboss from eclipse

How do I convert an app engine WAR folder into a single WAR file

Currently I have created a web application and have it deployed via GAE(Google App Engine). It currently creates a WAR Folder. I need to be able to convert this project to be deployed on tomcat.
Is there anyway that I can convert the WAR folder into a single WAR file, or does anyone know how to convert an app engine project in eclipse to work with tomcat.
Any help is appreciated.
I assume you have created a project using the Google App Engine plugin for Eclipse. That project structure looks very similar to the Eclipse Dynamic Web project structure, the only difference is the war folder which is an Eclipse project is probably called WebContent.
First you need to add the Dynamic Web Module facet to the project. Right click on the project and select Properties, on the properties window choose Project Facets and check the Dynamic Web Module option, click Apply then Ok
At this stage Eclipse will change the icon of the project and create a WebContent folder, now delete this folder and tell Eclipse to use the war folder instead. Again right click on the project and select Deployment Assembly then remove the WebContent folder and add the war folder.
Finally export the project as a war file, select the project form the File menu select Export, then choose Web --> War File, enter destination file, etc...
Note: I've not tried this myself so not sure if your war will run under Tomcat or not

Eclipse Deployment assembly for Maven build overlay option

I have my enterprise project which contains 2 WARs. There are some common resources in those WARs, in project structure we have base project which is web project. and base project contains common resources for 2 WARs. for those 2 WARs in project structure we have 2 separate web project.
When I do build through maven then I use a overlay option of maven to build a 2 WARs to be merged with a base project WAR. So that common resources from base project war is merged in both WARs from EAR.
I have created a eclipse project by following command,
eclipse:eclipse -Dwtpversion=2.0 eclipse:configure-workspace
Now I want to configure these project in eclipse(Kepler) so I can run those from eclipse by configuring application server on eclipse.
But above commnad add base war file directly in deployment assembly of WARs from EAR, instead of merging it as happening in overlay option of maven build.
I tried to fix this by manual configuration of deployment assembly but there is no option for adding folders from different project.
I have google a lot for solution for this but no luck.
Thanks in advance.
After lot f google one thought came to my mind, how this is been handled in myeclipse?
I have downloaded myeclipse and imported my project in myeclipse, then added maven nature to all project.
Then I have checked deployment assembly of WAR project, there base project added in deployment assembly without any value in deploy path, then i had opened .setting folder from WAR project I have checked the org.eclipse.wst.common.component file where i have found one entry which were doing overlay maven build in deployment assembly, that line is as follows,
<dependent-module deploy-path="/" handle="module:/overlay/prj/base-project?includes=**/**&excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
here is a solution for overlay issue of maven build, which we need to configure in deployment assembly in component file of .setting folder of project.

How to make war file of gwt project in eclipse?

I am making web application using GWT toolkit in eclipse and my application is running successfully as we run from eclipse to right click on project and select Run as web project.
But when i make war file from eclipse-ide to Right-click on the project, pick Export, then WAR file so it does'nt work.It give me error "enter module name" it does'nt detect automatically module name. it happens only when i make a web application with gwt plugin otherwise in simple web dynamic application war file create easily with eclipse ide.i want to know how to make a war file in eclipse? And how to deploy my gwt application with tomcat server?
Thanks
Rahul
Take a look to this other question: create a .war file from gwt-project
In fact the real answer will depend if you want to use ANT or Maven.
WAR files are just compressed version of your built web app projects. One simple way to make them is to use jar.exe in JDK package. That's enough to run this command after building your project in eclipse to compress those files as a WAR file:
jar -cvf name_of_jar_file.war -C /path-to-app-built-dir /path-to-put-jar-file
The best approach is to use the command
Export > Export ... > Web > War file
You will have this command on the context menu (right mouse button on the project folder) if you installed the Java tools for Web Applications. Otherwise that should you first step.
It may be the case that your GWT project doesn't show on the selector of the Web Project field, the first on on the dialogue box when you execute the command above. If this is the case you must make sure you have the Dynamic Web Module facet on you project. Select the project root project navigator and then execute
Properties > Project Facets
and check Dynamic Web Module on the right panel if it not already checked.
You should make sure that the WAR directory used by GWT is the same used by the dynamic web module. If you are not sure what is your WAR directory (probably it's the one named "war") you can go to
Properties > Google > Web Application
and read the content of the field WAR directory on the right panel.
Then make sure that the WAR directory is specified in the "Web Deployment Assembly". You need to go to
Properties > Web Deployment Assembly
and check if your WAR directory is listed there. If you war directory is "war" then you should have /war on one of the rows with the deploy
path /. Otherwise
press Add...
select Folder
press Next
select your WAR folder (e.g. war)
press Finish
If you fail to make your WAR directory part of your Web Deployment Assembly them the Export > Web > WAR command will create a WAR file, but it will lack the web.xml and all the static files on the WebContent folder, such as the HTML, images, etc.
Open your project.
Navigate to war folder.
Go to File>Export>Archive File
Export your war FOLDER as zip file.
Change your file extension form .zip to .war
Keep calm and enjoy your war file.