NetBeans 7.3 maven project "No web folder found" - maven

I am running the latest version of NetBeans (7.3) with GlassFish and I have created a maven web project that adds the necessary JSF 2.1 dependency. I am able to deploy the project and access the home page. The problem is that when I try to use the "JSF pages from Entities" wizard, I get the following error "No web folder found". If I try to add the JSF 2.1 framework support thru "Project/Properties/Framework" I get the same error.
I assume that NetBeans does not know that a "web folder" already exists but at a different location "project/src/main/webapp" (maven) instead of "project/web" as it normally expects if the project is a non-maven project. Does anybody know if there is a setting I can change, to let NetBeans know that the web folder is located under "project/src/main/webapp" instead of "project/web"?
I tried to get support thru the NetBeans forum/mailing-list but nobody responded.

I had the same problem when I tried to import an eclipse project.
After editing the "nbproject/project.properties" manually, changing the build.web.dir property to the right directory (WebContent instead of web) it seemed to work.

Related

How to create a Java EE 7 Maven IntelliJ Project

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

JSP with IntelliJ

Since a while I started to use IntelliJ instead of Eclipse. I created my project from Eclipse (where it was working) in IntelliJ and I can start the Spring Boot Application. As a Front-end I use JSP files, but when I open the project in my browser it shows only the HTML code, not the actual website. Can anyone help me with this problem?
I am aware that this thread is 3 years old, but since I'm currently working on something similar (spring boot + web application + jsp + intellij ultimate as IDE), wanted to share my experience...
created spring web application using spring initializr (provided
inside intellij IDEA)
created webapp folder under src/main
opened project structure window (ctrl-shift-alt), selected modules under project settings
in the middle window pane, selected Web
added newly created folder (src/main/webapp) under "web resources
directory"
applied changes
After that, in my "left click - new" drop down menu, jsp files were also provided...
My current Intellij IDEA Ultimate version is 2020.1
Hope this helps...
I also faced similar kind of issue earlier. I have solved it by adding the following dependency.
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
I have created a project sometime ago to cover this issue. The link to the project is mentioned below. Please refer it. I wish it will help you.
Spring Boot Maven Webapp

Spring STS not recognizing project structure with Gradle

I'm trying to do this getting started guide from Spring. So I cloned the project using git from the command line. As I'm working with Gradle, I removed the Maven files from the repository to clean the project.
After that I open my STS and go to File -> Open Projects from File System and navigate to the /initial folder of the repository. The project is imported correctly but when I try to add some "java stuff" (packages, classes, etc.) I get several errors and I can only add folders and files, which is quite annoying for working.
To be more descriptive, I'll add some images so you can see what's happening. This is the project initially imported into STS as I described above:
Then I try to add some java stuff, let's say for example a source folder. So Right Click on library -> New -> Source folder and this is the result:
And in the properties of library I have the following:
So the question is: how can I tell to STS to recognize the library folder as a Java Project (or Gradle module, I don't know how to call it) instead of a plain folder so I can add my packages and classes?
Thanks in advance for your answers.
In case you would like to work with Gradle, you should use the Gradle integration for Eclipse (project Buildship) and install that into your STS environment. After that, you should be able to import the projects either from disc as existing Gradle project (not as file system) or via the wizard that integrates the spring guides into STS (Import Getting Started Content). The wizard for the guides also let you choose between the Maven and the Gradle variant, so you don't need to close and delete stuff yourself.
Hope this helps!!!

Maven JavaFX Cannot find Main Class

I have some problems running my JavaFX8 Project with Maven. Here is the situation:
I create a Maven Java FX application within Netbeans (File --> New Project --> Maven JavaFX Application). Netbeans creates the packages and also creates a MainApp.java file.
Even if I don´t edit anything in this project, I get an error/warning within the properties.
Location: Right-Click Project --> Properties --> Run
Message: One of Run/Debug/Profile Project actions has been modified and the Run panel cannot be safely edited
The project can be built and run for some time, but after I create more packages, classes and stuff like that, I can´t run the application anymore.
It tells me, that it can´t find the Main class.
Message: Error: Could not find or load main class
I found some entries at stackoverflow and google, but none of the solutions seem to work for me.
I read this Topic for example.
One of the solutions is, to set the main class at the properties (Run), but all the fields are disabled. I also deleted the Cache, which didn´t solve the problem. I also checked the typing.
Some other sites stated, that it seems to be a bug, but they had older Netbean Versions. I updated my Netbeans version to 8.2 today.
The only solution at the moment is to create a new Maven JavaFX project and refactor the files to the new project. This works for a couple of hours but in the end the error occurs again.
Does anybody know a solution?
Use Run from the Project, not Run File from the main file. The latter can work on other setups, but not straight out of Maven.

Adding existing source packages to a Maven Web Application in Netbeans

I have a normal Netbeans project, and I would like to add the source packages of this project to a project that is a Maven Web Application, also within Netbeans.
I tried copy-pasting the packages into the /src project directory of the Maven application, but this doesn't seem to work.
Could someone please tell me how I could do this ?
If this is not possible, could someone tell me if I can convert the entire normal project into a Maven Web Application ? Thank you :)
It sounds like you need to add the dependency to your web-application instead of the source code, cause maven is intended to handle exactly such situations.

Resources