The Maven style for Java is mainly:
public class MyMojo { // ---------------------------------------------------------------------- // Mojo components // ---------------------------------------------------------------------- /** * Artifact factory. * * @component */ private ArtifactFactory artifactFactory; ... // ---------------------------------------------------------------------- // Mojo parameters // ---------------------------------------------------------------------- /** * The POM. * * @parameter expression="${project}" * @required */ private MavenProject project; ... // ---------------------------------------------------------------------- // Mojo options // ---------------------------------------------------------------------- ... // ---------------------------------------------------------------------- // Public methods // ---------------------------------------------------------------------- /** * {@inheritDoc} */ public void execute() throws MojoExecutionException { ... } // ---------------------------------------------------------------------- // Protected methods // ---------------------------------------------------------------------- ... // ---------------------------------------------------------------------- // Private methods // ---------------------------------------------------------------------- ... // ---------------------------------------------------------------------- // Static methods // ---------------------------------------------------------------------- ... }
The Maven style for XML files is mainly:
<aTag> <simpleType>This is a simple type</simpleType> <complexType> <simpleType>This is a complex type</simpleType> </complexType> </aTag>
In some cases, adding comments could improve the readability of blocks, for instance:
<!-- Simple XML documentation -->
or
<!-- ====================================================================== --> <!-- Block documentation --> <!-- ====================================================================== -->
代码风格、代码规范----maven,布布扣,bubuko.com
原文:http://www.cnblogs.com/dfg-09/p/3574787.html