Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project templates Eclipse / Java [closed]

I am researching possibilities to create "project templates" for the kind of projects my team is working on (Embedded Java). We want to make it trivial for a new developer to not mess up creating a new project. All the tools we use in our team should be pr

The basic idea is that there should be one command to set up a project and IDE to provide for the following:

  • Create a new Java project including Eclipse project file.
  • Create a Build script (needs to work outside of the IDE).
  • Include deploy options in the build script.
  • Set up a git project.
  • Setup PMD to run with a configured set of rules integrated in the IDE.
  • Setup Checkstyle to run with a configured set of rules integrated in the IDE.
  • Configure code templates (Eclipse) to match our teams coding guidelines (Javadoc, ...)
  • Configure the Eclipse code Formatter.
  • The configuration of the command should be upgradeable easily.

So far I see two ways to do this:

  • Maven 2 Archetype: I basically do not like maven because I have been fighting with it so often. I am not sure that the overhead of trying to make the tool do what I want it to justifies the effort. On the other hand it seems like this is exactly what archetypes are supposed to do. Do you have any experience in how far you can customize the eclipse:eclipse part? I guess that the eclipse configuration with be the most complicated step.
  • Eclipse Nature: I could create a project nature. As far as I understand the Eclipse Ecosystem that is the component that would show up, if I would choose to provide for something like right click -> New -> My Java Project Type. Do you know how far I can customize the resulting Eclipse project?
  • Shell Script: I could create an empty project with all the configuration in place, introduce some special tokens in the relevant plain text files (like and then write a shellscript that reads values for these options from a properties file, copy the project template and substitute the values.). While it is maybe a bit fragile, it seems like a easy and quick way of doing it.

Do give you a little more context: It is ok, if the result locks us into Eclipse. While the build should run without Eclipse (for our CI), the Team uses eclipse and it is highly unlikely that we will ever switch. Also all developers run more or less the same Hard+Software (Linux). We don't work in the domain of Enterprise Java Apps so we really don't need all the fancy dependency management stuff from maven. As a matter of fact our build process is so special, that it probably is much easier to just call make or ant scripts.

So the Questions are:

  1. Do you have any experience with this kind of stuff?
  2. Do you have an opinion towards either the Eclipse Nature way or Maven?
  3. Do you know other tools that provide for a setup like that?

Thank you very much for your input.

Cheers, Valentin

PS: People seem to be religious about their build tools. Please note that I do not want to start a flamewar here for or against maven. I am sure maven can be a great tool but I think in our context we only need 5% of its functionality and from my experience that remaining 95% can get in your way.

like image 637
Valentin Avatar asked Jan 19 '10 08:01

Valentin


People also ask

How do I open a closed Java project in Eclipse?

To reopen a closed project, in the Package Explorer view, select the closed project and click on the Project menu and select Open Project. Once the project is open its content can be edited using the Eclipse user interface.

What does close project mean in Eclipse?

A closed project is visible in the Package Explorer view but its contents cannot be edited using the Eclipse user interface. Also, an open project cannot have dependency on a closed project. The Package Explorer view uses a different icon to represent a closed project. © Copyright 2022.

How do I open a closed project explorer in Eclipse?

To view the project explorer, click on Window menu then, click on Show View and select Project Explorer. There is simpler way to open project explorer, when you are in the editor press alt + shift + w and select project explorer.

How do I open a template in Eclipse?

Click Ctrl+Space. The Content Assist box will appear, listing all available templates and completion options that begin with that combination of keys. Templates are marked in the content assist list with a blue square. Double-click the required template from the list.


2 Answers

You can also just create your own PDE tooling project and extend PDE project templates.

There is a great article at IBM DelevoperWorks network that gives a great introduction to Building templates with the Eclipse Plug-in Development Environment

You can also read up on Eclipse documentation about following PDE extension points:

  • org.eclipse.pde.ui.templates -- registers plug-in project content templates that are used to generate code for the new extensions
  • org.eclipse.pde.ui.newExtension -- contribute wizards that will be used to create and edit new extensions in PDE plug-in manifest editor
  • org.eclipse.pde.ui.pluginContent -- provides for contributing wizards that create additional content of the PDE plug-in projects
like image 149
Roland Tepp Avatar answered Oct 04 '22 04:10

Roland Tepp


Whatever you do, for God's sake, don't even think about using the Maven VIRUS for this. Exception: If you hate yourself, and enjoy inflicting needless pain on yourself and others because you get some kind of sick pleasure out of it--then, you should use Maven. If you also prefer to bleed internally while you work, throw in Ivy.

Eclipse generation IS a good idea (and probably ideal for the end users), but realistically to prevent this turning into such a large project, just go with the simple solution: create a template and use some simple method of customizing it. Just use a find/replace or a simple Python script if really needed. It's hard enough coming up with a complete, solid, re-usable template as it is (a project in itself). Let an Eclipse plug-in or other more automated version come later after you have a better idea of how much work this is.

The find/replace or script method isn't "fragile" since your template is going to be small and written by a single author, not some massive production application with who knows what inside of it. More complex solutions are the ones which tend to really become fragile, not the simple ones.

I think this is a fantastic idea so don't let anyone tell you otherwise, I create templates like this too.

like image 27
Manius Avatar answered Oct 04 '22 02:10

Manius