JBIDE-22138 reported that the OpenShift Server adapter does not respect the "openshift" maven profile of a project.
While implementing it we discovered that J2EEDeployableFactory is not clearing it's module cache when the deploy-name in .settings/org.eclipse.wst.common.component is changed.
We need to file an Eclipse bug that reports this an create a PR for it (see Fix further down)
Steps:
I have recorded the following screencast: https://www.youtube.com/watch?v=V_SdtXYkJHA&feature=youtu.be
- EXEC: create a server adapter Basic/J2EE Preview
- EXEC: import maven-moduletest as maven project into your workspace
- EXEC: in Servers view, ctx menu for J2EE Preview: choose "Add and Remove..." and check the name of the available module maven-moduletest -> it's called maven-moduletest
- EXEC: in Project Explorer, ctx-menu for maven-moduletest: pick Maven > Select Maven Profiles... & check the "openshift" profile
- EXEC: in Servers view, ctx menu for J2EE Preview: choose "Add and Remove..." and check the name of the available module maven-moduletest
Result:
the available module os called maven-moduletest but it should be called maven-moduletest(ROOT) - the "openshift" maven profile overrides the <warName> property to ROOT which should set the deploy name, which it doesn't
with the fix applied (pasted above in Comment 1) the module is correctly called maven-moduletest(ROOT) (step 5).
Fix:
To fix this bad behaviour one has to change J2EEDeployableFactory in the following way:
protected void cleanAllDelegates() { Iterator<FlatComponentDeployable> i = moduleDelegates.values().iterator(); while(i.hasNext()) { i.next().clearCache(); } + clearModuleCache(); modulesChanged(); } + @Override + public void clearModuleCache() { + clearCache(null); + }
ps. notice the oddness in terms of API:
protected void clearCache(IProject project)
has a parameter IProject but it's not being used in this class, nor in the super classes.
- relates to
-
JBIDE-22138 Server adapter: doesn't respect openshift maven profile
- Closed