How does Intellij deploy to JBoss? - intellij-idea

I finally have my application in IntelliJ and deploying to JBoss. I'd like to get hot deploy working but it looks like I need to understand how IntelliJ and JBoss interact.
When I build my project in IntelliJ and then start JBoss, the ear file does not appear in the deploy directory so I assume that there is some magic that IntelliJ does so that JBoss reads from a different folder. What is happening during this step?
Thanks :)

I know this is an old and apparently answered question, but unfortunately the links provided in the accepted answer didn't give me the simple details I was looking for. For anyone also trying to understand how IntelliJ IDEA deploys your exploded war to JBoss without copying files to the deployments folder, here's what I've found while deploying locally from IDEA 14 (EAP) to JBoss 7.1.1.Final:
After you've created an "exploded war" artifact for your project (or it has automatically been created for you), IDEA will build your provided sources and place the output in the directory set in the artifact options (you can change this setting to place the output inside the deployments folder inside your jboss installation).
IDEA will update your JBoss configuration file (/standalone/configuration/standalone.xml) and add a "deployment" node inside the deployments section. This entry simply defines a name, a runtime name and the exploded war root folder for your project, which will point to the output directory of your artifact set in IDEA.
When JBoss is started (either manually or from your run/debug configuration in IDEA), it will automatically deploy your artifact. Be warned that if your files are in the output directory of your project and you clean it, JBoss will still try to find the directory, thus encountering errors in your next attempt to start it: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to mount deployment content, Failed to process phase STRUCTURE of deployment and java.io.FileNotFoundException to name a few.

Please refer to the documentation.
Basically, you need an exploded Artifact configuration with the directory name ending with .ear.
Build | Make performs hot deployment as well as Update action (which is configurable and can update only resources, resources and classes, optionally redeploy or restart the server).
Instead of copying your application to JBoss, IDEA runs it with appropriate parameters so that it uses Artifact directory instead. Configuration is very flexible and you can just change the artifact directory location to reside under JBoss directory.

Related

IntelliJ Jetty plugin does not extract war

I'm using IJ Ultimate 2020.3 and trying to set up a Jetty Server run configuration.
AFAIK, in order to start Jetty with a war artifact it is needed to be located in $JETTY_HOME/webapps directory.
But, it looks like the Jetty plugin of my IJ refuses to copy the war (exploded, or any other) artifact to that directory, which lead the Jetty server to fail.
I was able to start the Jetty server (from IJ) only after manually copying the war file into the webapps directory, so looks like the only problem is the 'copy' step.
Any ideas?
IntelliJ IDEA doesn't copy the artifact into webapps, instead it instructs Jetty to load the artifact directly from the location that you have configured as the artifact output directory.
Artifact used for deployment:
Artifact output directory:
Startup logs showing that artifact is loaded directory from its output directory and not from webapps:
Thanks #CrazyCoder, this is a progress for me.
problem is that my output console suggests that it does not search for the artifact in the location it is set:

IntelliJ, JRebel, Maven and a JEE 6 application

My setup is
IDE: IntelliJ
Application: JEE6 with an EAR and a WAR module
Build: Maven
Hot-Code-Replacement: JRebel
App-Server: Glassfish 3.1
I configured the application in IntelliJ in a way that the ear gets deployed. The ear "target" folder looks like this
target/classes/
target/appEar/appWeb-version-Snapshot.war/
target/appEar/lib/
target/appEar/META-INF
In the default configuration JRebel listens for changes in the classes/ folder.
When I change something in the web module, and build this, the classes are only updated in appWeb/target/classes/ but not in appEar/target/appEar/appWeb-version-Snapshot.war/.
If I want to update those classes I have to select "Build Artifacts" in IntelliJ after building the project.
To sum up, I have to do these steps for a hot code replacement:
(once) Configure JRebel correctly.
Make project
Build Artifacts
This whole procedure appears to be too complicated to me. Does anyone have a clue how to setup IntelliJ/Maven/Glassfish/JEE/JRebel correctly? I have not found an example containing all my tools. I'd like to have only one action for the code replacement, not two.
There's "build on make" checkbox in your project artifact settings, that will always recreate your artifact on compiling, if that's what you are looking for. However JRebel should remap where your application is reading class files and resources based on rebel.xml, so you probably should just rewrite rebel.xml to look for classes where they are compiled to, not where they end up after building the artifact.
Why do you need to Build Artifacts every time?
Your war should contain the rebel.xml that maps to the classes in /target/classes folder.
When you make changes to said classes, your server then knows to load the changes from those classes.
So you only need to build your project in order to see the changes assuming your rebel.xml classpath points to /target/classes.

Where is the war file built in Intellij IDEA, located?

I'm using IntelliJ IDEA and I'm building and deploying the web-application project every time I'm running it. All of this happens magically within IntelliJ IDEA.
However, now I'm supposed to manually deploy it on a test server's wildfly, so I need an artifact file (WAR or EAR) to drop in the standalone/deployments directory on the test server's running WildFly10.
I can't for the life of me find where IntelliJ Idea exports the WAR / EAR artifacts so I could copy paste it to the said directory on the test server. Any help is appreciated.
Please follow the steps :
Click on Edit Configurations.
Click on Deployment and add your artifact.
Apply these changes.
You can see a Build Artifacts under Build.
Click on Build Artifacts and it will create a war/jar to the respective folder.
If I'm wrong somewhere let me know.

How can I get Eclipse to use my IVY_HOME variable when downloading ivy dependencies?

My company uses extensive use of ivy to download dependencies. Some of these dependencies are huge (~500MB) and take a while to download from the remote repositories.
To build our application we have an ant script that will first resolve all the dependencies and the deploy to the server.
I have set an "IVY_HOME" environment variable so that all the dependencies are downloaded to D:\ivy_home instead of C:\Users\.ivy2\ - this is because D: is my SSD which is significantly faster, and it is where my local server directories are located - so copying files from ivy_home to the server is super fast.
But for some reason when I am using IvyDE plugin inside eclipse - it always wants to download a separate copy of all the dependencies and puts them into my C:\ which is causing several issues:
Local publishes from the ant script will not be picked up in eclipse since they are placed into a different location
Dependencies already downloaded in D: will not get picked up which makes the ivy Resolve inside eclipse much slower than it needs to be
The dependencies are in a slower drive in eclipse so performing searches, and executing these jars is also slower
How about creating symlink to replace the .ivy2 in Users to D? I've tried it on my own and it's looks working fine.
Open cmd as root, and then execute this line
mklink /d C:\Users\{username}\.ivy2 D:\.ivy2
I'd create an ivysettings.xml file and specify the location of my cache using the caches directive. See the following answer for example:
can I turn off the .ivy cache all together?
Why don't you set up IVY globally with the ivysettings.xml along with a property file.
This property file could have this:
ivy.default.ivy.user.dir=D:\ivy_home
For individual projects you could uncheck "enable project specific settings" for each IvyDE library management, so they would use IVY global settings, with one extra eclipse environment configuration.

Using Netbeans to configure context-root for JBoss

I have a Spring application that is being deployed to JBoss 4.2. I can manually edit the generated WAR file and alter the jboss-web.xml file to set the context-root value and that works perfectly well. I would like to be able to do the samething via netbeans (6.9.1), but I have been unable to locate where to make the adjustment. I've tried tweaking the project's properties and setting the Context Path value. When I Run the application that value is reset to the Project's name. I've located the jboss-web.xml file in the project and changed it there, also reset upon run. So it appears that Netbeans is deciding that the value need to be set but I can't locate where. If it's of any use, the project also uses Maven2, but all the controls I can find for impacting context-root are geared towards EAR files instead of WAR.
Has anyone been able to do this or am I just in a world of making the change post build?
I had a similar problem once where netbeans was sometimes removing the context-root element from the glassfish-web.xml configuration. I have not been able to track it down exactly but you could try to remove the file nb-configuration.xml in the project root folder and see if that helps.