]
Andre Dietisheim updated JBIDE-26304:
-------------------------------------
Attachment: maven-moduletest.zip
File Eclipse bugzilla reporting J2EEDeployableFactory module cache
bug
----------------------------------------------------------------------
Key: JBIDE-26304
URL:
https://issues.jboss.org/browse/JBIDE-26304
Project: Tools (JBoss Tools)
Issue Type: Task
Components: openshift
Affects Versions: 4.9.0.AM3
Reporter: Andre Dietisheim
Assignee: Andre Dietisheim
Fix For: 4.9.0.AM3
Attachments: maven-moduletest.zip
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)
h2. 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).
h2. Fix:
To fix this bad behaviour one has to change *J2EEDeployableFactory* in the following
way:
{code:title=org.eclipse.jst.j2ee.internal.deployables.J2EEDeployableFactory}
protected void cleanAllDelegates() {
Iterator<FlatComponentDeployable> i = moduleDelegates.values().iterator();
while(i.hasNext()) {
i.next().clearCache();
}
+ clearModuleCache();
modulesChanged();
}
+ @Override
+ public void clearModuleCache() {
+ clearCache(null);
+ }
{code}
ps. notice the oddness in terms of API:
{code}protected void clearCache(IProject project){code} has a parameter *IProject* but
it's not being used in this class, nor in the super classes.