How do you make this in IntelliJ - java

How would you make this in IntelliJ:
EJB project
WEB project
EAR project
then deploy the whole app to Glassfish with a single click on run? In eclipse I added the EAR project to glassfish with the plugin.
I have really no clue on where to start or how to connect the pieces in IntelliJ. Or, if you know about some Maven thing I could do to make the same thing

Project Structure (Ctrl+Alt+Shift+S) \ Artifacts. Set "Output directory" to deploy dir of JBoss.
See also
https://stackoverflow.com/questions/5757619/how-do-intellij-build-artifacts-and-run-configs-work-when-using-maven
How does Intellij deploy to JBoss?

Related

Eclipse JavaEE (Maven)project WAS 7 migration to IntelliJ

I'm trying to migrate a maven project from Eclipse to IntelliJ and would like to start/run/deploy to WebSphere portal.
My problem is that Eclipse IDE allows multiple open projects and one of the projects is an EAR that deploys a war file to WebSphere portal.
Eclipse Project structure:
Websphere Artifact deployed:
So how can I achieve the same thing in IntelliJ IDE using the already installed WebSphere?
I already configured successfully Websphere Portal and I can start the server but I donĀ“t know what type of artifact I'm supposed to configure here because there's no EAR artifact because that was a project back in eclipse:
If I go to artifacts setting for WebSphere I can add the war file, but it is not deployed.
I have googled a lot about this in IntelliJ documentation, IBM documentation but there are no concrete solutions, at least that I have the knowledge to implement. I'm a bit new to IntelliJ. Can someone share a light on this please, thx.
If it is a Maven-based project - just open and import it from the main pom.xml in IntelliJ IDEA - IDE will automatically configure project structure.
If Maven project has corresponding configuration for ear artifact - IDE will automatically create the artifact of the same ear type which then you will deploy to an application server.
If you do not configure ear in Maven, you can create one manually, see examples in documentation.
The name of your artifact is important, even if deployed as an exploded-archive. The file (archive) or directory (exploded) must end with .ear, .war or .jar. The default name set by Intellij may not work.
myProject_ear/ is wrong
myProject.ear/ is correct
The deployment system of your application server is likely configured to only deploy files or directories ending with the correct file-type. This is especially true if the server is using the file scanner to detect modules to deploy or un-deploy.

Different versions of war files using eclipse and maven

I have a mavenized web project which generates the war file. When I deploy this war file to the tomcat, it works fine. However, when I use eclipse to run the project on tomcat, it packages a different set of jars in the war and the deployment is unsuccessful. Would you have any pointers on how to get the same war file generated using eclipse as the one that i get using maven?
Thanks for the help
Right click on project
click on run as
click on run on server
set tomcat as your new runtime
then run
I hope it will help you.

Difference between compiling java app with maven and intellij idea

I develop a java web app in intellij which is then deployed to tomcat (tomcat integrated with intellij). It is a maven project.
So, usually I do this:
I run package goal in maven. Then I run tomcat in intellij.
Or I may not package it with maven and run tomcat in intellij right away.
So what is the difference then?
If I package it with maven and then run tomcat in intellij does the source code get compiled and packaged again and then deployed? Or just war produced by maven goal is deployed to tomcat?
Well if I don't package it and just run tomcat in intellij then it obviously gets compiled by intellij goal.
I am a bit confused here.
You don't need to run mvn package before running your webapp within Intellij.
What you can do is configure your Tomcat server to run your war exploded.
In the run/debug configuration, you can specify before launch operation.
By default,
a make is done
build artifact in exploded mode is done
If you prefer to work with a-non exploded war, last step would be build artifact instead of build exploded artifact.

deploy maven war file to tomcat from IntelliJ

I have a maven war project. How can I do do the following from within IntelliJ IDEA:
create .war file
deploy it to a local Tomcat
start Tomcat in debug mode
You need to configure maven-war-plugin to build your war. tomcat<x>-maven-plugin will allow you to deploy it to a tomcat instance and may in fact do the war generation too - I use JBoss at my current office so haven't got any experience with the maven tomcat integration.
see http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/ and http://maven.apache.org/plugins/maven-war-plugin/ for some more details on both of these plugins.
You can use the cargo plugin too. It works pretty well for me.

configure eclipse, tomcat and maven to improve productivity in webapp

(Am a maven noob)
Have a maven built webapp which uses spring, etc.
When I run "mvn clean install", it generates a .war file in the target directory.
I copy the .WAR file to tomcat for deploying the app.
Debug the app
Edit the code
This process takes a lot of time. When I earlier used ant, I would point tomcat's server.xml to my webapps directory. Also, Eclipse would put all of its classfiles in my webapp\WEB-INF\classes folder. If I had to modify any JSPs, I would just edit and there was no need of additional copying. If I modified a .java file, Eclipse would build it and put the .class file in the WEB-INF\classes folder so that Tomcat would pick it up.
Now, each time I make changes to a .jsp, I need to manually copy the .jsp to tomcat's webapps directory. Isn't there a way that a maven built app can optimize this process ?
So, where do you point your tomcat at that makes development productive?
project (where pom.xml resides)
src
main
java
resources
webapp
WEB-INF
target
webapp
webapp.war
Basically, I would like to know how to configure eclipse(3.7.1) and tomcat/maven so that the edit/deploy/debug cycle is really fast.
UPDATE1
1) I was able to get m2e(http://download.eclipse.org/technology/m2e/releases/) installed in indigo(v. 3.7.1 of eclipse). it had 2 components
a) maven integration for eclipse
b) slf4j logging
It installed successfully asking me to restart eclipse. I restarted.
2) Next, I installed m2e-wtp (at http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/)
It had 3 components
a) maven integration for eclipse
b) maven integration for eclipse Extras
c) maven integration for WTP.
When I selected all 3, I got some error. So, I unselected the 1st two and only selected the 3rd one and then it installed successfully asking me to restart eclipse. I restarted.
#Raghuram
I ran the 4 steps that you suggested below. Only the 4th step resulted in an error and my webapp could not get deployed. It resulted in an error "File not found --- .svn/.wcprops/.
http://i.imgur.com/Pg1aq.png
What should I make of it ?
Thanks again,
I'd recommend you to use cargo to deploy automatically to a local container (that can be downloaded and started)
Maven+Cargo
Then having that started with jpa activated (so that you can remotly debug your code) you just have to attach a listener and debug from eclipse, intellij, whatever.
For JSP, talking Intellij, you must tell your IDE where to package files (right-click 'package file") which is done in the project setup (output classes dir in WEB-INF/classes)
Check Tomcat 7 - Maven Plugin? for an example cargo configuration for Tomcat 7. After the confiuration is valid you can deploy to your Container using mvn cargo:deploy and mvn cargo:redeploy
If you use Eclipse Indigo with m2e and m2e-wtp, you can pretty much develop and debug your web application without any manual step.
Add tomcat as a server in Eclipse
Import your maven project as a maven project in Eclipse.
Build the project (using Eclipse or using maven)
Choose "Run as server...".
Eclipse will pretty much take care of hot deploying jsps as well as classes on changes.

Categories

Resources