JSF not updated
已回答
Hi,
I migrated from Eclipse to Idea and I'm trying to get what I was used to in Eclipse O:-)
I have PrimeFaces project using spring-boot. When I change my UI (.xhtml file) it is not loaded and I have to restart application. I had no such problem with Eclipse (simple Ctrl+F5 in browser worked). Can I achieve the same in Idea?
Thanks!
请先登录再写评论。
Please check Updating Applications on Application Servers. Make sure you are deploying an exploded (un-archived artifact) to an application server, and choose Update classes and resources option for updating the application.
Check also javax.faces.FACELETS_REFRESH_PERIOD parameter in web.xml file and facelets.DEVELOPMENT. This parameters might help to force JSF resources refresh, see https://stackoverflow.com/a/7514528/2000323.
Sorry, I'm aware that this is 5 years old, but I'm facing the same problem since an undetermined version. There's no javax.faces.FACELETS_REFRESH_PERIOD in my web.xml. I'm deploying the exploded artifact, and didn't change anything in my configuration, and this used to work until a few months ago. The team ask me for a bug report providing data of my project that I simply cannot, and there's several people complaining about the same. Eclipse provides this feature straight-forwardly. I believe it shouldn't be that hard to make it work properly once and for all. It's not feasible if you have to redeploy the whole application everytime you change a single dot in your .xhtml file.
Deploying a Multi-Module WAR Application in IntelliJ IDEA
As a developer, I've encountered a somewhat cumbersome process when deploying a multi-module WAR application in IntelliJ IDEA. Here's what I've observed:
1. Initial Setup:
- I organize my project with multiple modules, including a WAR module.
- The WAR module depends on several libraries located in `my-project-developmentfolder\my_application_war_module\target\myapplicaton-war\WEB-INF\lib\some-sub-module.jar`.
2. Deployment Differences:
- IntelliJ IDEA deploys to the Maven target directory, which is acceptable.
- However, unlike Eclipse Wildfly, IntelliJ doesn't automatically explode the `.jar` dependencies in `WEB-INF/lib`.
3. Resource Changes:
- In Eclipse, I can edit JSF XHTML files within `my-submodule.jar`, and the exploded directory updates immediately during deployment.
- In IntelliJ, I struggle to see resource changes take effect. Even after editing an XHTML file, the stale `WEB-INF/lib/my-submodule.jar` persists.
4. Workaround:
- To force updates, I follow this workaround:
- Open the Maven view on the right side.
- Navigate to the module containing the XHTML files.
- Execute the `install` goal to generate a new `.jar` archive in `.m2/repository`.
- Locate the WAR plugin in the Maven tree for the application war module and run the `war:exploded` goal.
5. Challenges:
- This process feels error-prone and inefficient.
- If I make frequent changes, I often resort to a full `mvn clean install -DskipTests -T 10` outside the IDE.
Please note that in IntelliJ IDEA, under Services > Wildfly Service > Edit Configuration, the “On update action” is set to “Update classes and resources.”
However, this plugin behaves as if the only type of exploded WAR file properly supported is one where any module in WEB-INF/lib is a third-party module. In other words, we wouldn’t need to edit the code ourselves for these modules. Instead, all our custom code should reside within the maven war module’s src/main/java and src/main/resources directories—nowhere else.
In summary, I am really having a hard time to do development with Jakarta + Wildfly using IntelliJ.
I assume I am doing something wrong, thanks for the help.
Hello Nuno,
IDE could updated only exploded artifacts (JARs or WARs). So, your JAR files should be expanded inside WAR artifact. Please try to enable “Unpack nested archives” in “Project Structure | Artifacts - Maven” tab:
Hi, thank you very much for the suggestion.
I have tried exactly that, but when I examine my local directory:
C:\dev\branches_git_repo\repo_abc\prefix-someappjumpstart-project\prefix-someappjumpstart-war\target\prefix-someappjumpstart-war\WEB-INF\lib\prefix-someapp-transport.jar
Everything remains unaltered, just as it always has.
I attempted both a top-level Ctrl + F9 (building the entire project repository) and rebuilding only the war module, but there was no difference.
I also used the right-side Maven menu to explicitly call `prefix-someappjumpstart-war > Plugins > war > war:exploded`, but still, no difference.
Additionally, I checked the option to include the exploded war as part of the project build process, but this did not change anything.
Despite the promising tip you provided, in practice, everything appears unchanged. The `WEB-INF\lib` directory is fully populated with binary JAR files, and their timestamps do not update when I modify code within those corresponding JARs.
Thank you for your assistance.
Nuno,
Have you tried to clean output folder and rebuild project and artifact? Please attach screenshot from “Settings | Build, Execution, Deployment | Build Tools | Maven | Runner”.
Is it possible to provide some sample project example to check it on our side?
Hi,
Once again, thanks a lot for trying to help.
Here is the image that you have asked for:
Regarding the issue of deploying from IntelliJ into WildFly, for now, I won't be sharing screenshots of the Project Structure view or the active/inactive checkboxes.
The reason is that I'd need to edit too much information around those pictures to make them suitable for a public forum.
Now, let's discuss cleaning the output directory.
I hadn't tried that yet.
Based on your advice, I have now performed an `mvn clean` on the WAR module, completely removing the `target` directory. Afterward, I attempted to right-click on the module and experimented with both the "Build" and "Rebuild" options for the WAR module. Unfortunately, I didn't observe the exploded WAR being created automatically.
This behavior is likely expected because I didn't have the checkbox in the project structure menu set to automatically execute the WAR exploded plugin. To address this, I retried the rebuild step, this time ensuring that the "include in project build" checkbox was active. As a result, right-clicking on the WAR module and requesting a rebuild finally produced the `myapp-war/target/myapp-war/` exploded outer-directory.
However, all the components in the `WEB-INF/lib` directory for all the modules remained, as in the past, contained in JAR files; none were exploded.
Regarding the possibility of providing a reproducer project to simulate the scenario on your end, I believe that should definitely be feasible. I'll inform the team responsible for our IntelliJ SDK package, and we'll work on creating a mock project setup. This setup will include a similar Maven `pom.xml`, module organization, and plugin versions for the Maven plugins. Keep in mind that this process might take some time due to prioritization.
Once again, thanks a lot for your kind help.
Nuno Godinhomatos I've discussed this with the developers, the “
Unpack nested archives
” option only works with J2EE Artifacts (EAR, WAR, EJB) and primarily aimed at the Artifacts produced by the other Modules of the same Project.Since you have a fairly advanced setup a reproducer Project would be massively helpful in investigating this. Even if the “
Unpack nested archives
” option won't work in this case, we can still try looking for alternatives.Please also note, that you have to use the Build Artifacts options, not Build Modules in this situation.
Hi thanks a lot for pinging me.
We do deploy WAR packages with the wrbinf lib containing an array of dependencies from our own maven modules, to other third party libraries ( the usual stuff).
Right now unfortunately I am following the approach of develop in intelij until it is time to deploy and test. Then i am forced to use eclipse where the deployment plugin is really rock solid.
I will ping the SDK team again to see if they can prioritize a reproducer with print screens.
I cannot give more of my own time unfortunately because on my calendar the things that are unmovable are there and cannot be jumped over.
I sincerely thank your patience.
Kindest regards