Deploying external wars in Tomcat via IntelliJ Idea - java

I have a project that is dependent on two war files being deployed to Tomcat. So every time I want to test it, I need to build an artifact and manually deploy it alongside the two wars. Is there a way to somehow add those war files to my Idea project so they can be deployed automatically by pressing Shift+F10.
I would deploy it manually, but I have several people working on the project and it would greatly simplify the communication.
Wars are external and they have no sources, so creating new modules/artifacts out of their source is out of the question.
Could you help me?

Since the link on the accepted answer is dead, here is the process, step by step (I'm using Intellij 14):
1) Select Run/Edit Configuration
2) If no Tomcat Run Config exists yet, create one
3) Select the Tomcat run config just created, on Deployment tab, under Deploy at server startup section, click the "+" (right sidebar), select External source, and select your war file.

You can add external webapps to deploy at startup at the Deployment-Tab of your tomcat runtime configuration page.
https://www.jetbrains.com/idea/help/run-debug-configuration-tomcat.html?search=tomcat#d884440e708

Related

Is it possible to add multiple war files to deployment for run/debug configuration in IntelliJ IDEA?

I try to debug my web app by IntelliJ IDEA Ultimate. My app have multiple WARs. At Run/Debug Configuration I add new Tomcat Server. At the Deployment tab I have:
If I add more than one WAR artifact I get error Duplicate context path '/'.
Question for this context is not answered here for a long time: Which application context set in IntelliJ IDEA for Tomcat?
So, let's clear: Is it possible to add multiple war files to deployment for run/debug configuration in IntelliJ IDEA?
You Must add each WAR file in separate tomcat server that created in servers in Intellij IDEA and set a different port for each one.
After that run both of them.

Deploying from intellij to local web logic

I am new to weblogic and have joined a team that has a number of projects. These projects have a master ant build that creates the associated ear, war, jar files and places them in a shared folder. This makes it handly to deploy to weblogic via the weblogic console. However, I have not found a way to make this process work with intellij's weblogic server integration.
I created a server instance in intellij and a run configuration that triggers the master build prior to running the weblogic server. I am not sure how to get the resources from this shared file and deploy them. Any guidance is greatly appreciated,
Ant build should not be used in local server deployment for weblogic. They just create deployable files.
In order to deploy the project to weblogic on IDEA, you must first create an artifact. Hit Ctrl+Shift+Alt+S(Project Structure Screen) and on the artifacts section, click "+" to create a new artifact. In the dropdown, you shuld see different kinds of deployable artifact types. Choose the appropriate type and it will create an artifact for you. If your configuration is correct, it should gather all the files needed in that artifact by itself. After that, you must go in the Run/Debug configuration screen for your local weblogic server and on the "Deployment" tab, choose the artifact you created.
Here
Run/Debug Configurations Screen:
Notice the "Before launch" section. You must see your newly created artifact there. If not, simply click "+" and choose your artifact.
Take a look: Packaging the application in a JAR
It explains a jar deployment, but the process is really the same. You just have to choose web application or JavaEE application. Remember;
choose JavaEE Application for ear packaging.
choose Web Application for war packaging.
Exploded means it will deploy the extracted content of the war/ear. You should stick with exploded.

How To Add An External Folder With Configurations To A Web Application In Eclipse

I created a normal Dynamic Web Project in Eclipse. I added a folder to the project, which shows up after refreshing the project. The folder is containing an XML-file with configurations for the applications.
When I deploy the application on the tomcat in eclipse, the relative pathes do not match anymore. I need to copy the folder in the catalina home directory and then it works.
Question
How can I add the folder to my project, that when I start tomcat (V7) in eclipse the folder is deployed as well and the relative pathes work too?
When the development comes to an end, I will export a WAR-File and deploy it on my server. It would be great, if then the configurations will be included as well.
If you have any questions or you need some further information, do not hesitate to ask nor to comment!
In the project's properties I have found where I can add the folder when I export the WAR-file. But it doesn't deploy in eclipse's tomcat yet. This part is still remaining.
I copied the configs-folder into the WebContent-folder and accorded the paths.
Now i have two configurations, one for my local execution and one for the execution on Tomcat after the deployment.
Important Advise
I needed to accord the filepaths starting from CATALINA's home directory.

How to deploy Java/Spring application on my own system in Apache tomcat server.?

Hello all master minds,
I have created a java spring application in eclipse with mysql db.
Now I can run this application using >Run on server in eclipse,but I want to know how to deploy this application on my own laptop(windows 7).
I have already configured server,by localhost://8080 I can see Apache tomcat is configured.
Give me simple steps so that i can just run that software using browser via its link like
http://localhost:8080/PMS
PMS is my project name.
Thanks in advance.
You can install tomcat-manager in order to deploy your war using a web interface: Tomcat 7 manager
Another option is to copy your war file into tomcat webapps folder. Your container will auto deploy your war: http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html#Deployment_With_Tomcat.
The easiest way, since you are using eclipse is to just export your project as war and then put that war (naming it PMS) in webapps directory in your tomcat.
Once started, Tomcat will deploy that war on http://localhost:8080/PMS
You have to do the following steps:
Right click on project>> Export (Export as WAR file).
or if you are using a maven project then you can give a maven build.
Copy that WAR file, (you will get that war file inside the project folder in your workspace) to the tomcat_Installed_Folder/ webapps
Inorder to deploy the app from outside eclipse,
goto tomcat_Installed_Folder/bin
and double click on startup.bat
then you could see a console.
For detailed logs of deployment, goto tomcat_Installed_Folder/logs
ALL THE BEST :)

Deploying Spring MVC project

I've developed a small MVC project using Spring MVC, Hibernate, MySQL, Maven and Tomcat. I can run and test the application (locally) smoothly.
Now I need to publish/deploy this project on an (online) server that have only Tomcat installed on it. How can I publish/deploy the project online? Is there any special build I should do? What files I shall upload and to where?
There are several types of development options available.
For development on localhost EAR (Exploded ARchive) type of project is usually used (because you can easily make hot deploy on servery). But for production WAR (Web ARchive) is used (basically it's the same EAR archive, but compressed using ZIP algorithm).
If you want to deploy your project to remote Tomcat server then make your project as WAR archive and upload it to Tomcat's webapps directory. Then you might need to restart Tomcat. But it's manual way of deploying.
Better option is to use automated build tools (like Maven) which can compile your project, run unit tests, deploy on web server (local or remote) etc.
This one is a great example of how to deploy your project on Tomcat server by using Maven's tomcat-maven-plugin: http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
Good luck ;)
Do a mvn clean install and you will get a .war file in your target directory of web module.
Copy it and paste it in tomcat_home/webapps directory and restart tomcat. Thats it. now, you can access it in whatever configured port (eg: http://localhost:8080/<your webapp war name>). lets say your war name is myapp.war, then tomcat would have extracted it into myapp folder in webapps.
so your url will be http://localhost:8080/myapp
With maven deploy command, usually gets errors for various reasons.
if you work in Unix/Linux system, I recommend using "rsync" method on console. (You can write own shell script to manage easily). It helps not only deploying without a problem but also helps to get time while redeploying (only uploading changed / new files). Because maven deploy / redeploy uploads your project as a bundle in jar/war. However "rysnc" method uploads your project files one by one.
Before using it, you should sure that two conditions.
1- your project is built in target folder (Spring Tool Suite)
2- you have access to tomcat via ssh
example code : (v_ : prefix which is variable(customizable))
rsync -avz v_your_project_in_target root#v_ip:v_tomcat_name/webapps/v_project_name
(Second sharing)

Categories