[ACCEPTED]-Adding a standard comment header to all source files in eclipse-eclipse

Accepted answer
Score: 53

If you are looking for a tool with a good 4 Eclipse integration (and a nice GUI), I 3 suggest: Eclipse Copyright Generator

This adds:

  • a new Panel in the preferences (global or project based) with: Menu > Windows > Preferences > General > Copyright.
  • a Menu Menu > Project > Apply Copyright...
  • a realy nice Wizard with a lot of options and some default template for Open-Source licence (Apache, EPL, ...)

I just tried it with 2 eclipse 3.6 and it work fine.

There is an 1 update site to install it:

https://dl.bintray.com/jmini/Eclipse-Copyright-Generator/
Score: 29

Window > Preferences > Java > Code Style 1 > Code Templates > Comments > Files

Score: 9

In addition to the answer provided by Bozho, there 6 are the releng tools provided by eclipse, which 5 give you some menu item commands to fix 4 copyrights in existing files. You can install 3 the releng tools from this update site:

The 2 Eclipse Project Updates - http://download.eclipse.org/eclipse/updates/4.3

And there is a 1 small bit information available on it here:

https://wiki.eclipse.org/Development_Resources/How_to_Use_Eclipse_Copyright_Tool

Score: 7

In addition to Andrew Eisenberg's reply, here's 4 what I found out about the Eclipse copyright tool. I found this 3 to work best from all suggested solutions.

Pluses:

  • Easy to update copyright years or licence header.
  • Easy to apply to the whole project or just parts of it.

Minuses:

  • Does not work on all types of files. At least didn't work on JSP files for me.
  • You can not set up multiple licenses and apply them as you wish. There's only one licence.

Customization 2 (from preferences):

Customization (from preferences)

You can apply the license 1 at the file or package level

You can apply the license at the file or package level

Score: 4

The project that @Jmini link (Eclipse Copyright 8 Generator) seems dead, you can use this 7 plugin to add the headers: JAutoDoc, it's very easy 6 to use and have a lot of utilities for javadoc.

You 5 need to specify a licence in project|general > Preferences > java > JAutodoc > FileHeader and later 4 in the project use: project > JAutodoc > Add Header, make sure the option 3 Replace Existing Header is on.

The template is writing using Velocity, so 2 you can add all the information you need 1 as variables.

Score: 3

this is my setting under Window > Preferencers > Java > Code Style > Code Template > Code > New Java files:

/*
 * Copyright (c) 20XX XXXXXXXXX. All rights reserved. Whatever......
 */

${filecomment}  
${package_declaration}  

${typecomment}  
/**  
 *   
 * @author ${user}  
 *  
 */  
${type_declaration}  

0

More Related questions