|
AdvancedHeaders
Give an example of an additional header definition for .Net regions.
IntroductionThis page will show you how you can define extended header definitions to feet your needs. The next example will define headers in a region area allowed in C# source files: <?xml version="1.0" encoding="ISO-8859-1"?>
<additionalHeaders>
<csregion_style>
<firstLine>#region LicenseEOL/**</firstLine>
<beforeEachLine> * </beforeEachLine>
<endLine> */EOL#endregion</endLine>
<firstLineDetectionPattern>#region.*^EOL/\*\*.*$</firstLineDetectionPattern>
<lastLineDetectionPattern>\*/EOL#endregion"</lastLineDetectionPattern>
<allowBlankLines>true</allowBlankLines>
<isMultiline>true</isMultiline>
</csregion_style>
</additionalHeaders>
You now have to add this new header definition file to the plugin configuration. It is done as the following in your pom: <headerDefinitions> <headerDefinition>yourdefinition.xml</headerDefinition> </headerDefinitions> You now have to add the new mapping for *.cs files to use this new header definition. It is done as the following in your pom: <mapping>
<cs>CSREGION_STYLE</cs>
</mapping>If you need more information on the pom configuration, just read the Configuration page. And it should generate headers like: #region License /** * Copyright (C) 2008 http://code.google.com/p/maven-license-plugin/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #endregion |
Sign in to add a comment
I'd like to be able to define my own header definition that is a single line. Is there any way to configure a header to do that?
// Copyright (c) ${year}, ${user}. All Rights Reserved.Hi,
Yes probably. I do not have time to try now but perhaps dealing with an empty start line and end line would do the trick, otherwise by adding some delimiters like // --- before and after.
But i will keep this case to be sure it will be possible in the future 2.0 version
Hi, I had got my answer to this suggestion from you via email but when considering your next release. Please provide some form of exclusions so that you don't update already copywrighted years that are in the past.