Netbeans Project Configuration When Using Maven Project - maven

does anyone know how to configure a project using maven? My issue is that when I create a project by doing New->Maven->Enterprise Application Project, I don't get all the IDE helpers that are available when I create the equivalent project using the default (which is an Ant project) option by doing New->Java EE->Enterprise Application Project.
If I go to the generated Main.java in the default project I get the option to use ALT+Insert which brings up useful Java EE code insertion helpers such as "Call Enterprise Bean", "Use Database", etc. These are not available in the maven generated project.
Looking at the default project's files, the project.xml contains this entry "org.netbeans.modules.j2ee.clientproject", which I believe is the IDEs instruction to generate the Java EE helpers for this project.
The maven projects project files, pox.xml and nb-configuration.xml, haven't got this entry. The nb-configuration.xml file does however have these entries:
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.7</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv3ee6</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
which must have something to do with the project setup. They don't give Java EE helpers though. Anyone have any idea how to add something like the defaults projects "org.netbeans.modules.j2ee.clientproject" to the maven project to get the helpers working??
Any help appreciated.

Related

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!!!

How can I create web fragment project in Intellij Idea

I'm looking for creating a small web framework on top of the standard servlet-3.x specifications. Main motive is to reduce the boiler plate codes and abstractions. After I read the servlet specifications it looks without using JAX-RS or SparkJava I can create small web framework for API developments.
I'm planning to use the web-fragments method to create my framework level filters, and other beans and package it as jar. So application developer create the war project with web.xml with the metadata-complete option set to false.
I can see the web-fragment project template in eclipse but I want to develop this project using maven. With Intellij I can't see any such options for web fragment projects alone. I want to create simple maven project which ship the jar with web-fragment.xml in it, so other war projects can make use of it.
So is there any plugins or other options available to develop web fragment projects in Intellij ?
Any jar file added to the WEB-INF/lib directory of a web application is technically a "web fragment", whether it has a META-INF/web-fragment.xml file or not.
Therefore, you just need to create a maven project with "jar" packaging and import it into Intellij Idea.
Create a maven project for the fragment. Set the packaging to jar. There is no need to create a war project.
Configure an empty Artifact in the Project Structure dialog:
Using the toolbar buttons, add the WEB-INF/lib folders. Then create an Archive and add the compile output:
Add a Tomcat run configuration, and in the Deployment tab, add the Artifact you just created:
I created an example project that includes all that: https://github.com/ThomasR/web-fragment-idea. Please note that it requires TomEE+.

Why i should add dynamic web module when installing maven facet?

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.

Building existing eclipse project with maven tool

I am new to maven tool. I have a java project on RAD 7.0.Compiling the project and building jar with RAD 7.0 taking huge time. So to remove the time wastage we planed to use maven 2.
we are not permitted to change the application structure and package structure. Please help me ?
You can keep application structure, you just have to parametrize correctly the pom.xml that describe the project.
In your pom.xml, you'll have to add all dependencies included in your classpath and project structure (sourceDirectory, testDirectory) via plugins
You can find some samples in the older post :
How to create the pom.xml for a java project with Eclipse?

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