Why are xhtml files not refreshed using an .ear?

Answered

I have two projects, both using WildFly 14.0.1.Final as deployment server build using maven. One is a very simple test project that produces .war file. If I deploy the exploded file hot-swap works if I change the .xhtml file or a .java file. Changed .java file needs to be rebuild, while .xhtml files doesn't need anything, just a refresh of a browser.

However I can't seem to get the above description to work with a more complex project with an .ear file. Surprisingly the .java changes after rebuild on already running server take effect but I can't figure out how to make the .xhtml changes appear on a browser without re-deploying everything, which obviously takes way to long for a normal developing (20-30 seconds).

Things I've tried:

- Deployed .ear:exploded

- Tried all On 'Update' and On frame deactivation combinations

- Enable in 'Registry' compiler.automake.allow.when.app.running

- Enabled auto-deploy-exploded=true in standalone.xml (i think this file is overwritten by the idea tho)

 

Update: Looking at the .war containing the .xhtml file, the change isn't recorded. Looks like .war file isn't recreated?

Any help would be greatly appreciated. Thank you!

3
14 comments

Hi. Please provide:

- full idea.log after reproducing an error,
- a complete textual result from Run/Debug tool window after an attempt to deploy in IDEA
- screenshots of Server, Deployment tabs of Run/Debug Configuration

0

Hi, I've managed to solve it by checking the "Unpack nested archives" in the Project Structure:

0

This works properly just if you don't execute previously a maven clean install, having into account that maven generates war as file but IntelliJ does it as directory, so they enter in conflicts one each other.

I would like to get a better solution for this bug rather than the "Unpack" option. Thanks in advance.

0

The unpack option is the proper solution. IDE can not guarantee a proper packaging if you mix Maven and IDE build for the artifacts packaging sorry, since it cannot control the Maven package.

0

The point is that if I dont build with maven, all properties which has to be replace under src/filters, are not.

Example:

I have a file persistence-tests.xml with a entry such as: 

<property name="javax.persistence.jdbc.url"
value="${jdbc.eprinsa.des}" />

This property is set in pom.xml under a <profile> and in the file above, is replaced when I perform a mvn install through IntelliJ menu Maven / Run Maven / mvn install. 

If I try no to use this maven buildind and I use "Generate sources and Update folders" instead from IntelliJ Maven menu, target dir is fully generated but the property is not set in my persistence-tests.xml file.

So, I really would like not to require to build using maven but IntelliJ building that not provided a "exactly-the-same-result" alternative which allow me to do so.

Is there a way I dont know to use just IntelliJ building without requiring use maven building but replacing maven properties in src/filters files?

Thanks in advance.

0

>If I try no to use this maven buildind and I use "Generate sources and Update folders" instead from IntelliJ Maven menu, target dir is fully generated but the property is not set in my persistence-tests.xml file.

This could be a bug. The property placeholders must be substituted by IDE when you invoke "Generate sources and Update folders" action and then build by IDE. Please make sure you have this profile selected in the IDE Maven tool window.

If problem remains, please clarify how do you configure this substitution in Maven? It would be very helpful to get a sample project to explore it deeper. For uploading you can use https://uploads.jetbrains.com Thanks.

0

I was trying to perform an use-case for you to reproduce it and during doing it, I've found a more simple case to test. These are the steps:

  1. I have a project with resources in src/test/filters and src/test/resources
  2. I run mvn clean in order to delete target directory
  3. I run "Generate sources and update folders" through INtelliJ menu:
  4. I get this target directory generated which misses expected resources:
  5. I run mvn clean again to delete target again.
  6. I run mvn install having profiles selected:
  7. I get  the proper target directory as you can see:

So now I get what the big issue is: This is not that properties are not replaced but the entire file is not generated. I thought properties weren't replaced but this is because the file was not generated and henceforth, not replaced.

I hope you can reproduce the case with this info and be treated as an issue. Thanks a lot in advance.

2

Try selecting different phases here:

The test project would still be needed to investigate your project setup and a possible issue.

>I run mvn install having profiles selected:

It is important to have the profiles selected when you build by the IDE and using "Generate sources..." action.

0

Using last phase...

... it seems to look better:

I've checked them, and properties are replaced properly inside. But, anyway, the target directory result is not exactly the same.

I'm going to try to work selecting Unpack option again and without using maven install having changed this option. In case I detect a require for any reason to run mvn install to work, I will let you know. Thanks in advance.

0

I think our problem is that we need "package" as an option for "Phase to be used for folders update" to work. Im showing you an EAR generation with IntelliJ menu and with mvn package. Only the second one deploys properly:

  • IntellIJ Generation:
  • Maven generation:

As I said, with the first one deployment fails:

weblogic.application.ModuleException: java.io.FileNotFoundException: Unable to find ejb-jar with uri ModelWebRegistroEJB.jar in ear at D:\Proyectos\Java\IntelliJ\WebRegistro\WebRegistro\src\EARWebRegistro\target\EARWebRegistro-1.2.2-SNAPSHOT
    at weblogic.ejb.container.deployer.EJBModule.init(EJBModule.java:301)
    at weblogic.ejb.container.deployer.EJBModule.initUsingLoader(EJBModule.java:246)
    at weblogic.application.internal.flow.ScopedModuleDriver.initUsingLoader(ScopedModuleDriver.java:172)
    at weblogic.application.internal.ExtensibleModuleWrapper.initUsingLoader(ExtensibleModuleWrapper.java:103)
    at weblogic.application.internal.flow.ModuleListenerInvoker.initUsingLoader(ModuleListenerInvoker.java:93)
    Truncated. see log file for complete stacktrace
Caused By: java.io.FileNotFoundException: Unable to find ejb-jar with uri ModelWebRegistroEJB.jar in ear at D:\Proyectos\Java\IntelliJ\WebRegistro\WebRegistro\src\EARWebRegistro\target\EARWebRegistro-1.2.2-SNAPSHOT
    at weblogic.ejb.spi.EJBJar.<init>(EJBJar.java:73)
    at weblogic.ejb.container.deployer.EJBModule.init(EJBModule.java:264)
    at weblogic.ejb.container.deployer.EJBModule.initUsingLoader(EJBModule.java:246)
    at weblogic.application.internal.flow.ScopedModuleDriver.initUsingLoader(ScopedModuleDriver.java:172)
    at weblogic.application.internal.ExtensibleModuleWrapper.initUsingLoader(ExtensibleModuleWrapper.java:103)
    Truncated. see log file for complete stacktrace
0

>Im showing you an EAR generation with IntelliJ menu and with mvn package. Only the second one deploys properly:

IDE builds artifact and includes the libraries there, based on the dependencies, which are set for the module from which the artifact is produced. You should also make sure that all the Java-EE based IDE plugins are installed and enabled for the IDE to detect the corresponding functionality (EJB, JSP/WEB). Please see https://www.jetbrains.com/help/idea/enabling-web-application-support.html

To further look into the issue it would be helpful to get a sample project.

0

Everything works fine but Generation. In order just to be clear, I'm giving you a link with all my pom.xml files for a maven multiproject project so you can check dependencies are included as expected.

Apart from that, Is there a problem to allow users either to write phase by their own or to show more complete list in "Phase to be used for folders update"?

Thanks in advance.

0

Please feel free to create a request to to able to allow any phase there.

Also, you can configure IDE to execute any goal as a Maven trigger Before/After IDE build action.

0

I think execution every-time we build the project is not the required thing (because of the time it will take to do) so I will submit the new request. Thank you very much!

0

Please sign in to leave a comment.