Topic
3 replies Latest Post - ‏2013-07-08T16:29:54Z by rsanchezh
BTDD_Lars_Ködderitzsch
1 Post
ACCEPTED ANSWER

Pinned topic WDT: Workspace deployment too hard to get right with m2e/m2e-wtp

‏2013-07-02T16:19:20Z |

Hi all,

I've researched into using Websphere Developer Tools (8.5.5) together with m2e/m2e-eclipse (latest Kepler release) for workspace deployments. Currently it's very complicated and too hard to get completely right

By default m2e generates configurations which break the single-root rules on ear and war project - thus forcing WDT to refrain to "assembled" deployments from the ${workspace}/.metadata/org.eclipse.wst.server.core directory.

However, I consider this "assembled" deployment inferior over a true "out-of-workspace" deployment using only the looseconfig.xmi, and for some configurations (e.g. GWT projects which on-the-fly generate files in the webapp folder) it's a flat-out showstopper.

 

Using some very delicate settings m2e can be coerced to generate project configurations which honor the single-root rules and this makes true "out-of-workspace" deployment work:

- disable m2e options "Generate application.xml under the build directory" and "Maven archiver generates files under the build directory" - this tells m2e-wtp to only generate a single "wb-resource deploy-path="/""-element in .org.eclipse.wst.common.component (However this only works if the Maven pom does not configure resource filtering

- define project output directory in pom.xml to src/main/webapp/WEB-INF/classes

e.g. <build><outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory> ... </build>

 

With those two settings and some luck the single-root warnings go away and WDT will deploy the ear directly from the workspace without using the "org.eclipse.wst.server.core" directory to copy stuff there.

The point is however that it is unnecessarily hard to achieve this and it's a very fragile configuration.

However with a minor change to WDT it would be getting much easier:

*** Relax WDT on the output folder location for war projects ***

If done right (single-root) WDT currently generates this into the looseConfig.xmi:

<looseArchives xsi:type="org.eclipse.jst.j2ee.commonarchivecore.looseconfig:LooseWARFile" uri="cts2-web.war" binariesPath="D:\workspace\cts2_gxt3\cts2-web\src\main\webapp" resourcesPath="D:\workspace\cts2_gxt3\cts2-web\src\main\webapp"/>

This is nice and works - but only because the project output folder is configured to D:\workspace\cts2_gxt3\cts2-web\src\main\webapp\WEB-INF\classes.

If the output folder is not in this location but in the Maven standard (target/classes) then WDT generates this - which is bad news because it involves copying/assembling of the project in "org.eclipse.wst.server.core":

  <looseArchives xsi:type="org.eclipse.jst.j2ee.commonarchivecore.looseconfig:LooseWARFile" uri="cts2-web.war" binariesPath="D:/workspace/cts2_gxt3/.metadata/.plugins/org.eclipse.wst.server.core/tmp0\cts2-web" resourcesPath="D:/workspace/cts2_gxt3/.metadata/.plugins/org.eclipse.wst.server.core/tmp0\cts2-web"/>

BUT if WDT were to generate the following, deployment from workspace WITH a standard output folder would be no problem at all:

<looseArchives xsi:type="org.eclipse.jst.j2ee.commonarchivecore.looseconfig:LooseWARFile" uri="cts2-web.war" binariesPath="D:\workspace\cts2_gxt3\cts2-web\src\main\webapp" resourcesPath="D:\workspace\cts2_gxt3\cts2-web\src\main\webapp">
        <looseLibs uri="webapp.jar" binariesPath="D:\workspace\cts2_gxt3\cts2-web\target\classes" resourcesPath="D:\workspace\cts2_gxt3\cts2-web\target\classes"/>
</looseArchives>

(Side note: we had a custom WTP connector for WAS61 which did this very thing and it worked very well - I gamble it would work for WAS85 too)

 

Sorry for the long write-up, I hope this is actually the proper forum for such proposals.

 

Cheers,

Lars Ködderitzsch