This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Deploy to Tomcat with Maven  RSS feed

 
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

How could I instruct maven to deploy to local tomcat after building a war?
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I have to use the maven cargo plugin?? If yes, then how? Any suggestions?
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was not so informative. It tried that and it did not work. I mean after executing mvn:tomcat deploy nothing happened.
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the following mean?



By path, do they mean that it is the path of the war file? I guess yes and the war file that I have is generated under the target folder of my web project. So does that mean I specify the target folder location and it is a folder that normally gets rewirtten when I say mvn clean:deploy....Can anyone throw some lights on this?
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jothi Shankar Kumar wrote:I mean after executing mvn:tomcat deploy nothing happened.


What does the output of Maven look like?
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a war file.
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I meant, if you type "mvn tomcat:deploy" into your console, what does the output look like?
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will run that today at home and paste the result here.
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here it is,

[INFO] Webapp assembled in[125 msecs]
[INFO] Building war: D:\My Projects\MyWebApp\web\targ
et\MyWeb.war
[INFO] [tomcat:deploy {execution: default-cli}]
[INFO] Deploying war to http://localhost:8080/web
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot invoke Tomcat manager

Embedded error: Connection refused: connect
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Mon Nov 23 21:46:41 CET 2009
[INFO] Final Memory: 19M/35M
[INFO] ------------------------------------------------------------------------

 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I have to start tomcat before I execute this maven goal?
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did start tomcat and it worked. Now I'm trying to get that done using IntelliJ. Will post if I hit any problems.
 
Joe Harry
Ranch Hand
Posts: 10191
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allright that seems to work as well. But it seems to not pick the correct war file. I do not know from where it places the web.war. My war file is actually MyWeb.war. Here is what I have for the build configuration.



The above mentioned entry isin the parent pom of the web project. The pom in my web project has the following entry,

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings Jothi -

Not sure if you're still having issues with this, but if you're doing a standard build/package where the war is being put into the <project_home>/target folder, I'd suggest removing the optional <warFile> element and allowing the tomcat-plugin to use the default settings. This seems to work quite well for me, using a mvn clean tomcat:redeploy will build and push up the new war. Which reminds me, using the 'clean' goal prior to any build is a good practice to get into, as it assures that you're getting the freshest bits.

My current configuration is:


Keep in mind that by default the tomcat-plugin will expect your manager login to be "admin' "<blank>", in other words the user is 'admin' and there is no password set....these are configured in the <tomcat_home>/conf/tomcat-users.xml file.

Hope this helps someone!
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!