<java:merge> | Standard JET2 Java Tags
--- | ---

merge

Cause the template contents to be merged with the existing Java file using the EMF JMerge engine.

Tag Summary
required | <java:merge/>
full tag | <java:merge rules="value" rulesContext="value" facade="value" replaceLeadingTabsWith="value" bracesOnSeparateLine="value"/>

Optional Attributes
rules | A URL to the JMerge rules file. If the path is relative, then it is relative to the location specified by the rulesContext attribute. If not specified, the default is the JMerge rules used by the EMF Code Generator.
rulesContext | The context for resolving relative 'rules' URLs. Possible values are 'transform' or 'workspace'. If the value is 'transform', then the 'rules' URL is treated as a JET project relative path. If the value is 'workspace', then the 'rules' URL is treated as an Eclipse workspace relative path. The default is 'transform'.
facade | Specify the merge facade class to use. Default is for EMF 2.2 is org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMFacadeHelper. For EMF 2.3 and later, the default is org.eclipse.emf.codegen.merge.java.facade.ast.ASTFacadeHelper.
replaceLeadingTabsWith | If specified, and is not empty, leading tabs on each line are replaced with this string. If the attribute value is the empty string, leading tabs are retained. If not specified, the result depends on the rules file used. The default rules file uses two spaces.
bracesOnSeparateLine | If 'true', then the generated code is reformated so that opening braces '{' and closing braces '}' are on separate lines. If 'false', the code is not reformated. If not specified, the behavior is dependent on the rules file used. The default rules file is equivalent to specifying 'true'.

Example

... template generating a .java or .properties file ...
<%-- Merge the generated contents with any existing file, using the standard JMerge rules --%>
<java:merge/>
<%-- Merge using custom JMerge rules --%>
<java:merge rules="myMergeRules.xml" rulesContext="transform"/>
<%-- Explicit use of EMF Codegen merge rules (same as first) --%>
<java:merge rules="platform:/plugin/org.eclipse.emf.codegen.ecore/templates/emf-merge.xml"/>