How to create maven project with GlassFish? - java

I start Java web project and I accustomed use maven for assemble my project. But when I open window for select project type I see:
My type Web Application in Java Enterprise section. And I need select web or maven.
How to create web project(I need GlassFish for Web-Socket) with the opportunity use maven?

Related

Not able to run a service on tomcat via IntelliJ Idea

I am working on a framework "beadledom".
I am also relatively very new to IntelliJ Idea, I have used eclipse before, the beadledom framework contains the project sub-module,
api
service
client
In Eclipse if we want to run the services, I would right click on "service" sub-module Run on Server -> tomcat ; and it would run.
My webapp is stored in "service" folder.
I have no clue how do I do it on IntelliJ
I did set the Run Configuartion.
I am being asked to create a "artifact" in Edit Configuration>Tomcat
enter image description here
The artifact is an archive, built from your project sources which constitutes your application. For Java EE web projects it is usually a war achrive which you deploy to an application server (e.g. Tomcat). In case of a Maven-based poject IntelliJ IDEA automatically creates web artifact, based on Maven pom.xml configuration which then you can select to deploy in Tomcat Run/Debug Configuration Deployment tab.
You could check Developing a Java EE Application tutorial for the general workflows in JavaEE-based projects in IntelliJ IDEA.

Migrate Java Web project from Maven to Ant

I have a Maven Web Application with Spring MVC and I need to convert it into a Java Web Application build with Ant. I am using Netbeans. The path structure should be the same? What configuration files should I add, remove, or change?
The reason of the change is beacuse I need to run the application without Internet connection.

Unable to create the WAR of my web application on Jboss

I am trying to deploy my web application with Jboss AS 6.x.
The problem I am facing is when I try to export the WAR file by right clicking on the project from left menu and export, there is no such option as to export the project as WAR.
I have installed JBoss Application Tools successfully. Integrated JBoss server successfully.
Where am I missing? Am I missing some necessary tools?
This option is available only if your project is Dynamic Web Project. The Java project, which is decorated with J letter on folder icon doesn't have the capability to export as WAR archive. But to deploy a web project you might try the approach "Run as...". And choose the server configured before to run a web project.
You can't convert a Java project to a Dynamic Web Project automatically with JBoss Application Tools. But if you have MyEclipse IDE then it's easy done just by adding a web capabilities. So, choose "New..." project wizard and "Dynamic Web Project" then follow the wizard pages.

Running Maven Struts2 app on tomcat

I created a Struts2 App using Eclipse M2 Maven plugin but there is no option to run the project on my tomcat server. I tried including the server runtime libraries in the projects build path but that doesn't work. How can I solve this problem?
In order to run project on server in eclipse, project must be in faceted form with Dynamic Web Module enabled. To convert project to faceted form: right click on project -> Properties -> Project Facets -> Convert to faceted form... -> check Java and Dynamic Web Module.
When you build the project, it should create an output, a war file or extracted war file. You need to deploy this on the server then only you can see the application. In eclipse I believe you can configure an server. Once you have configured a server in eclipse you can tell it to look for your project build output and deploy it.
Right click on the project and then Run As > Run on Server.
If you do not see that option that means your project is not configured as Web Application.

Maven and autobuilding other Eclipse projects to your web application

I have made my own frameworks, and I use these frameworks in my web applications. Now I have to create JAR file for my project and then copy this jar to web application lib path. Is it possible to make Maven do this for me.
(Currently I don't use Maven, because I didn't get it to work with GAE.)
Yes of course, this is possible, any build tool can do that (even a shell script).
So in maven, you define a module for your framework. You define another module for your webapp, configured as a web app, add a dependency between them. This dependancy is enough for maven to understand that your framework module jar must be included in the web application.
Here a quick introduction to maven : http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
And here a basic config file for web apps : http://maven.apache.org/guides/mini/guide-webapp.html
You can create a maven project for your framework and another one for your web application. Then you just add your framework project as a dependency to your web application and it is automatically copied to lib path.
Generate a project for your framework:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart
Generate a project for your web application:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
edit pom.xml of web application and add your framework as a dependency

Categories

Resources