Everytime when I create a new java web project, I have to configure and add many folders and property files for primefaces, hibernate, jsf, ldap, tomcat etc.
It wastes all my time. I find a solution for this, but it is not a generic solution.
My solution is that, I created a web project and configure all props and folders but not develop any code. It was an configured empty project. I mean it was my custom template project.
When I want to create a new web project, I always have to import this configured project and rename it. It's not a good way I think.
So, In the project creation tab, how can I add my custom project to creation wizard or how can I create my custom project in the beginning.
Is there any plugin or tool to create pre-configured template web project ?
Is there any tutorial to develop an eclipse plugin to do this ?
Thanks for your interest.
You probably need e.g. maven archetype that would generate such a project.
Alternatively you can use Spring Tool Suite, it has some predefined templates.
If you want to create plugin by yourself you can read more about Creating Eclipse Wizards (by Lars Vogel). But this is not so trivial (may need some work to make it work perfectly). Generally whole Lars Vogel's site is about creating Eclipse plugins.
Related
I'm using Eclipse and have the Liferay plugin installed and trying to create a new portlet. I want the Liferay IDE to pre-generate as much code as possible
Does anyone know what the main differences are between creating a new Liferay Portlet and a Liferay Plugin Project?
Liferay Plugin Project allows you to create a project (of type portlet, theme, hook etc..), with all dependencies and settings that you need to start coding (or almost).
Liferay portlet adds to one of your plugin projects of type portlet a class (the portlet class) and optionally a JSP. But you have to tell the portlet how use this class and jsp, and probably many other missing settings.
I suggest you always use the Liferay Plugin Project, its simpler and fast.
I'd rather use a different explanation than Marco:
A plugin project is what you add to the IDE - This is where your actual plugins live. Eclipse organizes around projects, and the projects are what makes up a plugin for Liferay. As the IDE interprets different kinds of projects in a different way (e.g. standalone Java Applications vs. "Dynamic Web projects" etc), a "Portlet Project" or "Theme Project" just adds to this list.
Once you have a plugin project (of type "Portlet") you can add as many portlets to it as you like. Thus, if you're developing portlets, you'll always have a minimum of one portlet plugin. This portlet plugin can hold any number of portlets.
You'll always deploy the whole plugin to Liferay - this fact might influence which portlets you want to group into a single plugin.
We are using a opensource grails project, we want to integrate it with our systems using message queues.
We can add our code for the message queues to the grails project. But what we would prefer to do is get the grails project to build a stand-alone jar file that we can then use from our project.
In our application we would want to initiate the hibernate/GORM layer of the opensource grails project, we don't need to the web layers as we are using messaging.
Ideally we would like our project to be a Spring/Java, however if this not practical then we would use a grails project.
Is any of this possible, or are they better ways to extend an existing grails project?
There is no out-of-the-box way of reusing a Grails application in a Spring/Java application, although there are ways to use GORM standalone in a Spring application (as discussed here)
My advice would be to extend the Grails application. If Groovy or certain Grails features are not desirable, you can still work with the project as if it was a plain Java-based Spring project by adding Java sources to src/java, using a separate beans.xml Spring bean configuration file and other "fallbacks".
I've been working with Visual Studio for a long long time, but now I'm been requested to work on a Java web project. We've decide to use Spring MVC as framework, and we want to use Log4J (for logging obviously =P) and JUnit for unit testing. Now, in the "Microsoft way" I will create a Solution, and I'll add A web project and a Unit testing project; now that I'm usign Netbeans, is it possible to do like that? Or how should I organize my projects?
Thanks for sharing your experience!
Have you thought about using Maven as a way to manage your project? I've heard really good things about it.
You can find a list of what Maven is, exactly, here.
In short, it has the following goals (I took these from the web site):
Making the build process easy
Providing a uniform build system
Providing quality project information
Providing guidelines for best practices development
Allowing transparent migration to new features
Try to use maven, and there is a standard way for a project :)
In Netbeans you specify what type of project you want to create, say Java Web Application. Netbeans will then create the files and folders to support that project. Within the project view explorer, you can see the 'Test Packages' node, this is where you add java classes to support your unit testing. When you add a unit test, Netbeans will add a reference to the correct JUnit library to your project (you can see this on project properties > libraries > compile test).
For Spring MVC, the same goes. You add a dependency in Netbeans, either at project creation time, or from the properties dialog afterwards.
This is just tip of the iceberg. So I hope this information allows you to at least get started and you can return with more specific questions as you get further in.
I am new to Java world but I am pretty good at using Flex, actionscript 3, Ant and even Maven to some extent. Now I would like to learn some java and use Hibernate and JBoss (webapp).
I already have Maven working and have found the m2eclipse plugin on the web, it seem pretty nice for maven integration.
Now I would like to know how to set the project using "best practices" if possible and start the ball rolling. My question is not about using Java or Hibernate, it is just about project settings / configuration using m2eclipse or maybe another tool if necessary.
Thank you in advance for your help.
Actually, archetypes are not m2eclipse specific, they are maven species. But this was just a side note. Now, to answer your question, there is "sadly" no unique option and I hope I won't make things more confusing at listing them:
You could simply use the maven-archetype-webapp archetype to create a blank webapp and setup the Hibernate stuff yourself (follow the Hibernate tutorial which is maven based).
You could create a more specialized webapp (using the struts2-archetype-starter or the wicket-archetype-quickstart or a MyFaces archetype) and setup the Hibernate stuff yourself.
You could use the javaee5-maven-archetype archetype to create a Java EE 5 (JSF 1.2 + EJB 3) application.
You could use the softeu-archetype-seam archetype to create a JBoss Seam application (JSF+Facelets+Seam).
You could use one of the numerous AppFuse archetypes (Hibernate, Spring and the presentation framework of your choise) to create an "AppFuse" application.
If you want some guidance, my recommendation would be to go for an AppFuse archetype.
Choose a presentation framework and pick up the corresponding archetype. If you want a more "naked" solution, generate a blank webapp and setup hibernate yourself (follow the mentioned tutorial).
I use a library which includes, among other things, a servlet. I've fetched the source for this lib to a dynamic web project and it works fine.
I'd like to make an example dynamic web application in another project which would just reference to the classes of this library. Is it possible to do it this way in Eclipse Galileo and deploy to Tomcat.
This I like to do, so that in the library source project I have only the libs own code and my modifications to it and my example app would be a totally another app.
In Eclipse I've referenced my example app project to the lib project and it works fine when coding, but when I try to access the example app URL it throws a ServletException because it can't find the Servlet.
The libs own web page works fine.
Can you not just create a JAR containing the classes you which to share and then reference this JAR in each project?
I would recommend staying away from IDE features like the ones in Eclipse that try to bundle up your app and deploy it for you - I find it helps much more to control this yourself, with your own build scripts, app server setup, etc.
This way you aren't stuck wondering why a certain nuance of the IDE works the way it does (such as, why is Eclipse not deploying the output of a project I've added as a "reference" along with this project?) - you can completely control your own environment. It's more valuable to know how to bundle up and deploy things on your own anyway (since it works the same regardless of whatever IDE you are using), and the tools behind it are a lot more powerful than any "press this shiny button and everything gets deployed and launched" feature in your IDE.