0

Short version: I would like to deploy Maven generated WAR to Local Tomcat server and not to build the war with internal IDEA process since the produced WAR file is not the same as the Maven generated one.

Long version: I have been using the Netbeans IDE for my Maven Java project. One of the modules is packaged as a WAR and should be deployed to tomcat server. In Netbeans when I selected "Run" on the Web Module it asks for application server configuration then it runs the maven 'package' goal and deploys the application(generated WAR) to the Tomcat Server probably via Tomcat manager. So far so good.

We are now in the process of switching to Scala language. Scala classes extend old Java classes and the project is now "Mixed". I have configured Maven to compile the project as a mix of scala and java code. Maven produces a WAR which can then be deployed to Tomcat server without trouble - everything works as it should.

Now I would like to switch to Intellij-idea 12 IDE. But I have a problem: IDEA is refusing to deploy Maven created artifacts and insists of building one by it's own. The war is not the same and can't be used. Is there a way to tell IDEA to use Maven generated WARs and not try to make it's own ?

Just for the record I have already read these articles:

Community
  • 1
  • 1
Tal G.
  • 483
  • 5
  • 15
  • Welcome to the fantastic world of Maven deploy connectors for IDE's. I've been suffering [similar problem in Eclipse](http://stackoverflow.com/questions/14728040/wtp-m2e-not-deploying-dependencies) where the Maven generated war worked and not the Eclipse generated one did. I fear everything you can do is to deploy it manually. – Aritz Mar 03 '13 at 15:30
  • Everything works as a charm in Netbeans since it simply deploys the WAR file. Perhaps there is a way to do it with IDEA that I haven't found yet. – Tal G. Mar 03 '13 at 15:37
  • 2
    Use **External source** [deployment option](http://img89.imageshack.us/img89/9527/20130303215725xb.png) in the application server Run configuration. Before Launch you can configure Maven goal to be executed instead of Make and use the folder generated by Maven as the external source. – CrazyCoder Mar 03 '13 at 17:58

1 Answers1

2

With the help of CrazyCoder I figured it out.

You can make Intellij-Idea to upload your war by selecting External Source External Source add Dialog

But that's not all, even if you have a context.xml file difining your Context Root inside your WAR file: http://docs.oracle.com/javaee/1.4/tutorial/doc/WebApp3.html

You must specify one for every artifact you deploying (Unless someone will correct me) You must specify Root Context

The before launch section can be used to tell Idea what to Maven Goal to Run if any enter image description here

Tal G.
  • 483
  • 5
  • 15
  • I'm wondering if there is a way in IDEA to read "Context root" from the context.xml file inside the "src/webapp/META-INF/context.xml" and not specify it by hand for every deployment ? – Tal G. Mar 05 '13 at 14:05