Replies: 3 comments 4 replies
-
Hi @scottkurz!! Yes, I was using dev mode from Liberty Tools in VS Code. If you suggest a workaround I will give it a try :-) |
Beta Was this translation helpful? Give feedback.
-
Using dev mode without "loose application" supportSo, the workaround at a high-level is to disable the "loose application" support (the plugin default) and do a full repackage and redeploy each time you make an application update. While this, unfortunately, requires you to lose some of the nicest parts of the Liberty "dev mode" function and do this yourself manually, it hopefully provides enough value to still be worth using. But this workaround is only possible once you know the right commands. Though dev mode is designed to handle most cases with a simple ExampleTo illustrate, let's look at the multi-module guide sample: Say I want to use this pattern and deploy an EAR containing a WAR and a JAR, with the WAR leveraging "filtering" in the web.xml. One-time setupI just mention this for completeness. Some multi-module usages will fail without the dependencies installed in the local .m2 repo so you might need to do an initial install. (You're probably well past this step though.) This should NOT be something you have to do every time you launch.
Launch dev mode with loose apps disabledSo you can still compile and deploy your app to a plugin-managed Liberty installation, and launch the runtime with a simple command. You just need to modify it a bit to first package the EAR, while disabling loose applications:
It should launch normally, and you can exercise (e.g. test) the app. (Note there are two invocations of 'mvn' here, not one). Repackage and redeploy manually after app changesAfter making a change, (to your Java source, to the web.xml, to one of the properties that provides the value, via Maven "filters", for your target web.xml, etc.), you now have an extra step to do (vs. normal "dev mode" usage). Using a separate terminal (session), re-package and re-deploy your app
Let's break this down. First, we need to do a full (multi-module) Because the first command is multi-module and the second is not, these need to be two Maven invocations, then, not one. If this seems complicated, well, yes, it kind of is, and it's not obvious to think to do this. However, having learned the right command, it can be simple enough to perform the application update. Simply scroll back through your command history, and re-enter this single (multi-part) command line. Dev mode automatically handles other changes: server.xml, pom.xml(*), etc.You can still benefit from dev mode auto-updating your server config (server.xml, bootstrap.properties, server.env), installing newly-configured features (from server.xml). It will handle pom.xml updates as well. I put the asterisk(*) above to note that while dev mode will handle pom.xml updates that relate to your server config (which would be in the 'ear' module in this example), it will not necessarily pick up, e.g the 'war' module changes. I only mention this in case this is where your filtered web.xml property values are coming from; in that case you'd still have to repackage and redeploy the app to pick up those changes. TestYou would probably not want to run with -DhotTests=true since the tests will be run before your deployment is updated. So hit Looking backSo dev mode provides:
We can see that we do still manage to achieve most of this, though it's a bit less convenient to have to run an extra command to redeploy. Without the "loose application" support you have to actually repackage your archive and redeploy it, since you're no longer able to use a "logical" archive that's defined with pointers to the app artifacts laid out in your other project directories, like target/classes (because we don't handle filtering completely yet). But note ,it's not especially more time-consuming, for smaller apps at least. If you are running in an IDE with auto build enabled, your classes will already be compiled, and by repackage, you're just doing a rezip basically (with a large enough archive this could be an issue still though). OK, @doteo78, please let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
I've had the opportunity to test the solution you proposed. In the "Repackage and redeploy" section, you mention The solution works, but the process is too slow for our scenario. Our applications are quite complex and include numerous modules such as JARs, WARs, EJBs, etc. They are deployed in the production environment on a WebSphere Full server. The reason we use Liberty locally is precisely to speed up development tasks. Currently, we use Eclipse with Liberty's WTP connector, and we're evaluating alternatives like Visual Studio Code and the liberty-maven-plugin because some developers are experiencing issues with Eclipse. The scenario you're proposing is, as of today, clearly slower than what we already have. In any case, I really appreciate the effort, and we are always open to trying new alternatives that may arise. |
Beta Was this translation helpful? Give feedback.
-
Hi @doteo78, I wanted to follow-up on your comment here: #1712 (comment)
Though you didn't specifically mention Liberty Tools or dev mode, I imagine that in running your apps in VS Code that you were looking to use these Liberty developer features.
I can describe how you might workaround the limitations in the "loose application" multi-module deployment that we recognized in the #1712 issue.
I thought it might be easier to separate the discussion out from that issue and move it here.
Beta Was this translation helpful? Give feedback.
All reactions