开发者

Project templates Eclipse / Java [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 5 years ago.

Improve this question

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 开发者_JAVA技巧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.


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


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.


Have a look at Gradle, it supports the good stuff from Ivy (dependency management), Maven like Archetypes also.

Quick question though... how often do you have to create new projects ? Is it really that cumbersome that it would define which build system you would use ?

This being said, I do really like to have a standard project structure, saves a lot of time when trying to decide some stupid things that one should not even have to think about...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜