I am new to Stack Overflow because of my frustration to build a working Java EE 7 Project with Maven and IntelliJ ultimate.
I learned a lot about JPA and JSF in the last weeks and am thrilled to put my knowledge to use but unfortunately I am not able to create a working project structure as I get all sorts of errors along the way. I haven't found a single up to date tutorial which is working on the entire Internet.
My greatest achievement is creating a Maven project, and run the index page on a Jboss Wildfly (11) server.
I know Maven (3) requires a certain structure to work, I read that it is the one in picture 1.
Picture 1
Furthermore I know that I can add framework support by right clicking the project name and that I can add facets or modules by selecting files and project structure.
I would be very thankful if someone could explain the right creation of such a project. I already wasted double digit hours and lost a lot of fun.
I had to create a Maven Project with IntelliJ. After that I added JavaEE Application under Framework Support and checked the boxes for JSF and Web Application under Java EE aswell.
Now this doesn't work alone, I had to put this in the right structure Maven requires. I moved the META-INF Folder to main/src/resources. After renaming the web Folder to webapp, I moved it to src/main.
To check, go to Project Structure/ Facets and check if the paths are set correctly.
After adding a local Wildfly 11 Server Artifact (war), IntelliJ starts the default browser and I get to the index page.
The Project Structure
I recommend you take a look at JetBrains page, they have a lot of tutorials on how to use their products. Here how to create new Maven project:
https://www.jetbrains.com/help/idea/maven.html#maven_create_project
Also, here you have information how an example pom.xml file looks like and how to build it:
https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
When you develop your project you can add dependencies to the pom.xml file
Related
To start a new web project in Luna, I follow below steps.
1) Create a new Dynamic Web Project
2) Convert it into Maven by clicking configure option
The below is the obtained structure
http://i.stack.imgur.com/7Ph9M.jpg
This web project structure looks completely different from the one I see in the tutorial I follow. There the project structure is as follow
http://www.mkyong.com/wp-content/uploads/2010/06/Struts2-login-form-folder-stucture.jpg
I am not sure if the project structure is changed in new version or if I am doing something wrong. I made almost everything work but doesn't know where to place resources folder ( where we keep all our properties file ).
Can somebody assist me on how to create a new Struts2 project with proper structure :)
I found the answer here in this tutorial :D
http://o7planning.org/web/fe/default/en/document/300723/struts2-tutorial-for-beginners-annotation-configuration
I should have created Maven Project and picked web-app archetype. It is very simple.
I am using Kepler to build a Eclipse-Maven project in eclispe. While making the project I am skipping archetype selection on first wizard. then I am selecting packaging as "war".
Eclipse provides me a basic structure after above steps. However, as this is my first Spring/Maven application, I am unable to completely understand the structure.
My Main issue is where to keep my web.xml. No WEB-INF folder is provided, while a META-INF folder is provided.
Also where to keep the basic Dispatcher-Servlet for project and others like root-context, servlet-context etc..
Do I need to create these folders by myself. If yes, Where please? As I am creating a RESTful service, I won't have any views but I guess web.xml is still a must. Currently I am unable to upload an image(nothing happens when I try uploading), will try again soon.
While making the project I am skipping archetype selection on first
wizard. then I am selecting packaging as "war".
You need to select the maven archetype as: maven-archetype-webapp to get the WEB-INF folder & web.xml
Check this out
I want to add Maven facet to some project in Eclipse, but when I do that, it adds Dynamic Web Module to the project.
The first question is why ?
Second is how can I make it without adding web module??
thanks :)
I assume you are using MyEclipse, rather than just eclipse, with the m2e plugin. Also, I'm assuming the latest release of MyEclipse (2015 CI). If these assumptions are correct, note that the facet your are adding is for Maven Support of Java EE projects, which is why it is asking for the web project facet version. If you simply want to convert a java project to a maven project, right click on the project then select Configure->Convert to Maven project.
We just started with a liferay extranet project. We want it to be as much mavenized as possible. So far I read how to get it working with Maven and have a working setup. But I have some questions regarding the folder structure:
Do I need an (unpacked) sdk at all?
How should the folder structure look like (in future there will be many portlets, themes, exts... plugins)?
at the moment my structure looks like this:
liferay-portal-6.1.20-ee-ga2 (liferay tomcat bundle)
|-deploy
|-tomcat-7.0.27
|...
project-folder
|-pom.xml (parent pom)
|-sample-portlet (created with archetype:generate)
Is this ok? or it is probably better to create subfolders for each plugin type? does this interfere with the archetype and the automated connection between parent-pom and modules?
Does the mavenization changes something with workflow of liferay developer studio? This will be the ide of choice.
To answer your questions
You don't need plugins-sdk at all!
I advice you to go for a multi module maven project, and I already see you using it.
Obviously when you go for a multi-module project you have the sub-folders created and each module corresponds to a separate archetype and of course, it depends on what type of project you create.
Here is the sample liferay-maven project structure I had.
I have two maven projects with 2 poms (type). Some components from project 1 are depending on projects 2. Almost all components (maven) are osgi components.
The question is: since IntelliJ IDEA does not support multi-projects it is impossible to open two projects at the same time in one IDE instance.
Then, I believe, I'm going to have an issue to deploy my osgi components (they have are associated to OSGI Facets in IDE) to my osgi container from IDE (because it supposed to be handled by IDE, using those facets while deploying component to the osgi server, and if I can not see project 2 in my IDE then it could not handle it.. in terms of deploying and ide integration).
For example if I open two IDEs with project 1 in one, and project 2 in second ide, then if I change something in project 2 (1 depends on 2) .. should I configure the same (one) osgi sever in both IDEs, and deploy it separately?
Does someone have the same project structure, and what is the way to work with this in IntelliJ IDEA?
You can have only one IDEA project per window, but a single project can contain multiple Maven projects, see my answer in another post.
Open your first pom.xml via File > Open to create a new IDEA project, then open the Maven Projects view on the right, click on the green plus to add your second Maven project, and voila!
Once this is configured, you can create a new run/debug configuration which will deploy both artifacts on the same tomcat instance.