Eclipse Deployment assembly for Maven build overlay option - eclipse

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.

Related

Gradle Multiproject War withEclipse gradle plugin. Not including project dependencies in tomcat webapp/app/WEB-INF/lib

In a gradle multiproject, I have 3 projects:
The first one contains basic utils (plugin; java-library)
The second is a java application that depends on the first project (plugin: java)
The third is a web application, that depends on the first project (plugin: war)
All 3 projects are declared in settings.gradle of the parent project
The first project is referenced from the second and third project setting:
api(project(":FirstProject"))
The second project runs without problems from Eclipse (Run As- Java application)
The third project cannot run properly as has missing dependencies at run time (Run As - run on server)
Looking in the directory where local tomcat resides in eclipse
/home/ximo/WORKSPACES/WS01/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/CSV01/WEB-INF/lib
I have detected that the first project jar is missing (firstproject.jar)
But when executing the build task from the "Gradle tasks" view, the generated war does contain the "missing" jar.
So the problem only arises when Eclipse deploys the application to the local tomcat for running (or debugging) locally the application.
I have used 2 possible "dirty" solutions for this problem:
Copying this jar by hand to the referenced deployment lib folder.
Adding to the build.gradle a reference to the missing jar
implementation files('path_to_jar/firstproject.jar')
Any idea for solving this issue?
Thanks.

Making Eclipse Maven repository inside the project

I'm a real beginner to Maven and Spring framework in eclipse so excuse me if this sounds trivial..
I have created a MVC web project in eclipse using the STS plugin on my windows computer, but my problem is that the location of the jar and configuration files that maven is set to by default is: C:\Users\MyName.m2\repository
This is a problem for me because eventually I'm going to make a WAR file out of my project and deploy it on a Linux machine, which does not have Maven installed on it.
My question is, is it possible to take all the jar files in my Maven repository, and make a local repository on the project itself rather than on an absolute path on the machine (sort of like a lib folder within the WEB-INF in the project that will hold all the maven jars and that maven will direct itself to it), and thus making the transition to the Linux machine smooth
I understand there is this classpath variable named M2_REPO, but doesn't seem to be editable or accept relative path rather than absolute.
Thanks in advance
Since you are using maven and you are adding your dependencies on your pom.xml, then all the dependencies with a scope of "compile" will be added to your final war file created by the maven war plugin under the WEB-INF/lib folder, this means that you should not worried about having maven in your linux server, since the war file that you are going to deploy will contain all the necessary dependencies. If you want to confirm this, just create a package of your project using "mvn clean package" and check the "target" folder generated by maven, you will see a "war" file, and you can unzip your file to check what contains.

Can't get eclipse kepler to deploy dependency projects of dynamic web project

I've recently upgraded from Eclipse Juno to Kepler, and have imported some old projects into a new workspace, but unfortunately I cannot get publishing of one of my web projects to work. It has dependencies on a couple of other projects in the same workspace, and these projects are listed in the 'deployment assembly' tab with entries like
Source Deploy Path
/eventserver WEB-INF/lib
that I have added using the 'Add/Project' option (I'm pretty sure I've previously used 'Add/Entries from Classpath' but that option does not list the projects, so I don't know what's going on). But neither the projects' code nor their dependencies are being deployed to WEB-INF/lib when I publish the main project. Also, I have the following warning showing up:
Description Resource Path Location Type
Projects must be referenced by an EAR or a WAR to use classpath publish/export dependencies whose runtime path (../) maps into the parent component. eventserver P/eventserver Classpath Dependency Validator Message
which I only used to get if I didn't have a main project that referred to the utility project.
Any ideas what's going on?
Create an EAR project using this link:
http://www.eclipse.org/webtools/jst/components/j2ee/scenarios/application_creation_tutorial.html
After creation, try to Add the Project in server entry.

deployment assembly using maven-eclipse-plugin

I am using maven-eclipse-plugin for working with a war project. This war project uses maven overlay method to include another war. When I deploy it using Maven, everything goes well. When I test the war locally in eclipse, it fails because the dependent war resources are available only in the target folder. To solve this, I go the deployment assembly and manually add the target folder. Is there way I could tell eclipse-maven-plugin to add the following line to org.eclipse.wst.common.component file inside the .settings folder when running the eclipse:eclipse goal.
<wb-resource deploy-path="/" source-path="/target/finalname"/>
You can embed any additional eclipse properties in your pom for mvn eclipse:eclipse.
The plugin reference has some examples for adding build commands, resources, facets, and of course also adhoc configuration.
You can probably copy paste something from there to help you.

IvyDE Resolve Dependencies in workspace with a Dynamic Web project in Eclipse

I have a large application with many eclipse (actually using Spring Source Toolsuite) projects with ivy managed dependencies for each project. We currently have it setup and working where you can have project A (a dynamic web project that generates a war) and project B (generates a jar) setup such that project A depends on project B and if you only have project A in your workspace, it will go pull the jar file generated by project B from the ivy repository. We setup the deployment assembly to take the eclipse library generated from the ivy resolve and put it in the WEB-INF/lib directory so we can easily deploy to tomcat.
With the manual process, all of this works. I can make a change to project B, publish it to my local ivy repository, and re-resolve the dependencies on project A, and I get the new project B jar file and everything compiles and updates on tomcat as expected.
The problem I'm having comes when I change the ivy resolve settings of project A to "Resolve dependencies in workspace". When I make changes in project B, project A successfully notices the change and compiles correctly, but the deployment assembly breaks. When I go look in tomcat, it has a folder for project A's context root, but it is empty. If I uncheck the "Resolve dependencies in workspace" checkbox, the context root folder gets populated and everything returns to a working state.
I can continue doing the manual process, but it is a huge timesavings if I can get ivy to use my workspace first, then get the jar from the repository if the project does not exist in my workspace. Any suggestions would be greatly appreciated!
The solution was to add the Utility Module facet to project B (Project Properties->Project Facets->Utility Module) so that eclipse would know the structure of the jar file that is supposed to be generated.